From 13cfc4775c4e310ad8a8c44efa512944b4c7a11d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 May 2007 14:41:58 +0500 Subject: [PATCH] Bug#28181 Access denied to 'information_schema when select into out file (regression) allow select into out file from I_S if user has FILE privilege otherwise issue an error mysql-test/r/outfile.result: test result mysql-test/t/outfile.test: test case sql/sql_parse.cc: allow select into out file from I_S if user has FILE privilege otherwise issue an error --- mysql-test/r/outfile.result | Bin 1382 -> 2135 bytes mysql-test/t/outfile.test | 35 +++++++++++++++++++++++++++++++++++ sql/sql_parse.cc | 3 ++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result index 023c4ea205f4c5a038bf841e341968343f71ad5e..8503df545d2d0bfc67d5c8aa9e6e8a51ca23d5ca 100644 GIT binary patch delta 766 zcmb`_y-ve05C`yy#S@Qk%3`U4G@wpoDFZW7XQaw?F0F+>g6$S%$}90UyaCU_If(*N zVTjZvQFQ+J=XdwTKCeIOt4?|p5up-M>_k8?ZFtiWLoC@?ItKKR9^1RMc2ekrOVzy> zHiFO^oc-CAFCe-I_wpJPcFPE2J(Mu Kllaual6?b_NfAN- delta 7 OcmcaE@QiCi8Y=(|&jRxR diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index 7c90fd32909..f285407efd4 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -96,3 +96,38 @@ create table t1(a int); eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1; drop table t1; +# +# Bug#28181 Access denied to 'information_schema when +# select into out file (regression) +# +create database mysqltest; +create user user_1@localhost; +grant all on mysqltest.* to user_1@localhost; +connect (con28181_1,localhost,user_1,,mysqltest); + +--error 1044 +eval select schema_name +into outfile "../tmp/outfile-test.4" +fields terminated by ',' optionally enclosed by '"' + lines terminated by '\n' +from information_schema.schemata +where schema_name like 'mysqltest'; + +connection default; +grant file on *.* to user_1@localhost; + +connect (con28181_2,localhost,user_1,,mysqltest); +eval select schema_name +into outfile "../tmp/outfile-test.4" +fields terminated by ',' optionally enclosed by '"' + lines terminated by '\n' +from information_schema.schemata +where schema_name like 'mysqltest'; + +connection default; +--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4 +use test; +revoke all privileges on *.* from user_1@localhost; +drop user user_1@localhost; +drop database mysqltest; + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 35089bbb251..3ca0c78d96a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5261,7 +5261,8 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, if (schema_db) { - if (want_access & ~(SELECT_ACL | EXTRA_ACL)) + if (!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL) || + (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL))) { if (!no_errors) {