~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to mysql-test/t/view_grant.test

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.0.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Can't test with embedded server
2
2
-- source include/not_embedded.inc
3
3
 
 
4
# Save the initial number of concurrent sessions
 
5
--source include/count_sessions.inc
 
6
 
4
7
--disable_warnings
5
8
drop database if exists mysqltest;
6
9
drop view if exists v1,v2,v3;
32
35
connect (user1,localhost,mysqltest_1,,test);
33
36
connection user1;
34
37
 
 
38
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
35
39
create definer=root@localhost view v1 as select * from mysqltest.t1;
36
40
create view v1 as select * from mysqltest.t1;
37
41
# try to modify view without DROP privilege on it
 
42
--error ER_TABLEACCESS_DENIED_ERROR
38
43
alter view v1 as select * from mysqltest.t1;
 
44
--error ER_TABLEACCESS_DENIED_ERROR
39
45
create or replace view v1 as select * from mysqltest.t1;
40
46
# no CRETE VIEW privilege
 
47
--error ER_TABLEACCESS_DENIED_ERROR
41
48
create view mysqltest.v2  as select * from mysqltest.t1;
42
49
# no SELECT privilege
 
50
--error ER_TABLEACCESS_DENIED_ERROR
43
51
create view v2 as select * from mysqltest.t2;
44
52
 
45
53
connection root;
54
57
grant create view,drop,select on test.* to mysqltest_1@localhost;
55
58
 
56
59
connection user1;
57
 
# following 'use' command is workaround of bug #9582 and should be removed
 
60
# following 'use' command is workaround of Bug#9582 and should be removed
58
61
# when that bug will be fixed
59
62
use test;
60
63
alter view v1 as select * from mysqltest.t1;
82
85
connection user1;
83
86
select c from mysqltest.v1;
84
87
# there are no privileges on column 'd'
 
88
--error ER_COLUMNACCESS_DENIED_ERROR
85
89
select d from mysqltest.v1;
86
90
 
87
91
connection root;
102
105
connection user1;
103
106
select c from mysqltest.v1;
104
107
# there are no privileges on column 'd'
 
108
--error ER_COLUMNACCESS_DENIED_ERROR
105
109
select d from mysqltest.v1;
106
110
 
107
111
connection root;
117
120
--disable_warnings
118
121
create database mysqltest;
119
122
--enable_warnings
120
 
#prepare views and tables
 
123
# prepare views and tables
121
124
create table mysqltest.t1 (a int, b int);
122
125
create table mysqltest.t2 (a int, b int);
123
126
create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
139
142
show columns from mysqltest.v1;
140
143
show columns from mysqltest.v2;
141
144
# but explain/show do not
 
145
--error ER_VIEW_NO_EXPLAIN
142
146
explain select c from mysqltest.v1;
 
147
--error ER_TABLEACCESS_DENIED_ERROR
143
148
show create view mysqltest.v1;
 
149
--error ER_VIEW_NO_EXPLAIN
144
150
explain select c from mysqltest.v2;
 
151
--error ER_TABLEACCESS_DENIED_ERROR
145
152
show create view mysqltest.v2;
 
153
--error ER_VIEW_NO_EXPLAIN
146
154
explain select c from mysqltest.v3;
 
155
--error ER_TABLEACCESS_DENIED_ERROR
147
156
show create view mysqltest.v3;
 
157
--error ER_VIEW_NO_EXPLAIN
148
158
explain select c from mysqltest.v4;
 
159
--error ER_TABLEACCESS_DENIED_ERROR
149
160
show create view mysqltest.v4;
150
161
 
151
162
# allow to see one of underlying table
162
165
connection user1;
163
166
# EXPLAIN of view on above table works
164
167
explain select c from mysqltest.v1;
 
168
--error ER_TABLEACCESS_DENIED_ERROR
165
169
show create view mysqltest.v1;
166
170
explain select c from mysqltest.v2;
 
