mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#48319: Server crashes on "GRANT/REVOKE ... TO CURRENT_USER"
CURRENT_USER() in GRANT ... TO CURRENT_USER() only gave us a definer, not a full user (i.e., password-element was not initiliazed). Hence dereferencing the password led to a crash. Properly initializes definers now, just so there are no misunderstandings. Also does some magic so IDENTIFIED BY ... works with CURRENT_USER().
This commit is contained in:
@ -3451,6 +3451,13 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
No User, but a password?
|
||||
They did GRANT ... TO CURRENT_USER() IDENTIFIED BY ... !
|
||||
Get the current user, and shallow-copy the new password to them!
|
||||
*/
|
||||
if (!tmp_Str->user.str && tmp_Str->password.str)
|
||||
Str->password= tmp_Str->password;
|
||||
if (replace_user_table(thd, tables[0].table, *Str,
|
||||
(!db ? rights : 0), revoke_grant, create_new_users,
|
||||
test(thd->variables.sql_mode &
|
||||
|
Reference in New Issue
Block a user