summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2012-01-24 01:59:03 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2012-01-24 01:59:03 +0100
commitb7cf6abe521160a9b9a905df3bdfe134f1336d39 (patch)
tree039c60119e2569a7e186def9a924b67478eab429 /sql/sql_connect.cc
parentc492296127b55f35f4dd78ba8829b65d3a5c0740 (diff)
parent19d13a3b17d613c04acbcd8c7a0578a55e0c2938 (diff)
downloadmariadb-git-b7cf6abe521160a9b9a905df3bdfe134f1336d39.tar.gz
merge
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc31
1 files changed, 29 insertions, 2 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 570f869c2a6..4784d44ede7 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1,5 +1,6 @@
/*
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2008-2011 Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -870,7 +871,6 @@ bool init_new_connection_handler_thread()
return 0;
}
-#ifndef EMBEDDED_LIBRARY
/*
Perform handshake, authorize client and update thd ACL variables.
@@ -883,6 +883,7 @@ bool init_new_connection_handler_thread()
1 error
*/
+#ifndef EMBEDDED_LIBRARY
static int check_connection(THD *thd)
{
uint connect_errors= 0;
@@ -1107,7 +1108,33 @@ void prepare_new_connection_state(THD* thd)
thd->killed= KILL_CONNECTION;
thd->print_aborted_warning(0, "init_connect command failed");
sql_print_warning("%s", thd->stmt_da->message());
+
+ /*
+ now let client to send its first command,
+ to be able to send the error back
+ */
+ NET *net= &thd->net;
+ thd->lex->current_select= 0;
+ my_net_set_read_timeout(net, thd->variables.net_wait_timeout);
+ thd->clear_error();
+ net_new_transaction(net);
+ ulong packet_length= my_net_read(net);
+ /*
+ If my_net_read() failed, my_error() has been already called,
+ and the main Diagnostics Area contains an error condition.
+ */
+ if (packet_length != packet_error)
+ my_error(ER_NEW_ABORTING_CONNECTION, MYF(0),
+ thd->thread_id,
+ thd->db ? thd->db : "unconnected",
+ sctx->user ? sctx->user : "unauthenticated",
+ sctx->host_or_ip, "init_connect command failed");
+ thd->server_status&= ~SERVER_STATUS_CLEAR_SET;
+ thd->protocol->end_statement();
+ thd->killed = KILL_CONNECTION;
+ return;
}
+
thd->proc_info=0;
thd->set_time();
thd->init_for_queries();