Commit 100f721c authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

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

Allocate password hash in statment memory
parent 143d512a
......@@ -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;
......@@ -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;
......@@ -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);
......
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