summaryrefslogtreecommitdiff
path: root/mysql-test/r/grant2.result
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2009-10-29 22:06:10 -0700
committerTatiana A. Nurnberg <azundris@mysql.com>2009-10-29 22:06:10 -0700
commitbe04d1a47953188ced936a81824fdf871b8e9656 (patch)
tree5362f4cc06982ec7cbf92713468b4bd9a4462b06 /mysql-test/r/grant2.result
parent09668c0124bef7666f2b8b66a23e9102580fcaf2 (diff)
downloadmariadb-git-be04d1a47953188ced936a81824fdf871b8e9656.tar.gz
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(). mysql-test/r/grant2.result: Show GRANT ... TO CURRENT_USER() no longer crashes. Show it to work with IDENTIFIED BY to boot. mysql-test/t/grant2.test: Show GRANT ... TO CURRENT_USER() no longer crashes. Show it to work with IDENTIFIED BY to boot. sql/sql_acl.cc: Make IDENTIFIED BY ... work with CURRENT_USER() sql/sql_parse.cc: Zero password-part of definer just in case somebody mistakes this for a complete LEX_USER!
Diffstat (limited to 'mysql-test/r/grant2.result')
-rw-r--r--mysql-test/r/grant2.result27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 7c2023127f0..12269f0cb1c 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -443,3 +443,30 @@ DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
DROP DATABASE db1;
End of 5.0 tests
+USE mysql;
+SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u;
+SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h;
+SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd;
+SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
+user host password insert_priv
+root localhost Y
+UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
+SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
+user host password insert_priv
+root localhost N
+GRANT INSERT ON *.* TO CURRENT_USER();
+SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
+user host password insert_priv
+root localhost Y
+UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
+GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose';
+SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
+user host password insert_priv
+root localhost *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y
+UPDATE user SET password=@pwd WHERE user=@u AND host=@h;
+SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
+user host password insert_priv
+root localhost Y
+FLUSH PRIVILEGES;
+USE test;
+End of 5.1 tests