summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-01-24 20:43:19 +0100
committerSergei Golubchik <serg@mariadb.org>2016-01-25 22:57:53 +0100
commit68910e7092a3741fff56632b84f5eb340ef99245 (patch)
treea792085039b7a1094336c99e061ceafcf8ea522e /sql/sql_acl.cc
parentd14c4c7874b0de1da452499967b8000a4ac83d67 (diff)
downloadmariadb-git-68910e7092a3741fff56632b84f5eb340ef99245.tar.gz
MDEV-9273 ERROR 1819 on grant statment for existing user
Cannot do password validation in fix_lex_user(), we don't know there what "GRANT ... TO user" means - creating a new user with an empty password (need validation) or granting privileges to an existing user (no validation needed). Move validation down into replace_user_table(). And copy into check_change_password().
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ca1763209b9..c6793241f70 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1050,9 +1050,6 @@ static bool fix_lex_user(THD *thd, LEX_USER *user)
return true;
}
- if (validate_password(user))
- return true;
-
if (user->pwtext.length && !user->pwhash.length)
{
size_t scramble_length;
@@ -2747,7 +2744,8 @@ bool check_change_password(THD *thd, LEX_USER *user)
{
LEX_USER *real_user= get_current_user(thd, user);
- if (fix_and_copy_user(real_user, user, thd))
+ if (fix_and_copy_user(real_user, user, thd) ||
+ validate_password(real_user))
return true;
*user= *real_user;
@@ -3461,6 +3459,10 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER &combo,
store_record(table,record[1]); // Save copy for update
}
+ if (!old_row_exists || combo.pwtext.length || combo.pwhash.length)
+ if (validate_password(&combo))
+ goto end;
+
/* Update table columns with new privileges */
Field **tmp_field;