summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-09-22 10:59:33 +0300
committerunknown <monty@mashka.mysql.fi>2002-09-22 10:59:33 +0300
commit6546f36e2d8378f224114b88cae3806684990162 (patch)
tree9bdcec4c2cce4db72873b8d790dc4c3c011c5f0f /sql/sql_acl.cc
parentcc71ac185d1dcef30a964b5f0b98ef4ebce263d1 (diff)
parent0e88d440d689cb8805bab3a7bcca274e0aa5c975 (diff)
downloadmariadb-git-6546f36e2d8378f224114b88cae3806684990162.tar.gz
Merge with 3.23.53
Docs/manual.texi: Auto merged sql/lock.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged tests/grant.pl: Auto merged sql/sql_acl.cc: Merge with 3.23.53 (fixes problem with critical region in GRANT) sql/sql_insert.cc: Merge with 3.23.53 (no changes) sql/sql_parse.cc: Merge with 3.23.53 (no changes) sql/sql_udf.cc: Merge with 3.23.53 (indent change) sql/table.h: Merge with 3.23.53 (no changes)
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 6ff93eecedd..0705762e311 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2033,6 +2033,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
while ((Str = str_list++))
{
+ int error;
GRANT_TABLE *grant_table;
if (!Str->host.str)
{
@@ -2047,8 +2048,11 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
continue;
}
/* Create user if needed */
- if (replace_user_table(thd, tables[0].table, *Str,
- 0, revoke_grant, create_new_users))
+ pthread_mutex_lock(&acl_cache->lock);
+ error=replace_user_table(thd, tables[0].table, *Str,
+ 0, revoke_grant, create_new_users);
+ pthread_mutex_unlock(&acl_cache->lock);
+ if (error)
{
result= -1; // Remember error
continue; // Add next user
@@ -2064,7 +2068,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
{
my_printf_error(ER_NONEXISTING_TABLE_GRANT,
ER(ER_NONEXISTING_TABLE_GRANT),MYF(0),
- Str->user.str, Str->host.str, table_list->alias);
+ Str->user.str, Str->host.str, table_list->real_name);
result= -1;
continue;
}
@@ -2593,6 +2597,7 @@ bool check_grant_db(THD *thd,const char *db)
ulong get_table_grant(THD *thd, TABLE_LIST *table)
{
+ uint privilege;
char *user = thd->priv_user;
const char *db = table->db ? table->db : thd->db;
GRANT_TABLE *grant_table;
@@ -2604,8 +2609,9 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table)
table->grant.version=grant_version;
if (grant_table)
table->grant.privilege|= grant_table->privs;
+ privilege= table->grant.privilege;
pthread_mutex_unlock(&LOCK_grant);
- return table->grant.privilege;
+ return privilege;
}
@@ -2716,6 +2722,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (send_fields(thd,field_list,1))
DBUG_RETURN(-1);
+ pthread_mutex_lock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock));
/* Add first global access grants */
@@ -2971,13 +2978,16 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
thd->packet.length()))
{
error=-1;
- goto end;
+ break;
}
}
}
}
+
end:
VOID(pthread_mutex_unlock(&acl_cache->lock));
+ pthread_mutex_unlock(&LOCK_grant);
+
send_eof(&thd->net);
DBUG_RETURN(error);
}