mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-22418 mysqladmin wrong error with simple_password_check
mysqladmin's presumption about the cause of an error by looking at the error code was presumptious. Server knows best, so pass the error along. Avoid returning -1 as a exit code, Linux makes this 255 and Windows keeps this as -1.
This commit is contained in:
parent
96ae37abc5
commit
a34b989f0c
3 changed files with 31 additions and 18 deletions
|
@ -431,6 +431,7 @@ int main(int argc,char *argv[])
|
|||
if (error > 0)
|
||||
break;
|
||||
|
||||
error= -error; /* don't exit with negative error codes */
|
||||
/*
|
||||
Command was well-formed, but failed on the server. Might succeed
|
||||
on retry (if conditions on server change etc.), but needs --force
|
||||
|
@ -1203,25 +1204,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||
}
|
||||
else
|
||||
if (mysql_query(mysql,buff))
|
||||
{
|
||||
if (mysql_errno(mysql)!=1290)
|
||||
{
|
||||
my_printf_error(0,"unable to change password; error: '%s'",
|
||||
error_flags, mysql_error(mysql));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
We don't try to execute 'update mysql.user set..'
|
||||
because we can't perfectly find out the host
|
||||
*/
|
||||
my_printf_error(0,"\n"
|
||||
"You cannot use 'password' command as mysqld runs\n"
|
||||
" with grant tables disabled (was started with"
|
||||
" --skip-grant-tables).\n"
|
||||
"Use: \"mysqladmin flush-privileges password '*'\""
|
||||
" instead", error_flags);
|
||||
}
|
||||
ret = -1;
|
||||
}
|
||||
password_done:
|
||||
|
|
|
@ -250,3 +250,13 @@ Grants for foo1@localhost
|
|||
GRANT USAGE ON *.* TO `foo1`@`localhost` IDENTIFIED BY PASSWORD '*1D62FA326F98258451ED56A404F15452423DCC1D'
|
||||
drop user foo1@localhost;
|
||||
uninstall plugin simple_password_check;
|
||||
#
|
||||
# MDEV-22418 mysqladmin wrong error with simple_password_check
|
||||
#
|
||||
install soname "simple_password_check";
|
||||
MARIADB-ADMIN: unable to change password; error: 'The MariaDB server is running with the --strict-password-validation option so it cannot execute this statement'
|
||||
# All done
|
||||
uninstall plugin simple_password_check;
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
|
|
|
@ -150,3 +150,21 @@ flush privileges;
|
|||
show grants for foo1@localhost;
|
||||
drop user foo1@localhost;
|
||||
uninstall plugin simple_password_check;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22418 mysqladmin wrong error with simple_password_check
|
||||
--echo #
|
||||
|
||||
install soname "simple_password_check";
|
||||
|
||||
--replace_regex /.*[\/\\]// /(mysqladmin|mariadb-admin)(\.exe)?/MARIADB-ADMIN/
|
||||
--error 1
|
||||
--exec $MYSQLADMIN -uroot password foo 2>&1
|
||||
|
||||
--echo # All done
|
||||
uninstall plugin simple_password_check;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
||||
|
|
Loading…
Reference in a new issue