MCPcopy Create free account
hub / github.com/Tencent/phxsql / acl_init

Function acl_init

phx_percona/percona/sql/sql_acl.cc:766–811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

764*/
765
766my_bool acl_init(bool dont_read_acl_tables)
767{
768 THD *thd;
769 my_bool return_val;
770 DBUG_ENTER("acl_init");
771
772 acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
773 (my_hash_get_key) acl_entry_get_key,
774 (my_hash_free_key) free,
775 &my_charset_utf8_bin);
776
777 /*
778 cache built-in native authentication plugins,
779 to avoid hash searches and a global mutex lock on every connect
780 */
781 native_password_plugin= my_plugin_lock_by_name(0,
782 &native_password_plugin_name, MYSQL_AUTHENTICATION_PLUGIN);
783 old_password_plugin= my_plugin_lock_by_name(0,
784 &old_password_plugin_name, MYSQL_AUTHENTICATION_PLUGIN);
785
786 if (!native_password_plugin || !old_password_plugin)
787 DBUG_RETURN(1);
788
789 if (dont_read_acl_tables)
790 {
791 DBUG_RETURN(0); /* purecov: tested */
792 }
793
794 /*
795 To be able to run this from boot, we allocate a temporary THD
796 */
797 if (!(thd=new THD))
798 DBUG_RETURN(1); /* purecov: inspected */
799 thd->thread_stack= (char*) &thd;
800 thd->store_globals();
801 /*
802 It is safe to call acl_reload() since acl_* arrays and hashes which
803 will be freed there are global static objects and thus are initialized
804 by zeros at startup.
805 */
806 return_val= acl_reload(thd);
807 delete thd;
808 /* Remember that we don't have a THD */
809 my_pthread_setspecific_ptr(THR_THD, 0);
810 DBUG_RETURN(return_val);
811}
812
813/*
814 Initialize structures responsible for user/db-level privilege checking

Callers 1

mysqld_mainFunction · 0.85

Calls 1

acl_reloadFunction · 0.85

Tested by

no test coverage detected