summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authorunknown <davi@endora.local>2007-11-01 20:44:09 -0200
committerunknown <davi@endora.local>2007-11-01 20:44:09 -0200
commit0e675d81aea6e9cfd95564189fd1fc7e14df0241 (patch)
tree44d296995c186a8a6852b549acd04c05eb98c7ce /sql/sql_connect.cc
parent6dd04c22a695d5548045d9eda451af2cc016f7fb (diff)
parent8f0df2efe85ae6d241ed045a4100d207ddb4ed1c (diff)
downloadmariadb-git-0e675d81aea6e9cfd95564189fd1fc7e14df0241.tar.gz
Merge endora.local:/Users/davi/mysql/bugs/31850-5.1
into endora.local:/Users/davi/mysql/mysql-5.1-runtime sql/sql_connect.cc: Auto merged sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc23
1 files changed, 9 insertions, 14 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 90df233896a..68872f85cd4 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -317,17 +317,20 @@ check_user(THD *thd, enum enum_server_command command,
{
DBUG_ENTER("check_user");
LEX_STRING db_str= { (char *) db, db ? strlen(db) : 0 };
-
+
+ /*
+ Clear thd->db as it points to something, that will be freed when
+ connection is closed. We don't want to accidentally free a wrong
+ pointer if connect failed. Also in case of 'CHANGE USER' failure,
+ current database will be switched to 'no database selected'.
+ */
+ thd->reset_db(NULL, 0);
+
#ifdef NO_EMBEDDED_ACCESS_CHECKS
thd->main_security_ctx.master_access= GLOBAL_ACLS; // Full rights
/* Change database if necessary */
if (db && db[0])
{
- /*
- thd->db is saved in caller and needs to be freed by caller if this
- function returns 0
- */
- thd->reset_db(NULL, 0);
if (mysql_change_db(thd, &db_str, FALSE))
DBUG_RETURN(1);
}
@@ -358,14 +361,6 @@ check_user(THD *thd, enum enum_server_command command,
DBUG_RETURN(1);
}
- /*
- Clear thd->db as it points to something, that will be freed when
- connection is closed. We don't want to accidentally free a wrong pointer
- if connect failed. Also in case of 'CHANGE USER' failure, current
- database will be switched to 'no database selected'.
- */
- thd->reset_db(NULL, 0);
-
USER_RESOURCES ur;
int res= acl_getroot(thd, &ur, passwd, passwd_len);
#ifndef EMBEDDED_LIBRARY