mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge to get security patch
This commit is contained in:
@ -1454,7 +1454,7 @@ int main(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
row = mysql_fetch_row(master);
|
||||
if (row[0] && row[1])
|
||||
if (row && row[0] && row[1])
|
||||
{
|
||||
fprintf(md_result_file,
|
||||
"\n--\n-- Position to start replication from\n--\n\n");
|
||||
|
@ -2529,6 +2529,8 @@ bool check_grant_column (THD *thd,TABLE *table, const char *name,
|
||||
ulong want_access=table->grant.want_privilege;
|
||||
if (!want_access)
|
||||
return 0; // Already checked
|
||||
if (!grant_option)
|
||||
goto err2;
|
||||
|
||||
pthread_mutex_lock(&LOCK_grant);
|
||||
|
||||
@ -2562,6 +2564,7 @@ bool check_grant_column (THD *thd,TABLE *table, const char *name,
|
||||
/* We must use my_printf_error() here! */
|
||||
err:
|
||||
pthread_mutex_unlock(&LOCK_grant);
|
||||
err2:
|
||||
if (!show_tables)
|
||||
{
|
||||
char command[128];
|
||||
|
@ -1719,8 +1719,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
|
||||
{
|
||||
found_table=1;
|
||||
Field *find=find_field_in_table(thd,tables->table,name,length,
|
||||
grant_option &&
|
||||
tables->table->grant.want_privilege,
|
||||
test(tables->table->grant.
|
||||
want_privilege),
|
||||
1);
|
||||
if (find)
|
||||
{
|
||||
@ -1760,8 +1760,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
|
||||
for (; tables ; tables=tables->next)
|
||||
{
|
||||
Field *field=find_field_in_table(thd,tables->table,name,length,
|
||||
grant_option &&
|
||||
tables->table->grant.want_privilege,
|
||||
test(tables->table->grant.want_privilege),
|
||||
allow_rowid);
|
||||
if (field)
|
||||
{
|
||||
|
@ -2559,7 +2559,17 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
|
||||
|
||||
if ((thd->master_access & want_access) == want_access)
|
||||
{
|
||||
*save_priv=thd->master_access | thd->db_access;
|
||||
/*
|
||||
If we don't have a global SELECT privilege, we have to get the database
|
||||
specific access rights to be able to handle queries of type
|
||||
UPDATE t1 SET a=1 WHERE b > 0
|
||||
*/
|
||||
db_access= thd->db_access;
|
||||
if (!(thd->master_access & SELECT_ACL) &&
|
||||
(db && (!thd->db || strcmp(db,thd->db))))
|
||||
db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
|
||||
thd->priv_user, db); /* purecov: inspected */
|
||||
*save_priv=thd->master_access | db_access;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
if (((want_access & ~thd->master_access) & ~(DB_ACLS | EXTRA_ACL)) ||
|
||||
|
@ -223,8 +223,21 @@ user_query("update $opt_database.test set b=b+1",1);
|
||||
safe_query("grant SELECT on *.* to $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1");
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0");
|
||||
safe_query("revoke SELECT on *.* from $user");
|
||||
safe_query("grant SELECT on $opt_database.* to $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1");
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0");
|
||||
safe_query("grant UPDATE on *.* to $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1");
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0");
|
||||
safe_query("revoke UPDATE on *.* from $user");
|
||||
safe_query("revoke SELECT on $opt_database.* from $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0",1);
|
||||
user_query("update $opt_database.test set b=b+1",1);
|
||||
|
||||
# Add one privilege at a time until the user has all privileges
|
||||
user_query("select * from test",1);
|
||||
|
@ -200,8 +200,23 @@ Error in execute: SELECT command denied to user: 'grant_user@localhost' for colu
|
||||
grant SELECT on *.* to grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
revoke SELECT on *.* from grant_user@localhost
|
||||
grant SELECT on grant_test.* to grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
grant UPDATE on *.* to grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
revoke UPDATE on *.* from grant_user@localhost
|
||||
revoke SELECT on grant_test.* from grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
Error in execute: select command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
|
||||
update grant_test.test set b=b+1
|
||||
Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
|
||||
select * from test
|
||||
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test'
|
||||
grant select on grant_test.test to grant_user@localhost
|
||||
|
Reference in New Issue
Block a user