summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-01-25 11:24:42 +0100
committerSergei Golubchik <sergii@pisem.net>2013-01-25 11:24:42 +0100
commit672b293860318b290374757f9b6a7f90b8942570 (patch)
tree6e1b4784e1d01890a1f9c5e3b88fe54ee773ba6b /mysql-test
parent32151409c13ddc09ebda7cd02fdfe40db290503e (diff)
parentde10e214115ecc89087386ecad8bddee2a1e1608 (diff)
downloadmariadb-git-672b293860318b290374757f9b6a7f90b8942570.tar.gz
5.3 merge
client/mysqltest.cc: make --error to work for --change_user errors
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/change_user_notembedded.result5
-rw-r--r--mysql-test/r/failed_auth_3909.result21
-rw-r--r--mysql-test/r/mysqltest.result6
-rw-r--r--mysql-test/t/change_user_notembedded.test24
-rw-r--r--mysql-test/t/failed_auth_3909.test37
5 files changed, 90 insertions, 3 deletions
diff --git a/mysql-test/r/change_user_notembedded.result b/mysql-test/r/change_user_notembedded.result
new file mode 100644
index 00000000000..60579d15ec2
--- /dev/null
+++ b/mysql-test/r/change_user_notembedded.result
@@ -0,0 +1,5 @@
+ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
+ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO)
+ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
+ERROR 08S01: Unknown command
+ERROR 08S01: Unknown command
diff --git a/mysql-test/r/failed_auth_3909.result b/mysql-test/r/failed_auth_3909.result
new file mode 100644
index 00000000000..0a757e2cee2
--- /dev/null
+++ b/mysql-test/r/failed_auth_3909.result
@@ -0,0 +1,21 @@
+optimize table mysql.user;
+Table Op Msg_type Msg_text
+mysql.user optimize status OK
+insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
+Warnings:
+Warning 1364 Field 'ssl_cipher' doesn't have a default value
+Warning 1364 Field 'x509_issuer' doesn't have a default value
+Warning 1364 Field 'x509_subject' doesn't have a default value
+Warning 1364 Field 'authentication_string' doesn't have a default value
+flush privileges;
+connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
+ERROR HY000: Plugin 'bar' is not loaded
+connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
+connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
+ERROR HY000: Plugin 'bar' is not loaded
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
+delete from mysql.user where plugin = 'bar';
+flush privileges;
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index fdb3029059f..a3043aed711 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -935,9 +935,9 @@ a int(11) YES NULL
b varchar(255) YES NULL
c datetime YES NULL
drop table t1;
-mysqltest: At line 1: change user failed: Unknown database 'inexistent'
-mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
-mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
+mysqltest: At line 1: query 'change_user root,,inexistent' failed: 1049: Unknown database 'inexistent'
+mysqltest: At line 1: query 'change_user inexistent,,test' failed: 1045: Access denied for user 'inexistent'@'localhost' (using password: NO)
+mysqltest: At line 1: query 'change_user root,inexistent,test' failed: 1045: Access denied for user 'root'@'localhost' (using password: YES)
REPLACED_FILE1.txt
file1.txt
file2.txt
diff --git a/mysql-test/t/change_user_notembedded.test b/mysql-test/t/change_user_notembedded.test
new file mode 100644
index 00000000000..bf5d1956cd5
--- /dev/null
+++ b/mysql-test/t/change_user_notembedded.test
@@ -0,0 +1,24 @@
+source include/not_embedded.inc;
+
+#
+# MDEV-3915 COM_CHANGE_USER allows fast password brute-forcing
+#
+# only three failed change_user per connection.
+# successful change_user do NOT reset the counter
+#
+connect (test,localhost,root,,);
+connection test;
+--error 1045
+change_user foo,bar;
+--error 1045
+change_user foo;
+change_user;
+--error 1045
+change_user foo,bar;
+--error 1047
+change_user foo,bar;
+--error 1047
+change_user;
+disconnect test;
+connection default;
+
diff --git a/mysql-test/t/failed_auth_3909.test b/mysql-test/t/failed_auth_3909.test
new file mode 100644
index 00000000000..3179794d155
--- /dev/null
+++ b/mysql-test/t/failed_auth_3909.test
@@ -0,0 +1,37 @@
+source include/not_embedded.inc;
+
+#
+# MDEV-3909 remote user enumeration
+#
+# verify that for some failed login attemps (with wrong user names)
+# the server requests a plugin
+#
+optimize table mysql.user;
+insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
+flush privileges;
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_PLUGIN_IS_NOT_LOADED
+connect (fail,localhost,u1);
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (fail,localhost,u2);
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (fail,localhost,u2,password);
+
+--error ER_PLUGIN_IS_NOT_LOADED
+change_user u1;
+
+--error ER_ACCESS_DENIED_ERROR
+change_user u2;
+
+--error ER_ACCESS_DENIED_ERROR
+change_user u2,password;
+
+delete from mysql.user where plugin = 'bar';
+flush privileges;
+
+