171
--error ER_TABLEACCESS_DENIED_ERROR
167
172
show create view mysqltest.v2;
168
173
# but other EXPLAINs do not
 
174
--error ER_VIEW_NO_EXPLAIN
169
175
explain select c from mysqltest.v3;
 
176
--error ER_TABLEACCESS_DENIED_ERROR
170
177
show create view mysqltest.v3;
 
178
--error ER_VIEW_NO_EXPLAIN
171
179
explain select c from mysqltest.v4;
 
180
--error ER_TABLEACCESS_DENIED_ERROR
172
181
show create view mysqltest.v4;
173
182
 
174
183
# allow to see any view in mysqltest database
228
231
update v2 set a=a+c;
229
232
select * from t1;
230
233
# no rights on column
 
234
--error ER_COLUMNACCESS_DENIED_ERROR
231
235
update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
 
236
--error ER_COLUMNACCESS_DENIED_ERROR
232
237
update v2 set c=a+c;
233
238
# no rights for view
 
239
--error ER_TABLEACCESS_DENIED_ERROR
234
240
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
 
241
--error ER_TABLEACCESS_DENIED_ERROR
235
242
update v3 set a=a+c;
236
243
 
237
244
use test;
269
272
delete v1 from t2,v1 where t2.x=v1.c;
270
273
select * from t1;
271
274
# no rights for view
 
275
--error ER_TABLEACCESS_DENIED_ERROR
272
276
delete v2 from t2,v2 where t2.x=v2.c;
 
277
--error ER_TABLEACCESS_DENIED_ERROR
273
278
delete from v2 where c < 4;
274
279
 
275
280
use test;
305
308
insert into v1 select x,y from t2;
306
309
select * from t1;
307
310
# no rights for view
 
311
--error ER_TABLEACCESS_DENIED_ERROR
308
312
insert into v2 values (5,6);
 
313
--error ER_TABLEACCESS_DENIED_ERROR
309
314
insert into v2 select x,y from t2;
310
315
 
311
316
use test;
335
338
create view v1 as select * from mysqltest.t1;
336
339
create view v2 as select b from mysqltest.t2;
337
340
# There are not rights on mysqltest.v1
 
341
--error ER_TABLEACCESS_DENIED_ERROR
338
342
create view mysqltest.v1 as select * from mysqltest.t1;
339
343
# There are not any rights on mysqltest.t2.a
 
344
--error ER_COLUMNACCESS_DENIED_ERROR
340
345
create view v3 as select a from mysqltest.t2;
341
346
 
342
347
# give CREATE VIEW privileges (without any privileges for result column)
358
361
 
359
362
 
360
363
# Expression need select privileges
 
364
--error ER_COLUMNACCESS_DENIED_ERROR
361
365
create view v4 as select b+1 from mysqltest.t2;
362
366
 
363
367
connection root;
364
368
grant create view,update,select on test.* to mysqltest_1@localhost;
365
369
connection user1;
 
370
--error ER_COLUMNACCESS_DENIED_ERROR
366
371
create view v4 as select b+1 from mysqltest.t2;
367
372
 
368
373
connection root;
417
420
# check view definer information
418
421
show create view v1;
419
422
revoke select on mysqltest.t1 from mysqltest_1@localhost;
 
423
--error ER_VIEW_INVALID
420
424
select * from v1;
421
425
grant select on mysqltest.t1 to mysqltest_1@localhost;
422
426
select * from v1;
426
429
drop database mysqltest;
427
430
 
428
431
#
429
 
# rights on execution of view underlying functiond (BUG#9505)
 
432
# rights on execution of view underlying functiond (Bug#9505)
430
433
#
431
434
connection root;
432
435
--disable_warnings
459
462
use mysqltest;
460
463
select * from v1;
461
464
select * from v2;
 
465
--error ER_VIEW_INVALID
462
466
select * from v3;
 
467
--error ER_VIEW_INVALID
463
468
select * from v4;
 
