Commit 44d855e7 authored by unknown's avatar unknown
Browse files

logging_ok:

  Logging to logging@openlogging.org accepted
sql_acl.cc, grant.test, grant.result:
  BUG 5831 Changed mysql_revoke_all() to successfully delete all privileges for a user in one pass.


mysql-test/r/grant.result:
  BUG 5831 Changed mysql_revoke_all() to successfully delete all privileges for a user in one pass.
mysql-test/t/grant.test:
  BUG 5831 Changed mysql_revoke_all() to successfully delete all privileges for a user in one pass.
sql/sql_acl.cc:
  BUG 5831 Changed mysql_revoke_all() to successfully delete all privileges for a user in one pass.
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 92e7d03e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ brian@brian-akers-computer.local
brian@private-client-ip-101.oz.net
carsten@tsort.bitbybit.dk
davida@isil.mysql.com
dellis@goetia.(none)
dlenev@brandersnatch.localdomain
dlenev@build.mysql.com
dlenev@jabberwock.localdomain
+27 −0
Original line number Diff line number Diff line
@@ -248,3 +248,30 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
USE test;
CREATE TABLE t1 (a int );
CREATE TABLE t2 LIKE t1;
CREATE TABLE t3 LIKE t1;
CREATE TABLE t4 LIKE t1;
CREATE TABLE t5 LIKE t1;
CREATE TABLE t6 LIKE t1;
CREATE TABLE t7 LIKE t1;
CREATE TABLE t8 LIKE t1;
CREATE TABLE t9 LIKE t1;
CREATE TABLE t10 LIKE t1;
GRANT SELECT ON test.t1 TO testuser@localhost;
GRANT SELECT ON test.t2 TO testuser@localhost;
GRANT SELECT ON test.t3 TO testuser@localhost;
GRANT SELECT ON test.t4 TO testuser@localhost;
GRANT SELECT ON test.t5 TO testuser@localhost;
GRANT SELECT ON test.t6 TO testuser@localhost;
GRANT SELECT ON test.t7 TO testuser@localhost;
GRANT SELECT ON test.t8 TO testuser@localhost;
GRANT SELECT ON test.t9 TO testuser@localhost;
GRANT SELECT ON test.t10 TO testuser@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
SHOW GRANTS FOR testuser@localhost;
Grants for testuser@localhost
GRANT USAGE ON *.* TO 'testuser'@'localhost'
DROP USER testuser@localhost;
DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+29 −0
Original line number Diff line number Diff line
@@ -189,3 +189,32 @@ show grants for test11@localhost;
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';

#
# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
#
USE test;
CREATE TABLE t1 (a int );
CREATE TABLE t2 LIKE t1;
CREATE TABLE t3 LIKE t1;
CREATE TABLE t4 LIKE t1;
CREATE TABLE t5 LIKE t1;
CREATE TABLE t6 LIKE t1;
CREATE TABLE t7 LIKE t1;
CREATE TABLE t8 LIKE t1;
CREATE TABLE t9 LIKE t1;
CREATE TABLE t10 LIKE t1;
GRANT SELECT ON test.t1 TO testuser@localhost;
GRANT SELECT ON test.t2 TO testuser@localhost;
GRANT SELECT ON test.t3 TO testuser@localhost;
GRANT SELECT ON test.t4 TO testuser@localhost;
GRANT SELECT ON test.t5 TO testuser@localhost;
GRANT SELECT ON test.t6 TO testuser@localhost;
GRANT SELECT ON test.t7 TO testuser@localhost;
GRANT SELECT ON test.t8 TO testuser@localhost;
GRANT SELECT ON test.t9 TO testuser@localhost;
GRANT SELECT ON test.t10 TO testuser@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
SHOW GRANTS FOR testuser@localhost;
DROP USER testuser@localhost;
DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+15 −2
Original line number Diff line number Diff line
@@ -3622,7 +3622,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
    }

    /* Remove db access privileges */
    for (counter= 0 ; counter < acl_dbs.elements ; counter++)
    for (counter= 0 ; counter < acl_dbs.elements ; )
    {
      const char *user,*host;

@@ -3636,12 +3636,18 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
	  !my_strcasecmp(system_charset_info, lex_user->host.str, host))
      {
	if (replace_db_table(tables[1].table, acl_db->db, *lex_user, ~0, 1))
	{
	  result= -1;
	  ++counter;
	  continue;
	}
      }
      else
	++counter;
    }

    /* Remove column access */
    for (counter= 0 ; counter < column_priv_hash.records ; counter++)
    for (counter= 0 ; counter < column_priv_hash.records ; )
    {
      const char *user,*host;
      GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
@@ -3660,6 +3666,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
				~0, 0, 1))
	{
	  result= -1;
	  ++counter;
	  continue;
	}
	if (grant_table->cols)
@@ -3670,10 +3677,16 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
				   grant_table->db,
				   grant_table->tname,
				   ~0, 1))
	  {
	    result= -1;
	    ++counter;
	    continue;
	  }
	}
      }
      else
	++counter;
    }
  }

  VOID(pthread_mutex_unlock(&acl_cache->lock));