summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
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 /sql/sql_parse.cc
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 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 255d03e69dd..6ea0dcbeb8e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -976,7 +976,18 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->security_ctx->user= 0;
thd->user_connect= 0;
- rc= acl_authenticate(thd, 0, packet_length);
+ /*
+ to limit COM_CHANGE_USER ability to brute-force passwords,
+ we only allow three unsuccessful COM_CHANGE_USER per connection.
+ */
+ if (thd->failed_com_change_user >= 3)
+ {
+ my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ rc= 1;
+ }
+ else
+ rc= acl_authenticate(thd, 0, packet_length);
+
MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER(thd);
if (rc)
{
@@ -991,6 +1002,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->variables.collation_connection= save_collation_connection;
thd->variables.character_set_results= save_character_set_results;
thd->update_charset();
+ thd->failed_com_change_user++;
+ my_sleep(1000000);
}
else
{