469
--error ER_VIEW_INVALID
464
470
select * from v5;
465
471
use test;
466
472
 
511
514
connection root;
512
515
create view v5 as select * from v1;
513
516
revoke execute on function f2 from mysqltest_1@localhost;
 
517
--error ER_VIEW_INVALID
514
518
select * from v1;
 
519
--error ER_VIEW_INVALID
515
520
select * from v2;
516
521
select * from v3;
517
522
select * from v4;
 
523
--error ER_VIEW_INVALID
518
524
select * from v5;
519
525
 
520
526
drop view v1, v2, v3, v4, v5;
555
558
 
556
559
connection root;
557
560
revoke select on t1 from mysqltest_1@localhost;
 
561
--error ER_VIEW_INVALID
558
562
select * from v1;
 
563
--error ER_VIEW_INVALID
559
564
select * from v2;
560
565
select * from v3;
561
566
select * from v4;
 
567
--error ER_VIEW_INVALID
562
568
select * from v5;
563
569
 
564
570
#drop view v1, v2, v3, v4, v5;
594
597
use mysqltest;
595
598
select * from v1;
596
599
select * from v2;
 
600
--error ER_VIEW_INVALID
597
601
select * from v3;
 
602
--error ER_VIEW_INVALID
598
603
select * from v4;
 
604
--error ER_VIEW_INVALID
599
605
select * from v5;
600
606
use test;
601
607
 
610
613
drop database mysqltest;
611
614
 
612
615
#
613
 
# BUG#14256: definer in view definition is not fully qualified
 
616
# Bug#14256 definer in view definition is not fully qualified
614
617
#
615
618
--disable_warnings
616
619
drop view if exists v1;
647
650
select @v1def1, @v1def2, @v1def1=@v1def2;
648
651
 
649
652
connection root;
 
653
disconnect test14256;
650
654
drop user test14256;
651
655
 
652
656
# Restore the anonymous users.
656
660
drop table t1;
657
661
 
658
662
#
659
 
# BUG#14726: freeing stack variable in case of an error of opening
660
 
# a view when we have locked tables with LOCK TABLES statement.
 
663
# Bug#14726 freeing stack variable in case of an error of opening a view when
 
664
#           we have locked tables with LOCK TABLES statement.
661
665
#
662
666
connection root;
663
667
--disable_warnings
674
678
 
675
679
use mysqltest;
676
680
LOCK TABLES v1 READ;
 
681
--error ER_TABLEACCESS_DENIED_ERROR
677
682
SHOW CREATE TABLE v1;
678
683
UNLOCK TABLES;
679
684
use test;
685
689
drop database mysqltest;
686
690
 
687
691
#
688
 
# switch to default connaction
 
692
# switch to default connection
689
693
#
690
694
disconnect user1;
691
695
disconnect root;
702
706
drop view v2;
703
707
 
704
708
#
705
 
# Bug#18681: View privileges are broken
 
709
# Bug#18681 View privileges are broken
706
710
#
707
711
CREATE DATABASE mysqltest1;
708
712
CREATE USER readonly@localhost;
723
727
GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
724
728
GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
725
729
 
726
 
CONNECT (n1,localhost,readonly,,);
727
 
CONNECTION n1;
 
730
connect (n1,localhost,readonly,,);
 
731
connection n1;
728
732
 
729
 
--error 1356
 
733
--error ER_VIEW_INVALID
730
734
SELECT * FROM mysqltest1.v_t1;
731
 
--error 1356
 
735
--error ER_VIEW_INVALID
732
736
INSERT INTO mysqltest1.v_t1 VALUES(4);
733
 
--error 1356
 
737
--error ER_VIEW_INVALID
734
738
DELETE FROM mysqltest1.v_t1 WHERE x = 1;
735
 
--error 1356
 
739
--error ER_VIEW_INVALID
736
740
UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
737
 
--error 1356
 
