1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge branch '11.4' into 11.5

This commit is contained in:
Oleksandr Byelkin
2024-05-23 17:01:43 +02:00
1470 changed files with 43538 additions and 14960 deletions

View File

@ -1071,6 +1071,9 @@ class User_table_tabular: public User_table
if (access & REPL_SLAVE_ACL)
access|= SLAVE_MONITOR_ACL;
if ((access & ALL_KNOWN_ACL_100304) == ALL_KNOWN_ACL_100304)
access|= SHOW_CREATE_ROUTINE_ACL;
return access & GLOBAL_ACLS;
}
@ -1584,6 +1587,11 @@ class User_table_json: public User_table
print_warning_bad_access(version_id, mask, orig_access);
return NO_ACL;
}
// ALL PRIVILEGES always means ALL PRIVILEGES
if ((orig_access & mask) == mask)
access= ALL_KNOWN_ACL;
return access & ALL_KNOWN_ACL;
}
@ -2807,6 +2815,9 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
db.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
}
#endif
if (db_table.num_fields() <= 23)
if ((db.access | SHOW_CREATE_ROUTINE_ACL | GRANT_ACL) == DB_ACLS)
db.access|= SHOW_CREATE_ROUTINE_ACL;
acl_dbs.push(db);
}
end_read_record(&read_record_info);
@ -2970,6 +2981,7 @@ bool acl_reload(THD *thd)
}
acl_cache->clear(0);
mysql_mutex_record_order(&acl_cache->lock, &LOCK_status);
mysql_mutex_lock(&acl_cache->lock);
old_acl_hosts= acl_hosts;
@ -5102,6 +5114,9 @@ static int replace_db_table(TABLE *table, const char *db,
}
rights=get_access(table,3);
rights=fix_rights_for_db(rights);
if (table->s->fields <= 23)
if ((rights | SHOW_CREATE_ROUTINE_ACL | GRANT_ACL) == DB_ACLS)
rights|= SHOW_CREATE_ROUTINE_ACL;
if (old_row_exists)
{
@ -7688,7 +7703,7 @@ static bool can_grant_role(THD *thd, ACL_ROLE *role)
{
Security_context *sctx= thd->security_ctx;
if (!sctx->user) // replication
if (!sctx->is_user_defined()) // galera
return true;
ACL_USER *grantee= find_user_exact(Lex_cstring_strlen(sctx->priv_host),
@ -13419,8 +13434,27 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
*end++= 0;
int2store(end, thd->client_capabilities);
CHARSET_INFO *handshake_cs= default_charset_info;
if (handshake_cs->number > 0xFF)
{
/*
A workaround for a 2-byte collation ID: translate it into
the ID of the primary collation of this character set.
*/
CHARSET_INFO *cs= get_charset_by_csname(handshake_cs->cs_name.str,
MY_CS_PRIMARY, MYF(MY_WME));
/*
cs should not normally be NULL, however it may be possible
with a dynamic character set incorrectly defined in Index.xml.
For safety let's fallback to latin1 in case cs is NULL.
*/
handshake_cs= cs ? cs : &my_charset_latin1;
}
/* write server characteristics: up to 16 bytes allowed */
end[2]= (char) default_charset_info->number;
end[2]= (char) handshake_cs->number;
int2store(end+3, mpvio->auth_info.thd->server_status);
int2store(end+5, thd->client_capabilities >> 16);
end[7]= data_len;