Updates the acl_roles_mappings hash @param user user name of the grantee @param host host name of the grantee @param role role name to grant @param with_admin WITH ADMIN OPTION flag @param existing the entry in the acl_roles_mappings hash or NULL. it is never NULL if revoke_grant is true. it is NULL
| 5355 | @param revoke_grant true for REVOKE, false for GRANT |
| 5356 | */ |
| 5357 | static int |
| 5358 | update_role_mapping(LEX_CSTRING *user, LEX_CSTRING *host, LEX_CSTRING *role, |
| 5359 | bool with_admin, ROLE_GRANT_PAIR *existing, bool revoke_grant) |
| 5360 | { |
| 5361 | if (revoke_grant) |
| 5362 | { |
| 5363 | if (with_admin) |
| 5364 | { |
| 5365 | existing->with_admin= false; |
| 5366 | return 0; |
| 5367 | } |
| 5368 | return my_hash_delete(&acl_roles_mappings, (uchar*)existing); |
| 5369 | } |
| 5370 | |
| 5371 | if (existing) |
| 5372 | { |
| 5373 | existing->with_admin|= with_admin; |
| 5374 | return 0; |
| 5375 | } |
| 5376 | |
| 5377 | mysql_mutex_assert_owner(&acl_cache->lock); |
| 5378 | /* allocate a new entry that will go in the hash */ |
| 5379 | ROLE_GRANT_PAIR *hash_entry= new (&acl_memroot) ROLE_GRANT_PAIR; |
| 5380 | if (hash_entry->init(&acl_memroot, *user, *host, *role, with_admin)) |
| 5381 | return 1; |
| 5382 | return my_hash_insert(&acl_roles_mappings, (uchar*) hash_entry); |
| 5383 | } |
| 5384 | |
| 5385 | static void |
| 5386 | acl_update_proxy_user(ACL_PROXY_USER *new_value, bool is_revoke) |
no test coverage detected