@@ -10043,7 +10043,7 @@ static bool check_grant_db_routine(THD *thd, const char *db, HASH *hash)
1004310043 strcmp(item->db, db) == 0 &&
1004410044 (!item->host.hostname || !item->host.hostname[0]))
1004510045 {
10046- if (item->init_privs .certainly_allowed(ALL_KNOWN_ACL))
10046+ if (item->privs .certainly_allowed(ALL_KNOWN_ACL))
1004710047 return FALSE; /* Found current role match */
1004810048 }
1004910049 }
@@ -10089,14 +10089,20 @@ static bool has_some_table_privs(GRANT_TABLE *grant_table)
1008910089 Return 1 if access is denied
1009010090*/
1009110091
10092- bool check_grant_db(THD *thd, const char *db)
10092+ bool check_grant_db(THD *thd, const access_t &access, const char *db)
1009310093{
1009410094 Security_context *sctx= thd->security_ctx;
1009510095 constexpr size_t key_data_size= SAFE_NAME_LEN + USERNAME_LENGTH + 1;
1009610096 // See earlier comments on MY_CS_MBMAXLEN above
1009710097 CharBuffer<key_data_size + MY_CS_MBMAXLEN> key, key2;
1009810098 bool error= TRUE;
1009910099
10100+ if (access.is_denied_all(TABLE_ACLS|PROC_ACLS))
10101+ return 1; // all table and routine privileges are denied
10102+
10103+ if (access & (TABLE_ACLS | PROC_ACLS))
10104+ return 0; // some table or routine privileges are allowed
10105+
1010010106 key.append(Lex_cstring_strlen(sctx->priv_user)).append_char('\0')
1010110107 .append_opt_casedn(files_charset_info, Lex_cstring_strlen(db),
1010210108 lower_case_table_names)
0 commit comments