741
--error ER_VIEW_INVALID
738
742
UPDATE mysqltest1.v_t1 SET x = 3;
739
 
--error 1356
 
743
--error ER_VIEW_INVALID
740
744
DELETE FROM mysqltest1.v_t1;
741
 
--error 1356
 
745
--error ER_VIEW_INVALID
742
746
SELECT 1 FROM mysqltest1.v_t1;
743
 
--error 1142
 
747
--error ER_TABLEACCESS_DENIED_ERROR
744
748
SELECT * FROM mysqltest1.t1;
745
749
 
746
750
SELECT * FROM mysqltest1.v_ts;
747
 
--error 1142
 
751
--error ER_TABLEACCESS_DENIED_ERROR
748
752
SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
749
 
--error 1142
 
753
--error ER_TABLEACCESS_DENIED_ERROR
750
754
SELECT * FROM mysqltest1.v_ti;
751
755
 
752
 
--error 1142
 
756
--error ER_TABLEACCESS_DENIED_ERROR
753
757
INSERT INTO mysqltest1.v_ts VALUES (100);
754
758
INSERT INTO mysqltest1.v_ti VALUES (100);
755
759
 
756
 
--error 1142
 
760
--error ER_TABLEACCESS_DENIED_ERROR
757
761
UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
758
 
--error 1142
 
762
--error ER_TABLEACCESS_DENIED_ERROR
759
763
UPDATE mysqltest1.v_ts SET x= 200;
760
764
UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
761
765
UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
762
766
UPDATE mysqltest1.v_tu SET x= 200;
763
767
 
764
 
--error 1142
 
768
--error ER_TABLEACCESS_DENIED_ERROR
765
769
DELETE FROM mysqltest1.v_ts WHERE x= 200;
766
 
--error 1142
 
770
--error ER_TABLEACCESS_DENIED_ERROR
767
771
DELETE FROM mysqltest1.v_ts;
768
 
--error 1143
 
772
--error ER_COLUMNACCESS_DENIED_ERROR
769
773
DELETE FROM mysqltest1.v_td WHERE x= 200;
770
774
DELETE FROM mysqltest1.v_tds WHERE x= 200;
771
775
DELETE FROM mysqltest1.v_td;
772
776
 
773
 
CONNECTION default;
 
777
connection default;
 
778
disconnect n1;
774
779
DROP VIEW mysqltest1.v_tds;
775
780
DROP VIEW mysqltest1.v_td;
776
781
DROP VIEW mysqltest1.v_tus;
783
788
DROP DATABASE mysqltest1;
784
789
 
785
790
#
786
 
# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail
 
791
# Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
787
792
#
788
793
CREATE TABLE t1 (a INT PRIMARY KEY);
789
794
INSERT INTO t1 VALUES (1), (2), (3);
790
795
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
791
 
#--warning 1448
 
796
#--warning ER_VIEW_OTHER_USER
792
797
SHOW CREATE VIEW v;
793
 
--error 1449
 
798
--error ER_NO_SUCH_USER
794
799
SELECT * FROM v;
795
800
DROP VIEW v;
796
801
DROP TABLE t1;
797
802
USE test;
798
803
 
799
804
#
800
 
# Bug#20363: Create view on just created view is now denied
 
805
# Bug#20363 Create view on just created view is now denied
801
806
#
802
807
eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
803
808
eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
828
833
SELECT * from view3;
829
834
 
830
835
connection default;
 
836
disconnect session1;
831
837
DROP VIEW mysqltest_db1.view3;
832
838
DROP VIEW mysqltest_db1.view2;
833
839
DROP VIEW mysqltest_db1.view1;
835
841
DROP SCHEMA mysqltest_db1;
836
842
DROP USER mysqltest_db1@localhost;
837
843
#
838
 
# BUG#20482: failure on Create join view with sources views/tables 
839
 
#             in different schemas
 
844
# Bug#20482 failure on Create join view with sources views/tables
 
