Skip to content

Commit

Permalink
MDEV-9346 - The federatedx and spider engine make mysqld crash when t…
Browse files Browse the repository at this point in the history
…hey are

            configured withtout username

Federated/spider/connect engines or replication threads connecting to other host
with empty user name may crash mysqld.

This is addition to original patch, which adds a test case and amends a macro.
  • Loading branch information
Sergey Vojtovich committed Feb 16, 2016
1 parent 9b73e88 commit e8085d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions mysql-test/suite/federated/federatedx.result
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,12 @@ DROP TABLE federated.t1;
End of 5.1 tests
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
#
# MDEV-9346 - The federatedx and spider engine make mysqld crash when
# they are configured withtout username
#
CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:SLAVE_PORT/federated/t1';
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: '' hostname: '127.0.0.1'
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
Expand Down
9 changes: 9 additions & 0 deletions mysql-test/suite/federated/federatedx.test
Original file line number Diff line number Diff line change
Expand Up @@ -2000,4 +2000,13 @@ SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;

connection default;

--echo #
--echo # MDEV-9346 - The federatedx and spider engine make mysqld crash when
--echo # they are configured withtout username
--echo #
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
--error ER_CANT_CREATE_FEDERATED_TABLE
eval CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:$SLAVE_MYPORT/federated/t1';

source include/federated_cleanup.inc;
2 changes: 1 addition & 1 deletion sql/client_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \
CLIENT_CONNECT_ATTRS)

#define read_user_name(A) {strmov(A,"");}
#define read_user_name(A) A[0]= 0
#undef _CUSTOMCONFIG_

#define mysql_server_init(a,b,c) mysql_client_plugin_init()
Expand Down

0 comments on commit e8085d1

Please sign in to comment.