Skip to content

Commit ae36893

Browse files
Bharathy Satishbjornmu
authored andcommitted
Bug #20537246 SERVER CRASH WHILE CONNECTING WITH CLEARTEXT-PLUGIN USER
WITH BLANK PWD When user is created with blank password, NULL value gets stored in authentication_string column of mysql.user. When we do flush privileges this NULL value gets loaded into acl_user.auth_string. Thus during authentication there is a strcmp for external plugins (like cleartext password, authentication_pam) for auth_string which causes segmentation fault. Fix is to set the auth_string to empty string when there is a NULL value in authentication_string column of mysql.user table. (cherry picked from commit 7fe41b58ef86059b737f42d1c1960aa5958d8f01)
1 parent 3f13631 commit ae36893

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

mysql-test/r/plugin_auth.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,3 +567,14 @@ employee@localhost
567567
user()
568568
empl_external@localhost
569569
DROP USER 'empl_external'@'localhost', 'employee'@'localhost';
570+
#
571+
# Bug #20537246: SERVER CRASH WHILE CONNECTING WITH CLEARTEXT-PLUGIN
572+
# USER WITH BLANK PWD
573+
#
574+
CREATE USER bug20537246@localhost
575+
IDENTIFIED WITH 'cleartext_plugin_server' AS '';
576+
## test connection
577+
select USER(),CURRENT_USER();
578+
USER() CURRENT_USER()
579+
bug20537246@localhost bug20537246@localhost
580+
DROP USER bug20537246@localhost;

mysql-test/t/plugin_auth.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,3 +647,20 @@ ALTER USER employee@localhost PASSWORD EXPIRE;
647647
DROP USER 'empl_external'@'localhost', 'employee'@'localhost';
648648

649649
--source include/mysql_upgrade_cleanup.inc
650+
651+
--echo #
652+
--echo # Bug #20537246: SERVER CRASH WHILE CONNECTING WITH CLEARTEXT-PLUGIN
653+
--echo # USER WITH BLANK PWD
654+
--echo #
655+
656+
CREATE USER bug20537246@localhost
657+
IDENTIFIED WITH 'cleartext_plugin_server' AS '';
658+
659+
--echo ## test connection
660+
connect(cleartext_con,localhost,bug20537246,,,,,CLEARTEXT);
661+
select USER(),CURRENT_USER();
662+
663+
connection default;
664+
disconnect cleartext_con;
665+
DROP USER bug20537246@localhost;
666+

sql/auth/sql_auth_cache.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,6 +1410,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
14101410
}
14111411
if(user.auth_string.str)
14121412
user.auth_string.length= strlen(user.auth_string.str);
1413+
else
1414+
user.auth_string= EMPTY_STR;
14131415

14141416
{
14151417
uint next_field;

0 commit comments

Comments
 (0)