summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <kaa@kaamos.(none)>2008-03-12 11:19:46 +0300
committerunknown <kaa@kaamos.(none)>2008-03-12 11:19:46 +0300
commitd6df18dd3304ef13eaa5f3545cd12575ebbfc33a (patch)
treef84e4ada799bf37a3d9ef074064f8a17f408aa89 /sql/sql_acl.cc
parent6c2420ed3c0e074fc3b7f47ce00e7ce220906e2c (diff)
parenta5e775b4d657b9521f60b06cf8f19a9a1741c668 (diff)
downloadmariadb-git-d6df18dd3304ef13eaa5f3545cd12575ebbfc33a.tar.gz
Merge kaamos.(none):/data/src/mysql-5.1
into kaamos.(none):/data/src/opt/mysql-5.1-opt client/mysql.cc: Auto merged client/mysqldump.c: Auto merged configure.in: Auto merged include/my_global.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/include/mix1.inc: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/disabled.def: Auto merged sql/filesort.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_sum.cc: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/ndb/src/kernel/blocks/backup/Backup.hpp: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/func_time.result: Manual merge. mysql-test/r/view.result: Manual merge. mysql-test/t/view.test: Manual merge. scripts/mysql_config.sh: Manual merge. sql-common/client.c: Manual merge. sql/sql_parse.cc: Manual merge.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 3805d9fa8b6..9d38efb6464 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -192,7 +192,7 @@ static void update_hostname(acl_host_and_ip *host, const char *hostname);
static bool compare_hostname(const acl_host_and_ip *host,const char *hostname,
const char *ip);
static my_bool acl_load(THD *thd, TABLE_LIST *tables);
-static my_bool grant_load(TABLE_LIST *tables);
+static my_bool grant_load(THD *thd, TABLE_LIST *tables);
/*
Convert scrambled password to binary form, according to scramble type,
@@ -314,8 +314,11 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
char tmp_name[NAME_LEN+1];
int password_length;
+ ulong old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("acl_load");
+ thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+
grant_version++; /* Privileges updated */
acl_cache->clear(1); // Clear locked hostname cache
@@ -622,6 +625,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
return_val=0;
end:
+ thd->variables.sql_mode= old_sql_mode;
DBUG_RETURN(return_val);
}
@@ -801,7 +805,9 @@ static ulong get_sort(uint count,...)
{
for (; *str ; str++)
{
- if (*str == wild_many || *str == wild_one || *str == wild_prefix)
+ if (*str == wild_prefix && str[1])
+ str++;
+ else if (*str == wild_many || *str == wild_one)
{
wild_pos= (uint) (str - start) + 1;
break;
@@ -3618,7 +3624,7 @@ end_unlock:
@retval TRUE Error
*/
-static my_bool grant_load(TABLE_LIST *tables)
+static my_bool grant_load(THD *thd, TABLE_LIST *tables)
{
MEM_ROOT *memex_ptr;
my_bool return_val= 1;
@@ -3626,7 +3632,11 @@ static my_bool grant_load(TABLE_LIST *tables)
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
MEM_ROOT **save_mem_root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,
THR_MALLOC);
+ ulong old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("grant_load");
+
+ thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
+
(void) hash_init(&column_priv_hash,system_charset_info,
0,0,0, (hash_get_key) get_grant_table,
(hash_free_key) free_grant_table,0);
@@ -3678,6 +3688,7 @@ static my_bool grant_load(TABLE_LIST *tables)
return_val=0; // Return ok
end_unlock:
+ thd->variables.sql_mode= old_sql_mode;
t_table->file->ha_index_end();
my_pthread_setspecific_ptr(THR_MALLOC, save_mem_root_ptr);
DBUG_RETURN(return_val);
@@ -3791,7 +3802,7 @@ my_bool grant_reload(THD *thd)
old_mem= memex;
init_sql_alloc(&memex, ACL_ALLOC_BLOCK_SIZE, 0);
- if ((return_val= grant_load(tables)))
+ if ((return_val= grant_load(thd, tables)))
{ // Error. Revert to old hash
DBUG_PRINT("error",("Reverting to old privileges"));
grant_free(); /* purecov: deadcode */