mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.4' into 10.5
This commit is contained in:
@ -2500,7 +2500,7 @@ dispatch_end:
|
||||
/* Performance Schema Interface instrumentation, end */
|
||||
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
|
||||
thd->set_examined_row_count(0); // For processlist
|
||||
thd->set_command(COM_SLEEP);
|
||||
thd->mark_connection_idle();
|
||||
|
||||
thd->m_statement_psi= NULL;
|
||||
thd->m_digest= NULL;
|
||||
@ -2515,6 +2515,8 @@ dispatch_end:
|
||||
*/
|
||||
thd->lex->m_sql_cmd= NULL;
|
||||
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
DBUG_EXECUTE_IF("print_allocated_thread_memory",
|
||||
SAFEMALLOC_REPORT_MEMORY(sf_malloc_dbug_id()););
|
||||
|
||||
#if defined(ENABLED_PROFILING)
|
||||
thd->profiling.finish_current_query();
|
||||
@ -5233,9 +5235,55 @@ mysql_execute_command(THD *thd)
|
||||
my_ok(thd);
|
||||
break;
|
||||
case SQLCOM_BACKUP_LOCK:
|
||||
if (check_global_access(thd, RELOAD_ACL))
|
||||
goto error;
|
||||
/* first table is set for lock. For unlock the list is empty */
|
||||
if (check_global_access(thd, RELOAD_ACL, true))
|
||||
{
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
/*
|
||||
In case there is no global privilege, check DB privilege for LOCK TABLES.
|
||||
*/
|
||||
if (first_table) // BACKUP LOCK
|
||||
{
|
||||
if (check_single_table_access(thd, LOCK_TABLES_ACL, first_table, true))
|
||||
{
|
||||
char command[30];
|
||||
get_privilege_desc(command, sizeof(command), RELOAD_ACL|LOCK_TABLES_ACL);
|
||||
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else // BACKUP UNLOCK
|
||||
{
|
||||
/*
|
||||
We test mdl_backup_lock here because, if a user could obtain a lock
|
||||
it would be silly to error and say `you can't BACKUP UNLOCK`
|
||||
(because its obvious you did a `BACKUP LOCK`).
|
||||
As `BACKUP UNLOCK` doesn't have a database reference,
|
||||
there's no way we can check if the `BACKUP LOCK` privilege is missing.
|
||||
Testing `thd->db` would involve faking a `TABLE_LIST` structure,
|
||||
which because of the depth of inspection
|
||||
in `check_single_table_access` makes the faking likely to cause crashes,
|
||||
or unintended effects. The outcome of this is,
|
||||
if a user does an `BACKUP UNLOCK` without a `BACKUP LOCKED` table,
|
||||
there may be a` ER_SPECIFIC_ACCESS_DENIED` error even though
|
||||
user has the privilege.
|
||||
Its a bit different to what happens if the user has RELOAD_ACL,
|
||||
where the error is silently ignored.
|
||||
*/
|
||||
if (!thd->mdl_backup_lock)
|
||||
{
|
||||
|
||||
char command[30];
|
||||
get_privilege_desc(command, sizeof(command), RELOAD_ACL|LOCK_TABLES_ACL);
|
||||
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
There is reload privilege, first table is set for lock.
|
||||
For unlock the list is empty
|
||||
*/
|
||||
if (first_table)
|
||||
res= backup_lock(thd, first_table);
|
||||
else
|
||||
@ -8010,6 +8058,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||
thd->wsrep_retry_query = NULL;
|
||||
thd->wsrep_retry_query_len = 0;
|
||||
thd->wsrep_retry_command = COM_CONNECT;
|
||||
thd->proc_info= 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user