diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-07-29 21:57:06 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-07-29 21:58:38 +0200 |
commit | 8ea529ecbaf63213ef2097f7a1abeac4ae3dd481 (patch) | |
tree | 74dac9e832dda743bd7d0d8f28b7ac3ad611c2c0 /sql/sql_acl.cc | |
parent | 6c7e3e5c13162b7ffa90eaa81b4ba5afaf3e0c1e (diff) | |
download | mariadb-git-8ea529ecbaf63213ef2097f7a1abeac4ae3dd481.tar.gz |
MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping
if mysql.roles_mapping table doesn't exist (it's optional, after all),
we still update in-memory structures to keep them consistent
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 07d77d28753..3a605f8e7b7 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10153,24 +10153,21 @@ static int handle_grant_data(THD *thd, Grant_tables& tables, bool drop, } /* Handle roles_mapping table. */ - if (tables.roles_mapping_table().table_exists()) + if (tables.roles_mapping_table().table_exists() && + (found= handle_grant_table(thd, tables.roles_mapping_table(), + ROLES_MAPPING_TABLE, drop, user_from, user_to)) < 0) { - if ((found= handle_grant_table(thd, tables.roles_mapping_table(), - ROLES_MAPPING_TABLE, drop, - user_from, user_to)) < 0) - { - /* Handle of table failed, don't touch the in-memory array. */ - result= -1; - } - else - { - /* Handle acl_roles_mappings array */ - if ((handle_grant_struct(ROLES_MAPPINGS_HASH, drop, user_from, user_to) || found) - && ! result) - result= 1; /* At least one record/element found */ - if (search_only) - goto end; - } + /* Handle of table failed, don't touch the in-memory array. */ + result= -1; + } + else + { + /* Handle acl_roles_mappings array */ + if ((handle_grant_struct(ROLES_MAPPINGS_HASH, drop, user_from, user_to) || found) + && ! result) + result= 1; /* At least one record/element found */ + if (search_only) + goto end; } /* Handle user table. */ |