845
#           in different schemas
840
846
#
841
847
--disable_warnings
842
848
CREATE DATABASE test1;
846
852
CREATE TABLE test1.t0 (a VARCHAR(20));
847
853
CREATE TABLE test2.t1 (a VARCHAR(20));
848
854
CREATE VIEW  test2.t3 AS SELECT * FROM test1.t0;
849
 
CREATE OR REPLACE VIEW test.v1 AS 
 
855
CREATE OR REPLACE VIEW test.v1 AS
850
856
  SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
851
857
 
852
858
DROP VIEW test.v1;
857
863
 
858
864
 
859
865
#
860
 
# BUG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER
861
 
# returns invoker name
 
866
# Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
 
867
#           invoker name
862
868
#
863
869
--disable_warnings
864
870
DROP VIEW IF EXISTS v1;
917
923
 
918
924
 
919
925
#
920
 
# Bug#17254: Error for DEFINER security on VIEW provides too much info
 
926
# Bug#17254 Error for DEFINER security on VIEW provides too much info
921
927
#
922
928
connect (root,localhost,root,,);
923
929
connection root;
941
947
connect (inv,localhost,inv_17254,,db17254);
942
948
connection inv;
943
949
--echo for a user
944
 
--error 1142
 
950
--error ER_TABLEACCESS_DENIED_ERROR
945
951
SELECT * FROM v1;
946
952
 
947
953
connection root;
948
954
--echo for a superuser
949
 
--error 1449
 
955
--error ER_NO_SUCH_USER
950
956
SELECT * FROM v1;
951
957
DROP USER inv_17254@localhost;
952
958
DROP DATABASE db17254;
955
961
 
956
962
 
957
963
#
958
 
# BUG#24404: strange bug with view+permission+prepared statement
 
964
# Bug#24404 strange bug with view+permission+prepared statement
959
965
#
960
966
--disable_warnings
961
967
DROP DATABASE IF EXISTS mysqltest_db1;
1023
1029
DROP USER mysqltest_u2@localhost;
1024
1030
 
1025
1031
#
1026
 
# Bug#26813: The SUPER privilege is wrongly required to alter a view created
1027
 
#            by another user.
 
1032
# Bug#26813 The SUPER privilege is wrongly required to alter a view created
 
1033
#           by another user.
1028
1034
#
1029
1035
connection root;
1030
1036
CREATE DATABASE db26813;
1056
1062
disconnect u1;
1057
1063
 
1058
1064
--echo #
1059
 
--echo # Bug#29908: A user can gain additional access through the ALTER VIEW.
 
1065
--echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
1060
1066
--echo #
1061
1067
connection root;
1062
1068
CREATE DATABASE mysqltest_29908;
1101
1107
--echo #######################################################################
1102
1108
 
1103
1109
#
1104
 
# BUG#24040: Create View don't succed with "all privileges" on a database.
 
1110
# Bug#24040 Create View don't succed with "all privileges" on a database.
1105
1111
#
1106
1112
 
1107
1113
# Prepare.
1185
1191
 
1186
1192
# Cleanup.
1187
1193
 
 
1194
disconnect bug24040_con;
1188
1195
 
1189
1196
DROP DATABASE mysqltest1;
1190
1197
DROP DATABASE mysqltest2;
1191
1198
DROP USER mysqltest_u1@localhost;
1192
1199
 
 
1200
 
 
1201
#
 
1202
# Bug#41354 Access control is bypassed when all columns of a view are
 
1203
#           selected by * wildcard
 
1204
 
 
1205
CREATE DATABASE db1;
 
1206
USE db1;
 
1207
CREATE TABLE t1(f1 INT, f2 INT);
 
1208
CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
 
1209
 
 
1210
GRANT SELECT (f1) ON t1 TO foo;
 
1211
GRANT SELECT (f1) ON v1 TO foo;
 
1212
 
 
1213
connect (addconfoo, localhost, foo,,);
 
1214
connection addconfoo;
 
