Commit 86ce202f authored by unknown's avatar unknown

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)
parents 0ef39863 a51cd95b
...@@ -51252,10 +51252,16 @@ not yet 100% confident in this code. ...@@ -51252,10 +51252,16 @@ not yet 100% confident in this code.
@item @item
Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value. Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value.
@item @item
Fixed race condition when someone did a @code{GRANT} at the same time a new
user logged in or did a @code{USE DATABASE}.
@item
Fixed bug in @code{ALTER TABLE} and @code{RENAME TABLE} when running with Fixed bug in @code{ALTER TABLE} and @code{RENAME TABLE} when running with
@code{-O lower_case_table_names=1} (typically on windows) when giving the @code{-O lower_case_table_names=1} (typically on windows) when giving the
table name in uppercase. table name in uppercase.
@item @item
Fixed that @code{-O lower_case_table_names=1} also converts database
names to lower case.
@item
Fixed unlikely core dump with @code{SELECT ... ORDER BY ... LIMIT}. Fixed unlikely core dump with @code{SELECT ... ORDER BY ... LIMIT}.
@item @item
Changed @code{AND/OR} to report that they can return NULL. This fixes a Changed @code{AND/OR} to report that they can return NULL. This fixes a
...@@ -2033,6 +2033,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, ...@@ -2033,6 +2033,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
while ((Str = str_list++)) while ((Str = str_list++))
{ {
int error;
GRANT_TABLE *grant_table; GRANT_TABLE *grant_table;
if (!Str->host.str) if (!Str->host.str)
{ {
...@@ -2047,8 +2048,11 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, ...@@ -2047,8 +2048,11 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
continue; continue;
} }
/* Create user if needed */ /* Create user if needed */
if (replace_user_table(thd, tables[0].table, *Str, pthread_mutex_lock(&acl_cache->lock);
0, revoke_grant, create_new_users)) 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 result= -1; // Remember error
continue; // Add next user continue; // Add next user
...@@ -2064,7 +2068,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, ...@@ -2064,7 +2068,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
{ {
my_printf_error(ER_NONEXISTING_TABLE_GRANT, my_printf_error(ER_NONEXISTING_TABLE_GRANT,
ER(ER_NONEXISTING_TABLE_GRANT),MYF(0), 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; result= -1;
continue; continue;
} }
...@@ -2593,6 +2597,7 @@ bool check_grant_db(THD *thd,const char *db) ...@@ -2593,6 +2597,7 @@ bool check_grant_db(THD *thd,const char *db)
ulong get_table_grant(THD *thd, TABLE_LIST *table) ulong get_table_grant(THD *thd, TABLE_LIST *table)
{ {
uint privilege;
char *user = thd->priv_user; char *user = thd->priv_user;
const char *db = table->db ? table->db : thd->db; const char *db = table->db ? table->db : thd->db;
GRANT_TABLE *grant_table; GRANT_TABLE *grant_table;
...@@ -2604,8 +2609,9 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table) ...@@ -2604,8 +2609,9 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table)
table->grant.version=grant_version; table->grant.version=grant_version;
if (grant_table) if (grant_table)
table->grant.privilege|= grant_table->privs; table->grant.privilege|= grant_table->privs;
privilege= table->grant.privilege;
pthread_mutex_unlock(&LOCK_grant); 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) ...@@ -2716,6 +2722,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (send_fields(thd,field_list,1)) if (send_fields(thd,field_list,1))
DBUG_RETURN(-1); DBUG_RETURN(-1);
pthread_mutex_lock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
/* Add first global access grants */ /* Add first global access grants */
...@@ -2971,13 +2978,16 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) ...@@ -2971,13 +2978,16 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
thd->packet.length())) thd->packet.length()))
{ {
error=-1; error=-1;
goto end; break;
} }
} }
} }
} }
end: end:
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
pthread_mutex_unlock(&LOCK_grant);
send_eof(&thd->net); send_eof(&thd->net);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -424,7 +424,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) ...@@ -424,7 +424,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
/*************************************************************************** /***************************************************************************
** List all columns in a table ** List all columns in a table_list->real_name
***************************************************************************/ ***************************************************************************/
int int
......
...@@ -141,7 +141,7 @@ void udf_init() ...@@ -141,7 +141,7 @@ void udf_init()
new_thd->db_length=5; new_thd->db_length=5;
bzero((gptr) &tables,sizeof(tables)); bzero((gptr) &tables,sizeof(tables));
tables.alias= tables.real_name = (char*) "func"; tables.alias= tables.real_name= (char*) "func";
tables.lock_type = TL_READ; tables.lock_type = TL_READ;
tables.db=new_thd->db; tables.db=new_thd->db;
......
...@@ -304,7 +304,7 @@ safe_query("revoke GRANT OPTION on $opt_database.test from $user",1); ...@@ -304,7 +304,7 @@ safe_query("revoke GRANT OPTION on $opt_database.test from $user",1);
# #
safe_query("grant select(a) on $opt_database.test to $user"); safe_query("grant select(a) on $opt_database.test to $user");
user_query("show columns from test"); user_query("show full columns from test");
safe_query("grant insert (b), update (b) on $opt_database.test to $user"); safe_query("grant insert (b), update (b) on $opt_database.test to $user");
user_query("select count(a) from test"); user_query("select count(a) from test");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment