List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:December 17 2008 10:21am
Subject:bzr commit into mysql-5.0-bugteam branch (Sergey.Glukhov:2746)
Bug#41456
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.0-bug-41456/ based on revid:timothy.smith@stripped

 2746 Sergey Glukhov	2008-12-17
      Bug#41456 SET PASSWORD hates CURRENT_USER()
      init user->user struct with 
      thd->security_ctx->priv_user context
      if user->user is not initializied
modified:
  mysql-test/r/grant.result
  mysql-test/t/grant.test
  sql/set_var.cc

per-file messages:
  mysql-test/r/grant.result
    test result
  mysql-test/t/grant.test
    test case
  sql/set_var.cc
    init user->user struct with 
    thd->security_ctx->priv_user context
    if user->user is not initializied
=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result	2008-03-27 12:37:20 +0000
+++ b/mysql-test/r/grant.result	2008-12-17 11:22:54 +0000
@@ -1151,4 +1151,9 @@ drop user 'greg'@'localhost';
 drop view v1;
 drop table test;
 drop function test_function;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
+SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
 End of 5.0 tests

=== modified file 'mysql-test/t/grant.test'
--- a/mysql-test/t/grant.test	2008-03-27 12:37:20 +0000
+++ b/mysql-test/t/grant.test	2008-12-17 11:22:54 +0000
@@ -1175,4 +1175,11 @@ drop view v1;
 drop table test;
 drop function test_function;
 
+#
+# Bug#41456 SET PASSWORD hates CURRENT_USER()
+#
+SELECT CURRENT_USER();
+SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
+SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
+
 --echo End of 5.0 tests

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2008-11-28 14:25:16 +0000
+++ b/sql/set_var.cc	2008-12-17 11:22:54 +0000
@@ -3475,6 +3475,7 @@ int set_var_password::check(THD *thd)
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   if (!user->host.str)
   {
+    DBUG_ASSERT(thd->security_ctx->priv_host);
     if (*thd->security_ctx->priv_host != 0)
     {
       user->host.str= (char *) thd->security_ctx->priv_host;
@@ -3486,6 +3487,12 @@ int set_var_password::check(THD *thd)
       user->host.length= 1;
     }
   }
+  if (!user->user.str)
+  {
+    DBUG_ASSERT(thd->security_ctx->priv_user);
+    user->user.str= (char *) thd->security_ctx->priv_user;
+    user->user.length= strlen(thd->security_ctx->priv_user);
+  }
   /* Returns 1 as the function sends error to client */
   return check_change_password(thd, user->host.str, user->user.str,
                                password, strlen(password)) ? 1 : 0;

Thread
bzr commit into mysql-5.0-bugteam branch (Sergey.Glukhov:2746)Bug#41456Sergey Glukhov17 Dec