summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-07-20 01:01:02 +0300
committerunknown <bell@sanja.is.com.ua>2004-07-20 01:01:02 +0300
commitf0957bcc619984284eb405e1410bd9718f6e8fd6 (patch)
tree587812d38fd1f56588780d81461ee509a82118b2
parent7d91d3f0bf0377a3333ae8eff41a1dbe855d9621 (diff)
downloadmariadb-git-f0957bcc619984284eb405e1410bd9718f6e8fd6.tar.gz
fixed case when frivileges check switched off (BUG#4631)
mysql-test/r/view.result: test made more environment independed mysql-test/t/view.test: test made more environment independed sql/sql_acl.cc: fixed case when frivileges check switched off
-rw-r--r--mysql-test/r/view.result4
-rw-r--r--mysql-test/r/view_skip_grants.result6
-rw-r--r--mysql-test/t/view.test4
-rw-r--r--mysql-test/t/view_skip_grants-master.opt1
-rw-r--r--mysql-test/t/view_skip_grants.test14
-rw-r--r--sql/sql_acl.cc5
6 files changed, 30 insertions, 4 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 37e9c8fc2fa..3a642f51e1e 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1,5 +1,5 @@
-drop table if exists t1,t2;
-drop view if exists v1,v2,v3,v4,v5,v6;
+drop table if exists t1,t2,v1,v2,v3,v4,v5,v6;
+drop view if exists t1,t2,v1,v2,v3,v4,v5,v6;
drop database if exists mysqltest;
use test;
create view v1 (c,d) as select a,b from t1;
diff --git a/mysql-test/r/view_skip_grants.result b/mysql-test/r/view_skip_grants.result
new file mode 100644
index 00000000000..48cb9f2aa25
--- /dev/null
+++ b/mysql-test/r/view_skip_grants.result
@@ -0,0 +1,6 @@
+drop table if exists t1,v1;
+drop view if exists t1,v1;
+use test;
+create table t1 (field1 INT);
+CREATE VIEW v1 AS SELECT field1 FROM t1;
+drop view v1;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index a37de0904c5..b1dfa09a50a 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -1,6 +1,6 @@
--disable_warnings
-drop table if exists t1,t2;
-drop view if exists v1,v2,v3,v4,v5,v6;
+drop table if exists t1,t2,v1,v2,v3,v4,v5,v6;
+drop view if exists t1,t2,v1,v2,v3,v4,v5,v6;
drop database if exists mysqltest;
--enable_warnings
use test;
diff --git a/mysql-test/t/view_skip_grants-master.opt b/mysql-test/t/view_skip_grants-master.opt
new file mode 100644
index 00000000000..5699a3387b8
--- /dev/null
+++ b/mysql-test/t/view_skip_grants-master.opt
@@ -0,0 +1 @@
+--skip-grant-tables
diff --git a/mysql-test/t/view_skip_grants.test b/mysql-test/t/view_skip_grants.test
new file mode 100644
index 00000000000..bfbaec44eb1
--- /dev/null
+++ b/mysql-test/t/view_skip_grants.test
@@ -0,0 +1,14 @@
+--disable_warnings
+drop table if exists t1,v1;
+drop view if exists t1,v1;
+--enable_warnings
+use test;
+
+#
+# test that we can create VIEW if privileges check switched off
+#
+create table t1 (field1 INT);
+CREATE VIEW v1 AS SELECT field1 FROM t1;
+
+drop view v1;
+drop table t1
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 10a12ef6d04..c01c0930711 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3838,6 +3838,11 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
{
/* global privileges */
grant->privilege= thd->master_access;
+
+ /* if privileges ignored (--skip-grant-tables) above is enough */
+ if (!grant_option)
+ return;
+
/* db privileges */
grant->privilege|= acl_get(thd->host, thd->ip, thd->priv_user, db, 0);
/* table privileges */