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

« back to all changes in this revision

Viewing changes to mysql-test/t/sp-security.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:
5
5
# Can't test with embedded server that doesn't support grants
6
6
-- source include/not_embedded.inc
7
7
 
 
8
# Save the initial number of concurrent sessions
 
9
--source include/count_sessions.inc
 
10
 
8
11
connect (con1root,localhost,root,,);
9
12
 
10
13
connection con1root;
156
159
select db1_secret.db();
157
160
 
158
161
#
159
 
# BUG#2777
 
162
# Bug#2777 Stored procedure doesn't observe definer's rights
160
163
#
161
164
 
162
165
connection con1root;
215
218
select * from t2;
216
219
 
217
220
#
218
 
# BUG#6030: Stored procedure has no appropriate DROP privilege
 
221
# Bug#6030 Stored procedure has no appropriate DROP privilege
219
222
# (or ALTER for that matter)
220
223
 
221
224
# still connection con2user1 in db2
243
246
disconnect con3anon;
244
247
disconnect con4user2;
245
248
use test;
246
 
select type,db,name from mysql.proc;
 
249
select type,db,name from mysql.proc where db like 'db%';
247
250
drop database db1_secret;
248
251
drop database db2;
249
252
# Make sure the routines are gone
250
 
select type,db,name from mysql.proc;
 
253
select type,db,name from mysql.proc where db like 'db%';
251
254
# Get rid of the users
252
255
delete from mysql.user where user='user1' or user='user2';
253
256
delete from mysql.user where user='' and host='%';
330
333
drop table t1;
331
334
 
332
335
#
333
 
# BUG#9503: reseting correct parameters of thread after error in SP function
 
336
# Bug#9503 reseting correct parameters of thread after error in SP function
334
337
#
335
338
connect (root,localhost,root,,test);
336
339
connection root;
366
369
drop function bug_9503;
367
370
use test;
368
371
drop database mysqltest;
 
372
connection default;
 
373
disconnect root;
369
374
 
370
375
#
371
376
# correct value from current_user() in function run from "security definer"
372
 
# (BUG#7291)
 
377
# (Bug#7291 Stored procedures: wrong CURRENT_USER value)
373
378
#
374
379
connection con1root;
375
380
use test;
398
403
drop user user1@localhost;
399
404
 
400
405
#
401
 
# Bug #12318: Wrong error message when accessing an inaccessible stored
 
406
# Bug#12318 Wrong error message when accessing an inaccessible stored
402
407
# procedure in another database when the current database is
403
408
# information_schema.
404
 
 
409
#
405
410
 
406
411
--disable_warnings
407
412
drop database if exists mysqltest_1;
438
443
drop user mysqltest_1@localhost;
439
444
 
440
445
#
441
 
# BUG#12812 create view calling a function works without execute right
 
446
# Bug#12812 create view calling a function works without execute right
442
447
#           on function
443
448
delimiter |;
444
449
--disable_warnings
464
469
 
465
470
 
466
471
#
467
 
# BUG#14834: Server denies to execute Stored Procedure
 
472
# Bug#14834 Server denies to execute Stored Procedure
468
473
#
469
474
# The problem here was with '_' in the database name.
470
475
#
507
512
 
508
513
 
509
514
#
510
 
# BUG#14533: 'desc tbl' in stored procedure causes error
 
515
# Bug#14533 'desc tbl' in stored procedure causes error
511
516
# ER_TABLEACCESS_DENIED_ERROR
512
517
#
513
518
create database db_bug14533;
546
551
 
547
552
 
548
553
#
549
 
# WL#2897: Complete definer support in the stored routines.
 
554
# WL#2897 Complete definer support in the stored routines.
550
555
#
551
556
# The following cases are tested:
552
557
#   1. check that if DEFINER-clause is not explicitly specified, stored routines
591
596
--echo ---> connection: mysqltest_2_con
592
597
--connection mysqltest_2_con
593
598
 
594
 
use mysqltest;
 
599
USE mysqltest;
595
600
 
596
601
CREATE PROCEDURE wl2897_p1() SELECT 1;
597
602
 
603
608
--echo ---> connection: mysqltest_1_con
604
609
--connection mysqltest_1_con
605
610
 
606
 
use mysqltest;
 
611
USE mysqltest;
607
612
 
608
613
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
609
614
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
629
634
--echo ---> connection: con1root
630
635
--connection con1root
631
636
 
632
 
use mysqltest;
 
637
USE mysqltest;
633
638
 
634
639
SHOW CREATE PROCEDURE wl2897_p1;
635
640
SHOW CREATE PROCEDURE wl2897_p3;
649
654
 
650
655
 
651
656
#
652
 
# BUG#13198: SP executes if definer does not exist
 
657
# Bug#13198 SP executes if definer does not exist
653
658
#
654
659
 
655
660
# Prepare environment.
679
684
--echo ---> connection: mysqltest_1_con
680
685
--connection mysqltest_1_con
681
686
 
682
 
use mysqltest;
 
687
USE mysqltest;
683
688
 
684
689
CREATE PROCEDURE bug13198_p1()
685
690
  SELECT 1;
697
702
--echo ---> connection: mysqltest_2_con
698
703
--connection mysqltest_2_con
699
704
 
700
 
use mysqltest;
 
705
USE mysqltest;
701
706
 
702
707
CALL bug13198_p1();
703
708
 
719
724
--echo ---> connection: mysqltest_2_con
720
725
--connection mysqltest_2_con
721
726
 
722
 
use mysqltest;
 
727
USE mysqltest;
723
728
 
724
729
--error ER_NO_SUCH_USER
725
730
CALL bug13198_p1();
740
745
DROP DATABASE mysqltest;
741
746
 
742
747
#
743
 
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
744
 
#             it results in NULL p/w
 
748
# Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
 
749
#           it results in NULL p/w
745
750
#
746
751
 
747
752
# Can't test with embedded server that doesn't support grants
756
761
--echo ---> connection: mysqltest_2_con
757
762
--connection mysqltest_2_con
758
763
 
759
 
use test;
 
764
USE test;
760
765
 
761
766
DELIMITER //;
762
767
  CREATE PROCEDURE sp19857() DETERMINISTIC
790
795
use test;
791
796
 
792
797
#
793
 
# BUG#18630: Arguments of suid routine calculated in wrong security
794
 
# context
 
798
# Bug#18630 Arguments of suid routine calculated in wrong security context
795
799
#
796
800
# Arguments of suid routines were calculated in definer's security
797
801
# context instead of caller's context thus creating security hole.
862
866
DROP TABLE t1;
863
867
 
864
868
--echo End of 5.0 tests.
 
869
 
 
870
# Wait till all disconnects are completed
 
871
--source include/wait_until_count_sessions.inc
 
872