Commit 7b8f4c6d authored by unknown's avatar unknown

BUG#9455 mysqladmin status crash the server

 - Send error to client when mysql_change_db fails.


sql/sql_db.cc:
  Added a note to comment for mysql_change_db that it will not send any error to the client.
sql/sql_parse.cc:
  Call net_send_error(thd) if mysql_change_db fails.
  Remove comments claiming that mysql_change_db sends error the the client.
parent 5630f073
...@@ -1009,6 +1009,9 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, ...@@ -1009,6 +1009,9 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp,
replication slave SQL thread (for that thread, setting of thd->db is done replication slave SQL thread (for that thread, setting of thd->db is done
in ::exec_event() methods of log_event.cc). in ::exec_event() methods of log_event.cc).
This function does not send the error message to the client, if that
should be sent to the client, call net_send_error after this function
RETURN VALUES RETURN VALUES
0 ok 0 ok
1 error 1 error
......
...@@ -260,13 +260,15 @@ int check_user(THD *thd, enum enum_server_command command, ...@@ -260,13 +260,15 @@ int check_user(THD *thd, enum enum_server_command command,
#ifdef NO_EMBEDDED_ACCESS_CHECKS #ifdef NO_EMBEDDED_ACCESS_CHECKS
thd->master_access= GLOBAL_ACLS; // Full rights thd->master_access= GLOBAL_ACLS; // Full rights
/* Change database if necessary: OK or FAIL is sent in mysql_change_db */ /* Change database if necessary */
if (db && db[0]) if (db && db[0])
{ {
thd->db= 0; thd->db= 0;
thd->db_length= 0; thd->db_length= 0;
if (mysql_change_db(thd, db)) if (mysql_change_db(thd, db))
{ {
/* Send the error to the client */
net_send_error(thd);
if (thd->user_connect) if (thd->user_connect)
decrease_user_connections(thd->user_connect); decrease_user_connections(thd->user_connect);
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -395,11 +397,13 @@ int check_user(THD *thd, enum enum_server_command command, ...@@ -395,11 +397,13 @@ int check_user(THD *thd, enum enum_server_command command,
check_for_max_user_connections(thd, thd->user_connect)) check_for_max_user_connections(thd, thd->user_connect))
DBUG_RETURN(-1); DBUG_RETURN(-1);
/* Change database if necessary: OK or FAIL is sent in mysql_change_db */ /* Change database if necessary */
if (db && db[0]) if (db && db[0])
{ {
if (mysql_change_db(thd, db)) if (mysql_change_db(thd, db))
{ {
/* Send error to the client */
net_send_error(thd);
if (thd->user_connect) if (thd->user_connect)
decrease_user_connections(thd->user_connect); decrease_user_connections(thd->user_connect);
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment