Commit a34b989f authored by Daniel Black's avatar Daniel Black

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.
parent 96ae37ab
......@@ -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
......@@ -1204,24 +1205,8 @@ 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);
}
my_printf_error(0,"unable to change password; error: '%s'",
error_flags, mysql_error(mysql));
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 #
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment