summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-08-22 15:48:50 -0700
committerunknown <jimw@mysql.com>2005-08-22 15:48:50 -0700
commitd40acb4d3f34a99a3d700021b0ae89b623e0ff94 (patch)
tree4ec1e5b9749edb7242d6bf464e54da5b13496dbd /sql/set_var.cc
parentb977af8ace45a57abf4d1046d750997a275c4b9e (diff)
downloadmariadb-git-d40acb4d3f34a99a3d700021b0ae89b623e0ff94.tar.gz
Use the hostname with which the user authenticated when determining which
user to update with 'SET PASSWORD = ...'. (Bug #12302) mysql-test/r/grant2.result: Add new results mysql-test/t/grant2.test: Add new tests sql/set_var.cc: Pass priv_host into check_change_password(). sql/sql_acl.cc: Add exact flag for find_acl_user, so we can specify that we want an exact match on the hostname.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index f7700d18607..1b66b68b349 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -2944,7 +2944,18 @@ int set_var_password::check(THD *thd)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!user->host.str)
- user->host.str= (char*) thd->host_or_ip;
+ {
+ if (thd->priv_host != 0)
+ {
+ user->host.str= (char *) thd->priv_host;
+ user->host.length= strlen(thd->priv_host);
+ }
+ else
+ {
+ user->host.str= (char *)"%";
+ user->host.length= 1;
+ }
+ }
/* 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;