diff options
author | unknown <jimw@mysql.com> | 2005-03-03 17:44:28 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-03-03 17:44:28 -0800 |
commit | 6010c88dfb3c58b91a6de52adb5f237b03d1b109 (patch) | |
tree | fc99a10cad70dea095d3413a60f6502a37297961 | |
parent | 87f53bf77d3f7a8dbc908a46a3e3aecc2f36af1d (diff) | |
download | mariadb-git-6010c88dfb3c58b91a6de52adb5f237b03d1b109.tar.gz |
Clean up merge of fix for Bug #3309.
mysql-test/r/grant2.result:
Update results
mysql-test/t/grant2.test:
Reset sql_mode before test.
sql/sql_acl.cc:
Fixes to merge
-rw-r--r-- | mysql-test/r/grant2.result | 1 | ||||
-rw-r--r-- | mysql-test/t/grant2.test | 1 | ||||
-rw-r--r-- | sql/sql_acl.cc | 30 |
3 files changed, 19 insertions, 13 deletions
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index e426f0cfc08..821f67536f3 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -233,6 +233,7 @@ drop user mysqltest_B@'%'; ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql' drop user mysqltest_B@'%'; drop user mysqltest_3@localhost; +set @@sql_mode=''; create database mysqltest_1; create table mysqltest_1.t1 (i int); insert into mysqltest_1.t1 values (1),(2),(3); diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 7e2ac5b4008..3b1200f8a6e 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -247,6 +247,7 @@ drop user mysqltest_B@'%'; drop user mysqltest_3@localhost; # # Bug #3309: Test IP addresses with netmask +set @@sql_mode=''; create database mysqltest_1; create table mysqltest_1.t1 (i int); insert into mysqltest_1.t1 values (1),(2),(3); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a1d64430a01..87c83771ec8 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2122,12 +2122,12 @@ static GRANT_NAME *name_hash_search(HASH *name_hash, { if (exact) { - if (compare_hostname(&grant_table->host, host, ip)) + if (compare_hostname(&grant_name->host, host, ip)) return grant_name; } else { - if (compare_hostname(&grant_table->host, host, ip) && + if (compare_hostname(&grant_name->host, host, ip) && (!found || found->sort < grant_name->sort)) found=grant_name; // Host ok } @@ -3178,7 +3178,7 @@ my_bool grant_init(THD *org_thd) if (check_no_resolve) { - if (hostname_requires_resolving(mem_check->host)) + if (hostname_requires_resolving(mem_check->host.hostname)) { sql_print_warning("'tables_priv' entry '%s %s@%s' " "ignored in --skip-name-resolve mode.", @@ -4057,7 +4057,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) if (!strcmp(lex_user->user.str,user) && !my_strcasecmp(system_charset_info, lex_user->host.str, - grant_proc->orig_host)) + grant_proc->host.hostname)) { ulong proc_access= grant_proc->privs; if (proc_access != 0) @@ -4543,19 +4543,22 @@ static int handle_grant_struct(uint struct_no, bool drop, case 1: acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*); user= acl_db->user; - host= acl_db->host.hostname; + if (!(host= acl_db->host.hostname)) + host= "%"; break; case 2: grant_name= (GRANT_NAME*) hash_element(&column_priv_hash, idx); user= grant_name->user; - host= grant_name->host; + if (!(host= grant_name->host.hostname)) + host= "%"; break; case 3: grant_name= (GRANT_NAME*) hash_element(&proc_priv_hash, idx); user= grant_name->user; - host= grant_name->host; + if (!(host= grant_name->host.hostname)) + host= "%"; break; } if (! user) @@ -4610,7 +4613,8 @@ static int handle_grant_struct(uint struct_no, bool drop, case 2: case 3: grant_name->user= strdup_root(&mem, user_to->user.str); - grant_name->host= strdup_root(&mem, user_to->host.str); + update_hostname(&grant_name->host, + strdup_root(&mem, user_to->host.str)); break; } } @@ -5067,7 +5071,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list) counter); if (!(user=grant_proc->user)) user= ""; - if (!(host=grant_proc->host)) + if (!(host=grant_proc->host.hostname)) host= ""; if (!strcmp(lex_user->user.str,user) && @@ -5139,8 +5143,8 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name) LEX_USER lex_user; lex_user.user.str= grant_proc->user; lex_user.user.length= strlen(grant_proc->user); - lex_user.host.str= grant_proc->host; - lex_user.host.length= strlen(grant_proc->host); + lex_user.host.str= grant_proc->host.hostname; + lex_user.host.length= strlen(grant_proc->host.hostname); if (!replace_proc_table(thd,grant_proc,tables[4].table,lex_user, grant_proc->db, grant_proc->tname, ~0, 1)) { @@ -5424,7 +5428,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) if (!(table_access & GRANT_ACL)) is_grantable= "NO"; - strxmov(buff,"'",user,"'@'",grant_table->orig_host,"'",NullS); + strxmov(buff,"'",user,"'@'",grant_table->host.hostname,"'",NullS); if (!test_access) update_schema_privilege(table, buff, grant_table->db, grant_table->tname, 0, 0, "USAGE", 5, is_grantable); @@ -5471,7 +5475,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) is_grantable= "NO"; ulong test_access= table_access & ~GRANT_ACL; - strxmov(buff,"'",user,"'@'",grant_table->orig_host,"'",NullS); + strxmov(buff,"'",user,"'@'",grant_table->host.hostname,"'",NullS); if (!test_access) continue; else |