1215
USE db1;
 
1216
 
 
1217
SELECT f1 FROM t1;
 
1218
--error ER_COLUMNACCESS_DENIED_ERROR
 
1219
SELECT f2 FROM t1;
 
1220
--error ER_TABLEACCESS_DENIED_ERROR
 
1221
SELECT * FROM t1;
 
1222
 
 
1223
SELECT f1 FROM v1;
 
1224
--error ER_COLUMNACCESS_DENIED_ERROR
 
1225
SELECT f2 FROM v1;
 
1226
--error ER_TABLEACCESS_DENIED_ERROR
 
1227
SELECT * FROM v1;
 
1228
 
 
1229
connection default;
 
1230
disconnect root;
 
1231
disconnect addconfoo;
 
1232
USE test;
 
1233
REVOKE SELECT (f1) ON db1.t1 FROM foo;
 
1234
REVOKE SELECT (f1) ON db1.v1 FROM foo;
 
1235
DROP USER foo;
 
1236
DROP VIEW db1.v1;
 
1237
DROP TABLE db1.t1;
 
1238
DROP DATABASE db1;
 
1239
 
1193
1240
--echo End of 5.0 tests.
1194
1241
 
1195
1242
 
1218
1264
DROP VIEW v1;
1219
1265
DROP TABLE t1;
1220
1266
 
 
1267
#
 
1268
# Bug#37191: Failed assertion in CREATE VIEW
 
1269
#
 
1270
CREATE USER mysqluser1@localhost;
 
1271
CREATE DATABASE mysqltest1;
 
1272
 
 
1273
USE mysqltest1;
 
1274
 
 
1275
CREATE TABLE t1 ( a INT );
 
1276
CREATE TABLE t2 ( b INT );
 
1277
 
 
1278
INSERT INTO t1 VALUES (1), (2);
 
1279
INSERT INTO t2 VALUES (1), (2);
 
1280
 
 
1281
GRANT CREATE VIEW ON mysqltest1.* TO mysqluser1@localhost;
 
1282
 
 
1283
GRANT SELECT ON t1 TO mysqluser1@localhost;
 
1284
GRANT INSERT ON t2 TO mysqluser1@localhost;
 
1285
 
 
1286
--connect (connection1, localhost, mysqluser1, , mysqltest1)
 
1287
 
 
1288
--echo This would lead to failed assertion.
 
1289
CREATE VIEW v1 AS SELECT a, b FROM t1, t2;
 
1290
 
 
1291
--error ER_TABLEACCESS_DENIED_ERROR
 
1292
SELECT * FROM v1;
 
1293
--error ER_TABLEACCESS_DENIED_ERROR
 
1294
SELECT b FROM v1;
 
1295
 
 
1296
--disconnect connection1
 
1297
--connection default
 
1298
 
 
1299
DROP TABLE t1, t2;
 
1300
DROP VIEW v1;
 
1301
DROP DATABASE mysqltest1;
 
1302
DROP USER mysqluser1@localhost;
 
1303
USE test;
 
1304
 
1221
1305
--echo End of 5.1 tests.
1222
1306
 
1223
1307
#
1254
1338
DROP USER mysqluser1@localhost;
1255
1339
 
1256
1340
#
1257
 
# Bug#35600: Security breach via view, I_S table and prepared 
1258
 
# statement/stored procedure
 
1341
# Bug#35600 Security breach via view, I_S table and prepared
 
1342
#           statement/stored procedure
1259
1343
#
1260
1344
CREATE USER mysqluser1@localhost;
1261
1345
CREATE DATABASE mysqltest1;
1296
1380
DROP DATABASE mysqltest1;
1297
1381
DROP VIEW test.v3;
1298
1382
DROP USER mysqluser1@localhost;
 
1383
USE test;
 
1384
 
 
1385
# Wait till we reached the initial number of concurrent sessions
 
1386
--source include/wait_until_count_sessions.inc
 
1387