From: Date: December 6 2005 1:09pm Subject: bk commit into 5.0 tree (gluh:1.1979) BUG#14385 List-Archive: http://lists.mysql.com/internals/33063 X-Bug: 14385 Message-Id: <20051206120930.D6DEA3008C@eagle.intranet.mysql.r18.ru> Below is the list of changes that have just been committed into a local 5.0 repository of gluh. When gluh does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1979 05/12/06 16:09:20 gluh@stripped +3 -0 Fix for bug#14385 GRANT and mapping to correct user account problems Check if the host of table hash record exactly matches host from GRANT command, otherwise create new table hash record sql/sql_acl.cc 1.184 05/12/06 16:08:02 gluh@stripped +11 -0 Fix for bug#14385 GRANT and mapping to correct user account problems Check if the host of table hash record exactly matches host from GRANT command, otherwise create new table hash record mysql-test/t/grant.test 1.37 05/12/06 16:08:02 gluh@stripped +15 -0 Fix for bug#14385 GRANT and mapping to correct user account problems test case mysql-test/r/grant.result 1.47 05/12/06 16:08:02 gluh@stripped +16 -0 Fix for bug#14385 GRANT and mapping to correct user account problems test case # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: gluh # Host: eagle.intranet.mysql.r18.ru # Root: /home/gluh/MySQL/Bugs/5.0.14385 --- 1.183/sql/sql_acl.cc Mon Nov 28 15:30:50 2005 +++ 1.184/sql/sql_acl.cc Tue Dec 6 16:08:02 2005 @@ -2885,6 +2885,17 @@ bool mysql_table_grant(THD *thd, TABLE_L /* Find/create cached table grant */ grant_table= table_hash_search(Str->host.str, NullS, db_name, Str->user.str, table_name, 1); + /* + Check if the host of hash record exactly matches + host from GRANT command, otherwise create new hash record + */ + if (grant_table) + { + if (grant_table->host.hostname && Str->host.str && + my_strcasecmp(system_charset_info, grant_table->host.hostname, + Str->host.str)) + grant_table= 0; + } if (!grant_table) { if (revoke_grant) --- 1.46/mysql-test/r/grant.result Mon Nov 28 17:06:26 2005 +++ 1.47/mysql-test/r/grant.result Tue Dec 6 16:08:02 2005 @@ -615,3 +615,19 @@ show grants for root@localhost; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION set names latin1; +create database mysqltest; +use mysqltest; +create table t1(f1 int); +GRANT DELETE ON mysqltest.t1 TO flupps@'%'; +GRANT SELECT ON mysqltest.t1 TO flupps@'192.%'; +show grants for flupps@'192.%'; +Grants for flupps@192.% +GRANT USAGE ON *.* TO 'flupps'@'192.%' +GRANT SELECT ON `mysqltest`.`t1` TO 'flupps'@'192.%' +show grants for flupps@'%'; +Grants for flupps@% +GRANT USAGE ON *.* TO 'flupps'@'%' +GRANT DELETE ON `mysqltest`.`t1` TO 'flupps'@'%' +drop user flupps@'192.%'; +drop user flupps@'%'; +drop database mysqltest; --- 1.36/mysql-test/t/grant.test Mon Nov 28 15:28:37 2005 +++ 1.37/mysql-test/t/grant.test Tue Dec 6 16:08:02 2005 @@ -500,3 +500,18 @@ show grants for root@localhost; set names latin1; # End of 4.1 tests + + +# +# Bug#14385: GRANT and mapping to correct user account problems +# +create database mysqltest; +use mysqltest; +create table t1(f1 int); +GRANT DELETE ON mysqltest.t1 TO flupps@'%'; +GRANT SELECT ON mysqltest.t1 TO flupps@'192.%'; +show grants for flupps@'192.%'; +show grants for flupps@'%'; +drop user flupps@'192.%'; +drop user flupps@'%'; +drop database mysqltest;