summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2002-08-30 12:40:40 +0300
committerunknown <monty@narttu.mysql.fi>2002-08-30 12:40:40 +0300
commit9421f1dae99e0f2d6100b31a3641b2cd0ad68e58 (patch)
tree1bb81fd601075133af9ee99bd7ac94baf5ffc46c /sql/sql_acl.cc
parentcfc861537da2f256f11823b3a4997a033eec73dc (diff)
parent1895448e66b39542d58a77e705449b92414ff3f7 (diff)
downloadmariadb-git-9421f1dae99e0f2d6100b31a3641b2cd0ad68e58.tar.gz
Merge with 4.0.3
Some simple optimzations, more comments and indentation changes. Add ` around database in 'use database' in binary log. Moved max_error_count and max_warning_count to variables struct. Removed SHOW_WARNS_COUNT and SHOW_ERRORS_COUNT calls. Changed string functions to use character set of first string argument as default return characterset (Each string function can change the above assumption if needed) BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BUILD/SETUP.sh: Auto merged BitKeeper/deleted/.del-getopt.h~a9ae679fa84f395: Auto merged BitKeeper/deleted/.del-getvar.c~2a29ff383970fd31: Auto merged Docs/manual.texi: Auto merged SSL/cacert.pem: Auto merged SSL/client-cert.pem: Auto merged SSL/client-key.pem: Auto merged SSL/server-cert.pem: Auto merged SSL/server-key.pem: Auto merged client/mysqldump.c: Auto merged include/my_base.h: Auto merged include/my_sys.h: Auto merged include/mysql_com.h: Auto merged isam/isamlog.c: Auto merged isam/pack_isam.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/ft_dump.c: Auto merged myisam/ft_parser.c: Auto merged myisam/ft_static.c: Auto merged myisam/ft_test1.c: Auto merged myisam/ft_update.c: Auto merged myisam/mi_create.c: Auto merged myisam/mi_key.c: Auto merged myisam/mi_open.c: Auto merged myisam/mi_static.c: Auto merged myisam/mi_test1.c: Auto merged myisam/mi_test2.c: Auto merged myisam/mi_test3.c: Auto merged myisam/mi_update.c: Auto merged myisam/mi_write.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged myisam/myisamlog.c: Auto merged myisam/myisampack.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_math.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/myisam.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/select_found.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/myisam.test: Auto merged mysql-test/t/select_found.test: Auto merged mysql-test/t/union.test: Auto merged mysys/default.c: Auto merged mysys/mf_iocache2.c: Auto merged mysys/my_error.c: Auto merged mysys/my_init.c: Auto merged scripts/mysql_config.sh: Auto merged sql/convert.cc: Auto merged sql/filesort.cc: Auto merged sql/gen_lex_hash.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/hostname.cc: Auto merged sql/item.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/item_timefunc.h: Auto merged sql/key.cc: Auto merged sql/log.cc: Auto merged sql/net_pkg.cc: Auto merged sql/opt_range.cc: Auto merged sql/opt_range.h: Auto merged sql/opt_sum.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/slave.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_db.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_test.cc: Auto merged sql/time.cc: Auto merged sql/unireg.cc: Auto merged strings/Makefile.am: Auto merged strings/ctype-latin1_de.c: Auto merged strings/ctype-tis620.c: Auto merged tools/mysqlmanager.c: Auto merged BitKeeper/deleted/.del-sslopt-case.h~224c80e75dad4997: merge with 4.0.3 BitKeeper/triggers/post-commit: merge with 4.0.3 client/mysql.cc: merge with 4.0.3 + simple optimsation client/mysqltest.c: merge with 4.0.3 (Indentation change) configure.in: merge with 4.0.3 extra/resolve_stack_dump.c: merge with 4.0.3 (Indentation change) include/Makefile.am: merge with 4.0.3 include/myisam.h: merge with 4.0.3 (Indentation change) include/mysql.h: merge with 4.0.3 (removed not used structure) include/mysqld_error.h: merge with 4.0.3 libmysql/Makefile.shared: merge with 4.0.3 libmysql/libmysql.c: merge with 4.0.3 (Indentation change) libmysqld/Makefile.am: merge with 4.0.3 myisam/ft_boolean_search.c: merge with 4.0.3 (Indentation change) myisam/ft_nlq_search.c: merge with 4.0.3 (Indentation change) myisam/mi_check.c: merge with 4.0.3 myisam/mi_search.c: merge with 4.0.3 myisam/mi_unique.c: merge with 4.0.3 mysys/Makefile.am: merge with 4.0.3 mysys/mf_casecnv.c: merge with 4.0.3 sql-bench/server-cfg.sh: Removed 8000 max row limit for Innodb sql/Makefile.am: merge with 4.0.3 sql/field.cc: Indentation cleanup Changed sprintf -> my_sprintf sql/field.h: merge with 4.0.3 sql/ha_heap.cc: merge with 4.0.3 (Indentation change) sql/item.h: merge with 4.0.3 (Indentation change) sql/item_cmpfunc.cc: merge with 4.0.3 sql/item_cmpfunc.h: Removed size_of() from items Indentation cleanup sql/item_create.cc: merge sql/item_create.h: merge sql/item_func.cc: Added comments Changed string functions to use character set of first string argument as default return characterset Simple optimizations. Removed return of uninitalized variable. sql/item_func.h: merge sql/item_strfunc.cc: merge with 4.0.3 (Indentation change) sql/item_strfunc.h: removed size_of() sql/item_uniq.h: removed size_of() sql/lex.h: merge with 4.0.3 (Indentation change) sql/log_event.cc: Add ` around database in 'use database' in binary log. sql/mysql_priv.h: merge with 4.0.3 sql/mysqld.cc: merge with 4.0.3 (Indentation change) sql/share/czech/errmsg.txt: merge sql/share/danish/errmsg.txt: merge sql/share/dutch/errmsg.txt: merge sql/share/english/errmsg.txt: merge sql/share/estonian/errmsg.txt: merge sql/share/french/errmsg.txt: merge sql/share/german/errmsg.txt: merge sql/share/greek/errmsg.txt: merge sql/share/hungarian/errmsg.txt: merge sql/share/italian/errmsg.txt: merge sql/share/japanese/errmsg.txt: merge sql/share/korean/errmsg.txt: merge sql/share/norwegian-ny/errmsg.txt: merge sql/share/norwegian/errmsg.txt: merge sql/share/polish/errmsg.txt: merge sql/share/portuguese/errmsg.txt: merge sql/share/romanian/errmsg.txt: merge sql/share/russian/errmsg.txt: merge sql/share/slovak/errmsg.txt: merge sql/share/spanish/errmsg.txt: merge sql/share/swedish/errmsg.txt: merge sql/share/ukrainian/errmsg.txt: merge sql/sql_acl.cc: merge with 4.0.3 sql/sql_base.cc: More comments Fixed bug in send_fields() when using convert sql/sql_class.cc: merge sql/sql_class.h: Merge with 4.0.3 Moved max_error_count and max_warning_count to variables struct. sql/sql_delete.cc: merge with 4.0.3 (Indentation change) sql/sql_lex.h: merge with 4.0.3 sql/sql_parse.cc: Removed SHOW_WARNS_COUNT and SHOW_ERRORS_COUNT. (Should be retrived from variables) sql/sql_select.cc: merge with 4.0.3 sql/sql_show.cc: merge with 4.0.3 sql/sql_union.cc: merge with 4.0.3 sql/sql_update.cc: merge with 4.0.3 sql/sql_yacc.yy: merge with 4.0.3 Indentation cleanup sql/structs.h: merge with 4.0.3 sql/table.cc: merge with 4.0.3 sql/table.h: merge with 4.0.3
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc158
1 files changed, 84 insertions, 74 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 5e32da07aad..1069e779e86 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -429,7 +429,7 @@ static ulong get_access(TABLE *form, uint fieldnr)
{
ulong access_bits=0,bit;
char buff[2];
- String res(buff,sizeof(buff));
+ String res(buff,sizeof(buff),default_charset_info);
Field **pos;
for (pos=form->field+fieldnr, bit=1;
@@ -438,7 +438,7 @@ static ulong get_access(TABLE *form, uint fieldnr)
pos++ , bit<<=1)
{
(*pos)->val_str(&res,&res);
- if (toupper(res[0]) == 'Y')
+ if (my_toupper(system_charset_info, res[0]) == 'Y')
access_bits|= bit;
}
return access_bits;
@@ -789,7 +789,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip,
end=strmov((tmp_db=strmov(key+sizeof(struct in_addr),user)+1),db);
if (lower_case_table_names)
{
- casedn_str(tmp_db);
+ my_casedn_str(system_charset_info, tmp_db);
db=tmp_db;
}
key_length=(uint) (end-key);
@@ -853,7 +853,7 @@ exit:
}
-int wild_case_compare(const char *str,const char *wildstr)
+int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr)
{
reg3 int flag;
DBUG_ENTER("wild_case_compare");
@@ -864,7 +864,8 @@ int wild_case_compare(const char *str,const char *wildstr)
{
if (*wildstr == wild_prefix && wildstr[1])
wildstr++;
- if (toupper(*wildstr++) != toupper(*str++)) DBUG_RETURN(1);
+ if (my_toupper(cs, *wildstr++) !=
+ my_toupper(cs, *str++)) DBUG_RETURN(1);
}
if (! *wildstr ) DBUG_RETURN (*str != 0);
if (*wildstr++ == wild_one)
@@ -882,12 +883,12 @@ int wild_case_compare(const char *str,const char *wildstr)
char cmp;
if ((cmp= *wildstr) == wild_prefix && wildstr[1])
cmp=wildstr[1];
- cmp=toupper(cmp);
- while (*str && toupper(*str) != cmp)
+ cmp=my_toupper(cs, cmp);
+ while (*str && my_toupper(cs, *str) != cmp)
str++;
if (!*str) DBUG_RETURN (1);
}
- if (wild_case_compare(str,wildstr) == 0) DBUG_RETURN (0);
+ if (wild_case_compare(cs, str,wildstr) == 0) DBUG_RETURN (0);
} while (*str++);
DBUG_RETURN(1);
}
@@ -906,7 +907,7 @@ static void init_check_host(void)
DBUG_ENTER("init_check_host");
VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip),
acl_users.elements,1));
- VOID(hash_init(&acl_check_hosts,acl_users.elements,0,0,
+ VOID(hash_init(&acl_check_hosts,system_charset_info,acl_users.elements,0,0,
(hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE));
if (!allow_all_hosts)
{
@@ -922,7 +923,8 @@ static void init_check_host(void)
{ // Check if host already exists
acl_host_and_ip *acl=dynamic_element(&acl_wild_hosts,j,
acl_host_and_ip *);
- if (!my_strcasecmp(acl_user->host.hostname,acl->hostname))
+ if (!my_strcasecmp(system_charset_info,
+ acl_user->host.hostname, acl->hostname))
break; // already stored
}
if (j == acl_wild_hosts.elements) // If new
@@ -1000,7 +1002,7 @@ bool check_change_password(THD *thd, const char *host, const char *user)
}
if (!thd->slave_thread &&
(strcmp(thd->user,user) ||
- my_strcasecmp(host,thd->host ? thd->host : thd->ip)))
+ my_strcasecmp(system_charset_info, host,thd->host_or_ip)))
{
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
return(1);
@@ -1145,7 +1147,8 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname,
return (tmp & host->ip_mask) == host->ip;
}
return (!host->hostname ||
- (hostname && !wild_case_compare(hostname,host->hostname)) ||
+ (hostname && !wild_case_compare(system_charset_info,
+ hostname,host->hostname)) ||
(ip && !wild_compare(ip,host->hostname)));
}
@@ -1168,8 +1171,8 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
tables.db=(char*) "mysql";
if (!(table=open_ltable(thd,&tables,TL_WRITE)))
DBUG_RETURN(1); /* purecov: deadcode */
- table->field[0]->store(host,(uint) strlen(host));
- table->field[1]->store(user,(uint) strlen(user));
+ table->field[0]->store(host,(uint) strlen(host), system_charset_info);
+ table->field[1]->store(user,(uint) strlen(user), system_charset_info);
if (table->file->index_read_idx(table->record[0],0,
(byte*) table->field[0]->ptr,0,
@@ -1179,7 +1182,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
DBUG_RETURN(1); /* purecov: deadcode */
}
store_record(table,1);
- table->field[2]->store(new_password,(uint) strlen(new_password));
+ table->field[2]->store(new_password,(uint) strlen(new_password), system_charset_info);
if ((error=table->file->update_row(table->record[1],table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: deadcode */
@@ -1244,8 +1247,8 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
password=combo.password.str;
}
- table->field[0]->store(combo.host.str,combo.host.length);
- table->field[1]->store(combo.user.str,combo.user.length);
+ table->field[0]->store(combo.host.str,combo.host.length, system_charset_info);
+ table->field[1]->store(combo.user.str,combo.user.length, system_charset_info);
table->file->index_init(0);
if (table->file->index_read(table->record[0],
(byte*) table->field[0]->ptr,0,
@@ -1266,17 +1269,17 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
goto end;
}
old_row_exists = 0;
- restore_record(table,2); // cp empty row from record[2]
- table->field[0]->store(combo.host.str,combo.host.length);
- table->field[1]->store(combo.user.str,combo.user.length);
- table->field[2]->store(password,(uint) strlen(password));
+ restore_record(table,2); // cp empty row from record[2]
+ table->field[0]->store(combo.host.str,combo.host.length, system_charset_info);
+ table->field[1]->store(combo.user.str,combo.user.length, system_charset_info);
+ table->field[2]->store(password,(uint) strlen(password), system_charset_info);
}
else
{
old_row_exists = 1;
store_record(table,1); // Save copy for update
if (combo.password.str) // If password given
- table->field[2]->store(password,(uint) strlen(password));
+ table->field[2]->store(password,(uint) strlen(password), system_charset_info);
}
/* Update table columns with new privileges */
@@ -1289,7 +1292,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
tmp_field++, priv <<= 1)
{
if (priv & rights) // set requested privileges
- (*tmp_field)->store(&what,1);
+ (*tmp_field)->store(&what, 1, system_charset_info);
}
rights=get_access(table,3);
DBUG_PRINT("info",("table->fields: %d",table->fields));
@@ -1297,30 +1300,30 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
{
#ifdef HAVE_OPENSSL
/* We write down SSL related ACL stuff */
- table->field[25]->store("",0);
- table->field[26]->store("",0);
- table->field[27]->store("",0);
+ table->field[25]->store("", 0, system_charset_info);
+ table->field[26]->store("", 0, system_charset_info);
+ table->field[27]->store("", 0, system_charset_info);
switch (thd->lex.ssl_type) {
case SSL_TYPE_ANY:
- table->field[24]->store("ANY",3);
+ table->field[24]->store("ANY",3, system_charset_info);
break;
case SSL_TYPE_X509:
- table->field[24]->store("X509",4);
+ table->field[24]->store("X509",4, system_charset_info);
break;
case SSL_TYPE_SPECIFIED:
- table->field[24]->store("SPECIFIED",9);
+ table->field[24]->store("SPECIFIED",9, system_charset_info);
if (thd->lex.ssl_cipher)
table->field[25]->store(thd->lex.ssl_cipher,
- strlen(thd->lex.ssl_cipher));
+ strlen(thd->lex.ssl_cipher), system_charset_info);
if (thd->lex.x509_issuer)
table->field[26]->store(thd->lex.x509_issuer,
- strlen(thd->lex.x509_issuer));
+ strlen(thd->lex.x509_issuer), system_charset_info);
if (thd->lex.x509_subject)
table->field[27]->store(thd->lex.x509_subject,
- strlen(thd->lex.x509_subject));
+ strlen(thd->lex.x509_subject), system_charset_info);
break;
default:
- table->field[24]->store("",0);
+ table->field[24]->store("", 0, system_charset_info);
}
#endif /* HAVE_OPENSSL */
@@ -1409,9 +1412,9 @@ static int replace_db_table(TABLE *table, const char *db,
DBUG_RETURN(-1);
}
- table->field[0]->store(combo.host.str,combo.host.length);
- table->field[1]->store(db,(uint) strlen(db));
- table->field[2]->store(combo.user.str,combo.user.length);
+ table->field[0]->store(combo.host.str,combo.host.length, system_charset_info);
+ table->field[1]->store(db,(uint) strlen(db), system_charset_info);
+ table->field[2]->store(combo.user.str,combo.user.length, system_charset_info);
table->file->index_init(0);
if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,0,
HA_READ_KEY_EXACT))
@@ -1424,9 +1427,9 @@ static int replace_db_table(TABLE *table, const char *db,
}
old_row_exists = 0;
restore_record(table,2); // cp empty row from record[2]
- table->field[0]->store(combo.host.str,combo.host.length);
- table->field[1]->store(db,(uint) strlen(db));
- table->field[2]->store(combo.user.str,combo.user.length);
+ table->field[0]->store(combo.host.str,combo.host.length, system_charset_info);
+ table->field[1]->store(db,(uint) strlen(db), system_charset_info);
+ table->field[2]->store(combo.user.str,combo.user.length, system_charset_info);
}
else
{
@@ -1438,7 +1441,7 @@ static int replace_db_table(TABLE *table, const char *db,
for (i= 3, priv= 1; i < table->fields; i++, priv <<= 1)
{
if (priv & store_rights) // do it if priv is chosen
- table->field [i]->store(&what,1); // set requested privileges
+ table->field [i]->store(&what,1, system_charset_info);// set requested privileges
}
rights=get_access(table,3);
rights=fix_rights_for_db(rights);
@@ -1519,13 +1522,14 @@ public:
tname= strdup_root(&memex,t);
if (lower_case_table_names)
{
- casedn_str(db);
- casedn_str(tname);
+ my_casedn_str(system_charset_info, db);
+ my_casedn_str(system_charset_info, tname);
}
key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3;
hash_key = (char*) alloc_root(&memex,key_length);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
- (void) hash_init(&hash_columns,0,0,0, (hash_get_key) get_key_column,0,
+ (void) hash_init(&hash_columns,system_charset_info,
+ 0,0,0, (hash_get_key) get_key_column,0,
HASH_CASE_INSENSITIVE);
}
@@ -1547,8 +1551,8 @@ public:
}
if (lower_case_table_names)
{
- casedn_str(db);
- casedn_str(tname);
+ my_casedn_str(system_charset_info, db);
+ my_casedn_str(system_charset_info, tname);
}
key_length = ((uint) strlen(db) + (uint) strlen(user) +
(uint) strlen(tname) + 3);
@@ -1559,21 +1563,22 @@ public:
privs = fix_rights_for_table(privs);
cols = fix_rights_for_column(cols);
- (void) hash_init(&hash_columns,0,0,0, (hash_get_key) get_key_column,0,
+ (void) hash_init(&hash_columns,system_charset_info,
+ 0,0,0, (hash_get_key) get_key_column,0,
HASH_CASE_INSENSITIVE);
if (cols)
{
int key_len;
- col_privs->field[0]->store(host,(uint) strlen(host));
- col_privs->field[1]->store(db,(uint) strlen(db));
- col_privs->field[2]->store(user,(uint) strlen(user));
- col_privs->field[3]->store(tname,(uint) strlen(tname));
+ col_privs->field[0]->store(host,(uint) strlen(host), system_charset_info);
+ col_privs->field[1]->store(db,(uint) strlen(db), system_charset_info);
+ col_privs->field[2]->store(user,(uint) strlen(user), system_charset_info);
+ col_privs->field[3]->store(tname,(uint) strlen(tname), system_charset_info);
key_len=(col_privs->field[0]->pack_length()+
col_privs->field[1]->pack_length()+
col_privs->field[2]->pack_length()+
col_privs->field[3]->pack_length());
key_copy(key,col_privs,0,key_len);
- col_privs->field[4]->store("",0);
+ col_privs->field[4]->store("",0, system_charset_info);
col_privs->file->index_init(0);
if (col_privs->file->index_read(col_privs->record[0],
(byte*) col_privs->field[0]->ptr,
@@ -1644,8 +1649,10 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
}
else
{
- if ((host && !wild_case_compare(host,grant_table->host)) ||
- (ip && !wild_case_compare(ip,grant_table->host)))
+ if ((host && !wild_case_compare(system_charset_info,
+ host,grant_table->host)) ||
+ (ip && !wild_case_compare(system_charset_info,
+ ip,grant_table->host)))
found=grant_table; // Host ok
}
}
@@ -1672,10 +1679,10 @@ static int replace_column_table(GRANT_TABLE *g_t,
byte key[MAX_KEY_LENGTH];
DBUG_ENTER("replace_column_table");
- table->field[0]->store(combo.host.str,combo.host.length);
- table->field[1]->store(db,(uint) strlen(db));
- table->field[2]->store(combo.user.str,combo.user.length);
- table->field[3]->store(table_name,(uint) strlen(table_name));
+ table->field[0]->store(combo.host.str,combo.host.length, system_charset_info);
+ table->field[1]->store(db,(uint) strlen(db), system_charset_info);
+ table->field[2]->store(combo.user.str,combo.user.length, system_charset_info);
+ table->field[3]->store(table_name,(uint) strlen(table_name), system_charset_info);
key_length=(table->field[0]->pack_length()+ table->field[1]->pack_length()+
table->field[2]->pack_length()+ table->field[3]->pack_length());
key_copy(key,table,0,key_length);
@@ -1692,7 +1699,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
ulong privileges = xx->rights;
bool old_row_exists=0;
key_restore(table,key,0,key_length);
- table->field[4]->store(xx->column.ptr(),xx->column.length());
+ table->field[4]->store(xx->column.ptr(),xx->column.length(),system_charset_info);
if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,
0, HA_READ_KEY_EXACT))
@@ -1706,9 +1713,9 @@ static int replace_column_table(GRANT_TABLE *g_t,
continue; /* purecov: inspected */
}
old_row_exists = 0;
- restore_record(table,2); // Get empty record
+ restore_record(table,2); // Get empty record
key_restore(table,key,0,key_length);
- table->field[4]->store(xx->column.ptr(),xx->column.length());
+ table->field[4]->store(xx->column.ptr(),xx->column.length(), system_charset_info);
}
else
{
@@ -1780,7 +1787,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
{
GRANT_COLUMN *grant_column = NULL;
char colum_name_buf[HOSTNAME_LENGTH+1];
- String column_name(colum_name_buf,sizeof(colum_name_buf));
+ String column_name(colum_name_buf,sizeof(colum_name_buf),system_charset_info);
privileges&= ~rights;
table->field[6]->store((longlong)
@@ -1850,10 +1857,10 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
}
restore_record(table,2); // Get empty record
- table->field[0]->store(combo.host.str,combo.host.length);
- table->field[1]->store(db,(uint) strlen(db));
- table->field[2]->store(combo.user.str,combo.user.length);
- table->field[3]->store(table_name,(uint) strlen(table_name));
+ table->field[0]->store(combo.host.str,combo.host.length, system_charset_info);
+ table->field[1]->store(db,(uint) strlen(db), system_charset_info);
+ table->field[2]->store(combo.user.str,combo.user.length, system_charset_info);
+ table->field[3]->store(table_name,(uint) strlen(table_name), system_charset_info);
store_record(table,1); // store at pos 1
if (table->file->index_read_idx(table->record[0],0,
@@ -1898,7 +1905,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
}
}
- table->field[4]->store(grantor,(uint) strlen(grantor));
+ table->field[4]->store(grantor,(uint) strlen(grantor), system_charset_info);
table->field[6]->store((longlong) store_table_rights);
table->field[7]->store((longlong) store_col_rights);
rights=fix_rights_for_table(store_table_rights);
@@ -2155,7 +2162,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
if (lower_case_table_names && db)
{
strmov(tmp_db,db);
- casedn_str(tmp_db);
+ my_casedn_str(system_charset_info, tmp_db);
db=tmp_db;
}
@@ -2243,7 +2250,8 @@ int grant_init (void)
DBUG_ENTER("grant_init");
grant_option = FALSE;
- (void) hash_init(&hash_tables,0,0,0, (hash_get_key) get_grant_table,
+ (void) hash_init(&hash_tables,system_charset_info,
+ 0,0,0, (hash_get_key) get_grant_table,
(hash_free_key) free_grant_table,0);
init_sql_alloc(&memex,1024,0);
@@ -2577,8 +2585,10 @@ bool check_grant_db(THD *thd,const char *db)
GRANT_TABLE *grant_table = (GRANT_TABLE*) hash_element(&hash_tables,idx);
if (len < grant_table->key_length &&
!memcmp(grant_table->hash_key,helping,len) &&
- (thd->host && !wild_case_compare(thd->host,grant_table->host) ||
- (thd->ip && !wild_case_compare(thd->ip,grant_table->host))))
+ (thd->host && !wild_case_compare(system_charset_info,
+ thd->host,grant_table->host) ||
+ (thd->ip && !wild_case_compare(system_charset_info,
+ thd->ip,grant_table->host))))
{
error=0; // Found match
break;
@@ -2707,7 +2717,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
DBUG_RETURN(-1);
}
- Item_string *field=new Item_string("",0);
+ Item_string *field=new Item_string("",0,system_charset_info);
List<Item> field_list;
field->name=buff;
field->max_length=1024;
@@ -2723,7 +2733,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (acl_user->access || acl_user->password)
{
want_access=acl_user->access;
- String global(buff,sizeof(buff));
+ String global(buff,sizeof(buff),system_charset_info);
global.length(0);
global.append("GRANT ",6);
@@ -2849,7 +2859,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
want_access=acl_db->access;
if (want_access)
{
- String db(buff,sizeof(buff));
+ String db(buff,sizeof(buff),system_charset_info);
db.length(0);
db.append("GRANT ",6);
@@ -2908,7 +2918,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
want_access=grant_table->privs;
if ((want_access | grant_table->cols) != 0)
{
- String global(buff,sizeof(buff));
+ String global(buff,sizeof(buff),system_charset_info);
global.length(0);
global.append("GRANT ",6);