| 2577 | */ |
| 2578 | |
| 2579 | bool acl_init(bool dont_read_acl_tables) |
| 2580 | { |
| 2581 | THD *thd; |
| 2582 | bool return_val; |
| 2583 | DBUG_ENTER("acl_init"); |
| 2584 | |
| 2585 | acl_cache= new Hash_filo<acl_entry>(key_memory_acl_cache, ACL_CACHE_SIZE, 0, |
| 2586 | 0, acl_entry_get_key, my_free, |
| 2587 | &my_charset_utf8mb3_bin); |
| 2588 | |
| 2589 | /* |
| 2590 | cache built-in native authentication plugins, |
| 2591 | to avoid hash searches and a global mutex lock on every connect |
| 2592 | */ |
| 2593 | native_password_plugin= my_plugin_lock_by_name(0, |
| 2594 | &native_password_plugin_name, MYSQL_AUTHENTICATION_PLUGIN); |
| 2595 | old_password_plugin= my_plugin_lock_by_name(0, |
| 2596 | &old_password_plugin_name, MYSQL_AUTHENTICATION_PLUGIN); |
| 2597 | |
| 2598 | if (!native_password_plugin || !old_password_plugin) |
| 2599 | DBUG_RETURN(1); |
| 2600 | |
| 2601 | if (dont_read_acl_tables) |
| 2602 | { |
| 2603 | DBUG_RETURN(0); /* purecov: tested */ |
| 2604 | } |
| 2605 | |
| 2606 | /* |
| 2607 | To be able to run this from boot, we allocate a temporary THD |
| 2608 | */ |
| 2609 | if (!(thd=new THD(0))) |
| 2610 | DBUG_RETURN(1); /* purecov: inspected */ |
| 2611 | thd->store_globals(); |
| 2612 | thd->set_query_inner((char*) STRING_WITH_LEN("intern:acl_init"), |
| 2613 | default_charset_info); |
| 2614 | /* |
| 2615 | It is safe to call acl_reload() since acl_* arrays and hashes which |
| 2616 | will be freed there are global static objects and thus are initialized |
| 2617 | by zeros at startup. |
| 2618 | */ |
| 2619 | return_val= acl_reload(thd); |
| 2620 | delete thd; |
| 2621 | DBUG_RETURN(return_val); |
| 2622 | } |
| 2623 | |
| 2624 | static void push_new_user(const ACL_USER &user) |
| 2625 | { |
no test coverage detected