Commit b36a6032 authored by unknown's avatar unknown

BUG#9993 2 unexpected warnings when dropping a routine and --skip-grant-tables

 - Dont perform automatic privilege handling for stored procedures when server is started --skip-grant-tables
 - Renamed view_skip_grants to skip_grants and added test cases for this


mysql-test/t/skip_grants-master.opt:
  Rename: mysql-test/t/view_skip_grants-master.opt -> mysql-test/t/skip_grants-master.opt
mysql-test/r/skip_grants.result:
  Added test for create and drop procedure with --skip-grant-tables
mysql-test/t/skip_grants.test:
  Added test for create and drop procedure with --skip-grant-tables
sql/mysql_priv.h:
  Make opt_noacl global
sql/mysqld.cc:
  Make opt_noacl global
sql/sql_parse.cc:
  On ly perform automatic privilege add/revoke if server is not started with  --skip-grant-tables
parent 9b07cafe
drop table if exists t1,v1; drop table if exists t1,v1;
drop view if exists t1,v1; drop view if exists t1,v1;
drop procedure if exists f1;
use test; use test;
create table t1 (field1 INT); create table t1 (field1 INT);
CREATE VIEW v1 AS SELECT field1 FROM t1; CREATE VIEW v1 AS SELECT field1 FROM t1;
drop view v1; drop view v1;
drop table t1;
create procedure f1() select 1;
drop procedure f1;
--disable_warnings --disable_warnings
drop table if exists t1,v1; drop table if exists t1,v1;
drop view if exists t1,v1; drop view if exists t1,v1;
drop procedure if exists f1;
--enable_warnings --enable_warnings
use test; use test;
...@@ -11,4 +12,11 @@ create table t1 (field1 INT); ...@@ -11,4 +12,11 @@ create table t1 (field1 INT);
CREATE VIEW v1 AS SELECT field1 FROM t1; CREATE VIEW v1 AS SELECT field1 FROM t1;
drop view v1; drop view v1;
drop table t1 drop table t1;
#
# Test that we can create and drop procedure without warnings
# see bug#9993
#
create procedure f1() select 1;
drop procedure f1;
...@@ -1095,7 +1095,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool; ...@@ -1095,7 +1095,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern my_bool opt_readonly, lower_case_file_system; extern my_bool opt_readonly, lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth; extern my_bool opt_secure_auth;
extern my_bool sp_automatic_privileges; extern my_bool sp_automatic_privileges, opt_noacl;
extern my_bool opt_old_style_user_limits, trust_routine_creators; extern my_bool opt_old_style_user_limits, trust_routine_creators;
extern uint opt_crash_binlog_innodb; extern uint opt_crash_binlog_innodb;
extern char *shared_memory_base_name, *mysqld_unix_port; extern char *shared_memory_base_name, *mysqld_unix_port;
......
...@@ -310,6 +310,7 @@ my_bool opt_old_style_user_limits= 0, trust_routine_creators= 0; ...@@ -310,6 +310,7 @@ my_bool opt_old_style_user_limits= 0, trust_routine_creators= 0;
changed). False otherwise. changed). False otherwise.
*/ */
volatile bool mqh_used = 0; volatile bool mqh_used = 0;
my_bool opt_noacl;
my_bool sp_automatic_privileges= 1; my_bool sp_automatic_privileges= 1;
#ifdef HAVE_INITGROUPS #ifdef HAVE_INITGROUPS
...@@ -445,7 +446,7 @@ char *master_ssl_ca, *master_ssl_capath, *master_ssl_cipher; ...@@ -445,7 +446,7 @@ char *master_ssl_ca, *master_ssl_capath, *master_ssl_cipher;
/* Static variables */ /* Static variables */
static bool kill_in_progress, segfaulted; static bool kill_in_progress, segfaulted;
static my_bool opt_do_pstack, opt_noacl, opt_bootstrap, opt_myisam_log; static my_bool opt_do_pstack, opt_bootstrap, opt_myisam_log;
static int cleanup_done; static int cleanup_done;
static ulong opt_specialflag, opt_myisam_block_size; static ulong opt_specialflag, opt_myisam_block_size;
static char *opt_logname, *opt_update_logname, *opt_binlog_index_name; static char *opt_logname, *opt_update_logname, *opt_binlog_index_name;
......
...@@ -3982,7 +3982,7 @@ mysql_execute_command(THD *thd) ...@@ -3982,7 +3982,7 @@ mysql_execute_command(THD *thd)
lex->sphead= 0; lex->sphead= 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
/* only add privileges if really neccessary */ /* only add privileges if really neccessary */
if (sp_automatic_privileges && if (sp_automatic_privileges && !opt_noacl &&
check_procedure_access(thd, DEFAULT_CREATE_PROC_ACLS, check_procedure_access(thd, DEFAULT_CREATE_PROC_ACLS,
db, name, 1)) db, name, 1))
{ {
...@@ -4247,7 +4247,7 @@ mysql_execute_command(THD *thd) ...@@ -4247,7 +4247,7 @@ mysql_execute_command(THD *thd)
if (check_procedure_access(thd, ALTER_PROC_ACL, db, name, 0)) if (check_procedure_access(thd, ALTER_PROC_ACL, db, name, 0))
goto error; goto error;
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
if (sp_automatic_privileges && if (sp_automatic_privileges && !opt_noacl &&
sp_revoke_privileges(thd, db, name)) sp_revoke_privileges(thd, db, name))
{ {
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment