1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-11584: GRANT inside an SP does not work well on 2nd execution

Allocate password hash in statment memory
This commit is contained in:
Oleksandr Byelkin
2016-12-21 17:41:48 +01:00
parent 143d512a22
commit 100f721c0a
3 changed files with 25 additions and 0 deletions

View File

@ -8040,3 +8040,12 @@ v_name v_total
c 1
DROP PROCEDURE p1;
DROP TABLE t1;
#
# MDEV-11584: GRANT inside an SP does not work well on 2nd execution
#
CREATE PROCEDURE sp1()
GRANT ALL PRIVILEGES ON *.* TO 'foo'@'%' IDENTIFIED BY 'pass';
CALL sp1();
CALL sp1();
drop user 'foo'@'%';
drop procedure sp1;

View File

@ -9484,3 +9484,14 @@ CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
--echo #
--echo # MDEV-11584: GRANT inside an SP does not work well on 2nd execution
--echo #
CREATE PROCEDURE sp1()
GRANT ALL PRIVILEGES ON *.* TO 'foo'@'%' IDENTIFIED BY 'pass';
CALL sp1();
CALL sp1();
drop user 'foo'@'%';
drop procedure sp1;

View File

@ -1064,7 +1064,12 @@ static bool fix_lex_user(THD *thd, LEX_USER *user)
make_scramble= my_make_scrambled_password;
}
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
char *buff= (char *) thd->alloc(scramble_length + 1);
if (arena)
thd->restore_active_arena(arena, &backup);
if (buff == NULL)
return true;
make_scramble(buff, user->pwtext.str, user->pwtext.length);