Skip to content

Commit 60a62f6

Browse files
committed
merge of bug #12818542 mysql-5.5-security->mysql-trunk-security
2 parents 9c78814 + 9226cfe commit 60a62f6

File tree

3 files changed

+57
-6
lines changed

3 files changed

+57
-6
lines changed

mysql-test/r/plugin_auth.result

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
4545
## test correct default plugin
4646
select USER(),CURRENT_USER();
4747
USER() CURRENT_USER()
48-
plug@localhost plug@%
48+
plug@localhost plug_dest@%
4949
## test no_auto_create_user sql mode with plugin users
5050
SET @@sql_mode=no_auto_create_user;
5151
GRANT INSERT ON TEST.* TO grant_user IDENTIFIED WITH 'test_plugin_server';
@@ -471,4 +471,24 @@ DROP USER bug12610784@localhost;
471471
ERROR 1045 (28000): Access denied for user 'unknown'@'localhost' (using password: YES)
472472
# shoud contain "using password=no"
473473
ERROR 1045 (28000): Access denied for user 'unknown'@'localhost' (using password: NO)
474+
#
475+
# Bug #12818542: PAM: ADDING PASSWORD FOR AN ACCOUNT DISABLES PAM
476+
# AUTHENTICATION SETTINGS
477+
#
478+
CREATE USER bug12818542@localhost
479+
IDENTIFIED WITH 'test_plugin_server' AS 'bug12818542_dest';
480+
CREATE USER bug12818542_dest@localhost
481+
IDENTIFIED BY 'bug12818542_dest_passwd';
482+
GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost;
483+
SELECT USER(),CURRENT_USER();
484+
USER() CURRENT_USER()
485+
bug12818542@localhost bug12818542_dest@localhost
486+
SET PASSWORD = PASSWORD('bruhaha');
487+
Warnings:
488+
Note 1699 SET PASSWORD has no significance for users authenticating via plugins
489+
SELECT USER(),CURRENT_USER();
490+
USER() CURRENT_USER()
491+
bug12818542@localhost bug12818542_dest@localhost
492+
DROP USER bug12818542@localhost;
493+
DROP USER bug12818542_dest@localhost;
474494
End of 5.5 tests

mysql-test/t/plugin_auth.test

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,4 +543,35 @@ DROP USER bug12610784@localhost;
543543
--exec $MYSQL -uunknown 2>&1
544544

545545

546+
--echo #
547+
--echo # Bug #12818542: PAM: ADDING PASSWORD FOR AN ACCOUNT DISABLES PAM
548+
--echo # AUTHENTICATION SETTINGS
549+
--echo #
550+
551+
CREATE USER bug12818542@localhost
552+
IDENTIFIED WITH 'test_plugin_server' AS 'bug12818542_dest';
553+
CREATE USER bug12818542_dest@localhost
554+
IDENTIFIED BY 'bug12818542_dest_passwd';
555+
GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost;
556+
557+
connect(bug12818542_con,localhost,bug12818542,bug12818542_dest);
558+
connection bug12818542_con;
559+
SELECT USER(),CURRENT_USER();
560+
561+
SET PASSWORD = PASSWORD('bruhaha');
562+
563+
connection default;
564+
disconnect bug12818542_con;
565+
566+
connect(bug12818542_con2,localhost,bug12818542,bug12818542_dest);
567+
connection bug12818542_con2;
568+
SELECT USER(),CURRENT_USER();
569+
570+
connection default;
571+
disconnect bug12818542_con2;
572+
573+
DROP USER bug12818542@localhost;
574+
DROP USER bug12818542_dest@localhost;
575+
576+
546577
--echo End of 5.5 tests

sql/sql_acl.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,17 +1881,17 @@ bool change_password(THD *thd, const char *host, const char *user,
18811881
goto end;
18821882
}
18831883

1884+
/* update loaded acl entry: */
1885+
set_user_salt(acl_user, new_password, new_password_len);
1886+
18841887
if (my_strcasecmp(system_charset_info, acl_user->plugin.str,
18851888
native_password_plugin_name.str) &&
18861889
my_strcasecmp(system_charset_info, acl_user->plugin.str,
18871890
old_password_plugin_name.str))
1888-
{
18891891
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
18901892
ER_SET_PASSWORD_AUTH_PLUGIN, ER(ER_SET_PASSWORD_AUTH_PLUGIN));
1891-
}
1892-
/* update loaded acl entry: */
1893-
set_user_salt(acl_user, new_password, new_password_len);
1894-
set_user_plugin(acl_user, new_password_len);
1893+
else
1894+
set_user_plugin(acl_user, new_password_len);
18951895

18961896
if (update_user_table(thd, table,
18971897
acl_user->host.hostname ? acl_user->host.hostname : "",

0 commit comments

Comments
 (0)