summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-12-28 09:23:27 +0100
committerunknown <msvensson@neptunus.(none)>2005-12-28 09:23:27 +0100
commit9a8dde9bc7b20a4753611290f6d3b649321d02a0 (patch)
tree288eeae9f1d933abe63dbcc8862ec0243c969039 /sql/sql_acl.cc
parentaa6d8551f80e02026243897dad708d87836ce947 (diff)
downloadmariadb-git-9a8dde9bc7b20a4753611290f6d3b649321d02a0.tar.gz
BUG#15775 "drop user" command does not refresh acl_check_hosts
- DROP USER command didn't reload the acl_check_hosts cache causing subsequent connect's via TCP to fail randomly. - 4.1 version mysql-test/r/grant2.result: Update test results mysql-test/t/grant2.test: Add test for to check that connect via TCP work after "drop user" sql/sql_acl.cc: Reload acl_check_hosts as its memory is mapped to acl_user Use acl_user->host.hostname when searching the acl_check_hosts list
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 1ade6ce3064..0ee83424d9f 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1151,7 +1151,7 @@ static void init_check_host(void)
if (j == acl_wild_hosts.elements) // If new
(void) push_dynamic(&acl_wild_hosts,(char*) &acl_user->host);
}
- else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host,
+ else if (!hash_search(&acl_check_hosts,(byte*) acl_user->host.hostname,
(uint) strlen(acl_user->host.hostname)))
{
if (my_hash_insert(&acl_check_hosts,(byte*) acl_user))
@@ -3719,17 +3719,25 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
record[0])))
{
tables[0].table->file->print_error(error, MYF(0));
- DBUG_RETURN(-1);
+ result= -1;
+ goto end;
}
delete_dynamic_element(&acl_users, acl_userd);
}
}
+ if (result)
+ my_error(ER_DROP_USER, MYF(0));
+
+end:
+ /* Reload acl_check_hosts as its memory is mapped to acl_user */
+ delete_dynamic(&acl_wild_hosts);
+ hash_free(&acl_check_hosts);
+ init_check_host();
+
VOID(pthread_mutex_unlock(&acl_cache->lock));
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
- if (result)
- my_error(ER_DROP_USER, MYF(0));
DBUG_RETURN(result);
}