summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-04-24 14:08:03 +0500
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-04-24 14:08:03 +0500
commit842cbb01fd88924ee4818452265bde0a0e7d77b0 (patch)
treef4598d76f6c5d538034a6b379671cf8a7e2fa3db
parent6b2685b664e44d3e3812bd01f724f19af444b7a0 (diff)
parent3aea34b4528f0089348b2b9f17c6cf2bef512df8 (diff)
downloadmariadb-git-842cbb01fd88924ee4818452265bde0a0e7d77b0.tar.gz
Merge mysql.com:/home/ram/work/mysql-5.0-maint
into mysql.com:/home/ram/work/b27515/b27515.5.0 mysql-test/r/grant.result: Auto merged mysql-test/t/grant.test: Auto merged sql/sql_parse.cc: Auto merged
-rw-r--r--mysql-test/r/grant.result11
-rw-r--r--mysql-test/t/grant.test23
-rw-r--r--sql/sql_parse.cc2
3 files changed, 34 insertions, 2 deletions
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index ae550649951..6d014fbb71b 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -657,6 +657,17 @@ delete from mysql.db where user='mysqltest1';
delete from mysql.tables_priv where user='mysqltest1';
flush privileges;
drop database mysqltest;
+create database db27515;
+use db27515;
+create table t1 (a int);
+grant alter on db27515.t1 to user27515@localhost;
+grant insert, create on db27515.t2 to user27515@localhost;
+rename table t1 to t2;
+ERROR 42000: DROP command denied to user 'user27515'@'localhost' for table 't1'
+revoke all privileges, grant option from user27515@localhost;
+drop user user27515@localhost;
+drop database db27515;
+End of 4.1 tests
use test;
create table t1 (a int);
create table t2 as select * from mysql.user where user='';
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 623bd4363cb..197f20db76e 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -540,7 +540,28 @@ delete from mysql.tables_priv where user='mysqltest1';
flush privileges;
drop database mysqltest;
-# End of 4.1 tests
+#
+# Bug #27515: DROP previlege is not required for RENAME TABLE
+#
+connection master;
+create database db27515;
+use db27515;
+create table t1 (a int);
+grant alter on db27515.t1 to user27515@localhost;
+grant insert, create on db27515.t2 to user27515@localhost;
+
+connect (conn27515, localhost, user27515, , db27515);
+connection conn27515;
+--error 1142
+rename table t1 to t2;
+disconnect conn27515;
+
+connection master;
+revoke all privileges, grant option from user27515@localhost;
+drop user user27515@localhost;
+drop database db27515;
+
+--echo End of 4.1 tests
#
# Bug #16297 In memory grant tables not flushed when users's hostname is ""
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ac75e6ea2fa..35089bbb251 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3263,7 +3263,7 @@ end_with_restore_list:
*/
old_list= table[0];
new_list= table->next_local[0];
- if (check_grant(thd, ALTER_ACL, &old_list, 0, 1, 0) ||
+ if (check_grant(thd, ALTER_ACL | DROP_ACL, &old_list, 0, 1, 0) ||
(!test_all_bits(table->next_local->grant.privilege,
INSERT_ACL | CREATE_ACL) &&
check_grant(thd, INSERT_ACL | CREATE_ACL, &new_list, 0, 1, 0)))