Commit 98b9ce44 authored by sergefp@foxhole.(none)'s avatar sergefp@foxhole.(none)

Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.1-opt

into  mysql.com:/home/psergey/mysql-5.1-bug30573
parents f3cd35b9 1441d6d0
......@@ -1137,6 +1137,7 @@ libmysqld/rpl_filter.cc
libmysqld/rpl_injector.cc
libmysqld/rpl_record.cc
libmysqld/rpl_record_old.cc
libmysqld/scheduler.cc
libmysqld/set_var.cc
libmysqld/simple-test
libmysqld/slave.cc
......@@ -1153,6 +1154,7 @@ libmysqld/sql_builtin.cc
libmysqld/sql_cache.cc
libmysqld/sql_class.cc
libmysqld/sql_command
libmysqld/sql_connect.cc
libmysqld/sql_crypt.cc
libmysqld/sql_cursor.cc
libmysqld/sql_cursor.h
......@@ -1183,6 +1185,7 @@ libmysqld/sql_show.cc
libmysqld/sql_state.c
libmysqld/sql_string.cc
libmysqld/sql_table.cc
libmysqld/sql_tablespace.cc
libmysqld/sql_test.cc
libmysqld/sql_trigger.cc
libmysqld/sql_udf.cc
......
......@@ -21,7 +21,6 @@
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_OPENSSL
#undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
......
......@@ -22,7 +22,7 @@ IF(WIN32)
ADD_DEFINITIONS(-DUSE_TLS)
ENDIF(WIN32)
ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY)
ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY -DHAVE_DLOPEN)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysqld
......
......@@ -546,7 +546,6 @@ void end_embedded_server()
{
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
copy_arguments_ptr=0;
release_ddl_log();
clean_up(0);
}
......
......@@ -19,6 +19,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
End of 5.0 tests.
drop procedure if exists proc_1;
create procedure proc_1() install plugin my_plug soname '\\root\\some_plugin.dll';
call proc_1();
ERROR HY000: No paths allowed for shared library
......
......@@ -36,6 +36,9 @@ EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
--echo End of 5.0 tests.
--disable_warnings
drop procedure if exists proc_1;
--enable_warnings
#
# Bug #20665: All commands supported in Stored Procedures should work in
# Prepared Statements
......
......@@ -680,6 +680,8 @@ void free_items(Item *item);
void cleanup_items(Item *item);
class THD;
void close_thread_tables(THD *thd);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables);
bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *tables, bool no_errors);
......@@ -688,6 +690,24 @@ bool check_routine_access(THD *thd,ulong want_access,char *db,char *name,
bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list);
bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
#else
inline bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables)
{ return false; }
inline bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *tables, bool no_errors)
{ return false; }
inline bool check_routine_access(THD *thd,ulong want_access,char *db,
char *name, bool is_proc, bool no_errors)
{ return false; }
inline bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
{ return false; }
inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list)
{ return false; }
inline bool check_some_routine_access(THD *thd, const char *db,
const char *name, bool is_proc)
{ return false; }
#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
bool mysql_multi_update_prepare(THD *thd);
......@@ -991,11 +1011,27 @@ void kill_mysql(void);
void close_connection(THD *thd, uint errcode, bool lock);
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
bool no_grant, bool no_errors, bool schema_db);
bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
bool no_errors);
bool check_global_access(THD *thd, ulong want_access);
#else
inline bool check_access(THD *thd, ulong access, const char *db,
ulong *save_priv, bool no_grant, bool no_errors,
bool schema_db)
{
if (save_priv)
*save_priv= GLOBAL_ACLS;
return false;
}
inline bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
bool no_errors)
{ return false; }
inline bool check_global_access(THD *thd, ulong want_access)
{ return false; }
#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
/*
Support routine for SQL parser on partitioning syntax
......
......@@ -1164,6 +1164,8 @@ void clean_up(bool print_message)
if (cleanup_done++)
return; /* purecov: inspected */
release_ddl_log();
/*
make sure that handlers finish up
what they have that is dependent on the binlog
......@@ -3995,7 +3997,6 @@ we force server id to 2, but this MySQL server will not act as a slave.");
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
(void) pthread_mutex_unlock(&LOCK_thread_count);
release_ddl_log();
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
if (Service.IsNT() && start_mode)
Service.Stop();
......
......@@ -3890,14 +3890,12 @@ create_sp_error:
thd->server_status|= SERVER_MORE_RESULTS_EXISTS;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_routine_access(thd, EXECUTE_ACL,
sp->m_db.str, sp->m_name.str, TRUE, FALSE))
{
thd->net.no_send_ok= save_no_send_ok;
goto error;
}
#endif
select_limit= thd->variables.select_limit;
thd->variables.select_limit= HA_POS_ERROR;
......@@ -4577,6 +4575,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check grants for commands which work only with one table.
......@@ -4694,7 +4693,6 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
bool dont_check_global_grants, bool no_errors, bool schema_db)
{
Security_context *sctx= thd->security_ctx;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
ulong db_access;
/*
GRANT command:
......@@ -4707,7 +4705,6 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
*/
bool db_is_pattern= (test(want_access & GRANT_ACL) &&
dont_check_global_grants);
#endif
ulong dummy;
DBUG_ENTER("check_access");
DBUG_PRINT("enter",("db: %s want_access: %lu master_access: %lu",
......@@ -4746,9 +4743,6 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
}
}
#ifdef NO_EMBEDDED_ACCESS_CHECKS
DBUG_RETURN(0);
#else
if ((sctx->master_access & want_access) == want_access)
{
/*
......@@ -4806,7 +4800,6 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
thd->db :
"unknown"))); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
......@@ -4831,16 +4824,12 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
bool check_global_access(THD *thd, ulong want_access)
{
#ifdef NO_EMBEDDED_ACCESS_CHECKS
return 0;
#else
char command[128];
if ((thd->security_ctx->master_access & want_access))
return 0;
get_privilege_desc(command, sizeof(command), want_access);
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
return 1;
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
......@@ -4930,9 +4919,7 @@ bool
check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
bool no_errors)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
TABLE_LIST *org_tables= tables;
#endif
TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
/*
......@@ -5019,11 +5006,7 @@ check_routine_access(THD *thd, ulong want_access,char *db, char *name,
0, no_errors, 0))
return TRUE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
return check_grant_routine(thd, want_access, tables, is_proc, no_errors);
#else
return FALSE;
#endif
}
......@@ -5113,6 +5096,7 @@ bool check_merge_table_access(THD *thd, char *db,
return error;
}
#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
/****************************************************************************
Check stack size; Send error if there isn't enough stack to continue
......
......@@ -279,7 +279,7 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen)
*/
typedef struct st_global_ddl_log
struct st_global_ddl_log
{
/*
We need to adjust buffer size to be able to handle downgrades/upgrades
......@@ -297,10 +297,12 @@ typedef struct st_global_ddl_log
uint name_len;
uint io_size;
bool inited;
bool do_release;
bool recovery_phase;
} GLOBAL_DDL_LOG;
st_global_ddl_log() : inited(false), do_release(false) {}
};
GLOBAL_DDL_LOG global_ddl_log;
st_global_ddl_log global_ddl_log;
pthread_mutex_t LOCK_gdl;
......@@ -460,6 +462,7 @@ static uint read_ddl_log_header()
global_ddl_log.first_used= NULL;
global_ddl_log.num_entries= 0;
VOID(pthread_mutex_init(&LOCK_gdl, MY_MUTEX_INIT_FAST));
global_ddl_log.do_release= true;
DBUG_RETURN(entry_no);
}
......@@ -1150,6 +1153,9 @@ void release_ddl_log()
DDL_LOG_MEMORY_ENTRY *used_list= global_ddl_log.first_used;
DBUG_ENTER("release_ddl_log");
if (!global_ddl_log.do_release)
DBUG_VOID_RETURN;
pthread_mutex_lock(&LOCK_gdl);
while (used_list)
{
......@@ -1167,6 +1173,7 @@ void release_ddl_log()
global_ddl_log.inited= 0;
pthread_mutex_unlock(&LOCK_gdl);
VOID(pthread_mutex_destroy(&LOCK_gdl));
global_ddl_log.do_release= false;
DBUG_VOID_RETURN;
}
......
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