summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2003-08-02 03:27:13 -0700
committerigor@rurik.mysql.com <>2003-08-02 03:27:13 -0700
commitf7adcbff7b0b1fce52b72ed20728b5137c727467 (patch)
tree9b362c3da6dc4320729d7341e21320842d5add96 /sql/sql_parse.cc
parentc5da91127079f8b6bce459ffef6e4e398d355e60 (diff)
parent9c58e2a5c7460e56648e7e4a481cc559040c49c4 (diff)
downloadmariadb-git-f7adcbff7b0b1fce52b72ed20728b5137c727467.tar.gz
Merge rurik.mysql.com:/home/igor/mysql-4.1
into rurik.mysql.com:/home/igor/dev/mysql-4.1-0
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index abf809c0c5e..76d1c512848 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -549,6 +549,7 @@ check_connections(THD *thd)
char *end, *user, *passwd, *db;
char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */
ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */
+ String convdb;
DBUG_PRINT("info",("New connection received on %s",
vio_description(net->vio)));
@@ -724,7 +725,12 @@ check_connections(THD *thd)
db=0;
using_password= test(passwd[0]);
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
+ {
db=strend(passwd)+1;
+ convdb.copy(db, strlen(db),
+ thd->variables.character_set_client, system_charset_info);
+ db= convdb.c_ptr();
+ }
/* We can get only old hash at this point */
if (using_password && strlen(passwd) != SCRAMBLE_LENGTH)
@@ -1125,10 +1131,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->lex.select_lex.options=0; // We store status here
switch (command) {
case COM_INIT_DB:
- statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status);
- if (!mysql_change_db(thd,packet))
- mysql_log.write(thd,command,"%s",thd->db);
- break;
+ {
+ String convname;
+ statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status);
+ convname.copy(packet, strlen(packet),
+ thd->variables.character_set_client, system_charset_info);
+ if (!mysql_change_db(thd,convname.c_ptr()))
+ mysql_log.write(thd,command,"%s",thd->db);
+ break;
+ }
#ifndef EMBEDDED_LIBRARY
case COM_REGISTER_SLAVE:
{
@@ -3262,7 +3273,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
if (!(thd->master_access & SELECT_ACL) &&
(db && (!thd->db || strcmp(db,thd->db))))
db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
- thd->priv_user, db); /* purecov: inspected */
+ thd->priv_user, db, test(want_access & GRANT_ACL));
*save_priv=thd->master_access | db_access;
DBUG_RETURN(FALSE);
}
@@ -3282,7 +3293,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
if (db && (!thd->db || strcmp(db,thd->db)))
db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
- thd->priv_user, db); /* purecov: inspected */
+ thd->priv_user, db, test(want_access & GRANT_ACL));
else
db_access=thd->db_access;
// Remove SHOW attribute and access rights we already have
@@ -3558,6 +3569,7 @@ mysql_new_select(LEX *lex, bool move_down)
unit->link_prev= 0;
unit->return_to= lex->current_select;
select_lex->include_down(unit);
+ // TODO: assign resolve_mode for fake subquery after merging with new tree
}
else
select_lex->include_neighbour(lex->current_select);
@@ -3565,6 +3577,7 @@ mysql_new_select(LEX *lex, bool move_down)
select_lex->master_unit()->global_parameters= select_lex;
select_lex->include_global((st_select_lex_node**)&lex->all_selects_list);
lex->current_select= select_lex;
+ select_lex->resolve_mode= SELECT_LEX::SELECT_MODE;
return 0;
}