summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-24 19:14:59 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-24 19:14:59 +0400
commit7103f4c91631dd1e725996429a6f8ccaf4d844d8 (patch)
tree00fbad8b415e76e90185da6aff202f3575928e51 /sql/set_var.cc
parent65c3d37111c510f544196c6d57b46674a80ef6d7 (diff)
downloadmariadb-git-7103f4c91631dd1e725996429a6f8ccaf4d844d8.tar.gz
Bug#41456 SET PASSWORD hates CURRENT_USER()
init user->user struct with thd->security_ctx->priv_user context if user->user is not initializied 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
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 59741e5683d..a29abe6581f 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -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;