mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manual merge from mysql-trunk-merge.
Conflicts: - extra/comp_err.c - mysql-test/collections/default.experimental - mysql-test/r/archive.result - mysql-test/r/select.result - mysql-test/suite/binlog/r/binlog_unsafe.result - mysql-test/suite/binlog/t/binlog_unsafe.test - mysql-test/suite/rpl/t/disabled.def - mysql-test/t/archive.test - mysql-test/t/select.test - sql/item.cc - sql/item.h - sql/item_timefunc.cc - sql/sql_base.cc - sql/sql_delete.cc - sql/sql_load.cc - sql/sql_partition.cc - sql/sql_table.cc - storage/innobase/handler/ha_innodb.cc - vio/vio.c
This commit is contained in:
@ -31,9 +31,8 @@
|
||||
#include "sp_head.h"
|
||||
#include "sp.h"
|
||||
|
||||
time_t mysql_db_table_last_check= 0L;
|
||||
|
||||
TABLE_FIELD_W_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
|
||||
static const
|
||||
TABLE_FIELD_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
|
||||
{
|
||||
{ C_STRING_WITH_LEN("Host") },
|
||||
{ C_STRING_WITH_LEN("char(60)") },
|
||||
@ -146,6 +145,8 @@ TABLE_FIELD_W_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
|
||||
}
|
||||
};
|
||||
|
||||
const TABLE_FIELD_DEF
|
||||
mysql_db_table_def= {MYSQL_DB_FIELD_COUNT, mysql_db_table_fields};
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
|
||||
@ -2464,7 +2465,12 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
|
||||
privs = cols = 0; /* purecov: deadcode */
|
||||
return; /* purecov: deadcode */
|
||||
}
|
||||
my_hash_insert(&hash_columns, (uchar *) mem_check);
|
||||
if (my_hash_insert(&hash_columns, (uchar *) mem_check))
|
||||
{
|
||||
/* Invalidate this entry */
|
||||
privs= cols= 0;
|
||||
return;
|
||||
}
|
||||
} while (!col_privs->file->index_next(col_privs->record[0]) &&
|
||||
!key_cmp_if_same(col_privs,key,0,key_prefix_len));
|
||||
col_privs->file->ha_index_end();
|
||||
@ -2498,14 +2504,17 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
|
||||
const char *host,const char* ip,
|
||||
const char *db,
|
||||
const char *user, const char *tname,
|
||||
bool exact)
|
||||
bool exact, bool name_tolower)
|
||||
{
|
||||
char helping [NAME_LEN*2+USERNAME_LENGTH+3];
|
||||
char helping [NAME_LEN*2+USERNAME_LENGTH+3], *name_ptr;
|
||||
uint len;
|
||||
GRANT_NAME *grant_name,*found=0;
|
||||
HASH_SEARCH_STATE state;
|
||||
|
||||
len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1;
|
||||
name_ptr= strmov(strmov(helping, user) + 1, db) + 1;
|
||||
len = (uint) (strmov(name_ptr, tname) - helping) + 1;
|
||||
if (name_tolower)
|
||||
my_casedn_str(files_charset_info, name_ptr);
|
||||
for (grant_name= (GRANT_NAME*) my_hash_first(name_hash, (uchar*) helping,
|
||||
len, &state);
|
||||
grant_name ;
|
||||
@ -2538,7 +2547,7 @@ routine_hash_search(const char *host, const char *ip, const char *db,
|
||||
{
|
||||
return (GRANT_TABLE*)
|
||||
name_hash_search(proc ? &proc_priv_hash : &func_priv_hash,
|
||||
host, ip, db, user, tname, exact);
|
||||
host, ip, db, user, tname, exact, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -2547,7 +2556,7 @@ table_hash_search(const char *host, const char *ip, const char *db,
|
||||
const char *user, const char *tname, bool exact)
|
||||
{
|
||||
return (GRANT_TABLE*) name_hash_search(&column_priv_hash, host, ip, db,
|
||||
user, tname, exact);
|
||||
user, tname, exact, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -2670,7 +2679,11 @@ static int replace_column_table(GRANT_TABLE *g_t,
|
||||
goto end; /* purecov: inspected */
|
||||
}
|
||||
grant_column= new GRANT_COLUMN(column->column,privileges);
|
||||
my_hash_insert(&g_t->hash_columns,(uchar*) grant_column);
|
||||
if (my_hash_insert(&g_t->hash_columns,(uchar*) grant_column))
|
||||
{
|
||||
result= -1;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3196,12 +3209,12 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
Str->user.str, table_name,
|
||||
rights,
|
||||
column_priv);
|
||||
if (!grant_table) // end of memory
|
||||
if (!grant_table ||
|
||||
my_hash_insert(&column_priv_hash,(uchar*) grant_table))
|
||||
{
|
||||
result= TRUE; /* purecov: deadcode */
|
||||
continue; /* purecov: deadcode */
|
||||
}
|
||||
my_hash_insert(&column_priv_hash,(uchar*) grant_table);
|
||||
}
|
||||
|
||||
/* If revoke_grant, calculate the new column privilege for tables_priv */
|
||||
@ -3405,12 +3418,13 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||
grant_name= new GRANT_NAME(Str->host.str, db_name,
|
||||
Str->user.str, table_name,
|
||||
rights, TRUE);
|
||||
if (!grant_name)
|
||||
if (!grant_name ||
|
||||
my_hash_insert(is_proc ?
|
||||
&proc_priv_hash : &func_priv_hash,(uchar*) grant_name))
|
||||
{
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
my_hash_insert(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) grant_name);
|
||||
}
|
||||
|
||||
if (replace_routine_table(thd, grant_name, tables[1].table, *Str,
|
||||
@ -3514,6 +3528,13 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
No User, but a password?
|
||||
They did GRANT ... TO CURRENT_USER() IDENTIFIED BY ... !
|
||||
Get the current user, and shallow-copy the new password to them!
|
||||
*/
|
||||
if (!tmp_Str->user.str && tmp_Str->password.str)
|
||||
Str->password= tmp_Str->password;
|
||||
if (replace_user_table(thd, tables[0].table, *Str,
|
||||
(!db ? rights : 0), revoke_grant, create_new_users,
|
||||
test(thd->variables.sql_mode &
|
||||
|
Reference in New Issue
Block a user