From d40acb4d3f34a99a3d700021b0ae89b623e0ff94 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Aug 2005 15:48:50 -0700 Subject: 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. --- sql/set_var.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sql/set_var.cc') 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; -- cgit v1.2.1