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

Function acl_insert_user

phx_percona/percona/sql/sql_acl.cc:1990–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1988
1989
1990static void acl_insert_user(const char *user, const char *host,
1991 const char *password, uint password_len,
1992 enum SSL_type ssl_type,
1993 const char *ssl_cipher,
1994 const char *x509_issuer,
1995 const char *x509_subject,
1996 USER_RESOURCES *mqh,
1997 ulong privileges,
1998 const LEX_STRING *plugin,
1999 const LEX_STRING *auth)
2000{
2001 DBUG_ENTER("acl_insert_user");
2002 ACL_USER acl_user;
2003 int hash_not_ok;
2004
2005 mysql_mutex_assert_owner(&acl_cache->lock);
2006 /*
2007 All accounts can authenticate per default. This will change when
2008 we add a new field to the user table.
2009
2010 Currently this flag is only set to false when authentication is attempted
2011 using an unknown user name.
2012 */
2013 acl_user.can_authenticate= true;
2014
2015 acl_user.user= *user ? strdup_root(&global_acl_memory,user) : 0;
2016 acl_user.host.update_hostname(*host ? strdup_root(&global_acl_memory, host) : 0);
2017 if (plugin->str[0])
2018 {
2019 acl_user.plugin= *plugin;
2020 optimize_plugin_compare_by_pointer(&acl_user.plugin);
2021 if (!auth_plugin_is_built_in(acl_user.plugin.str))
2022 acl_user.plugin.str= strmake_root(&global_acl_memory, plugin->str, plugin->length);
2023 acl_user.auth_string.str= auth->str ?
2024 strmake_root(&global_acl_memory, auth->str,
2025 auth->length) : const_cast<char*>("");
2026 acl_user.auth_string.length= auth->length;
2027
2028 optimize_plugin_compare_by_pointer(&acl_user.plugin);
2029 }
2030 else
2031 {
2032 acl_user.plugin= password_len == SCRAMBLED_PASSWORD_CHAR_LENGTH_323 ?
2033 old_password_plugin_name : native_password_plugin_name;
2034 acl_user.auth_string.str= const_cast<char*>("");
2035 acl_user.auth_string.length= 0;
2036 }
2037
2038 acl_user.access= privileges;
2039 acl_user.user_resource= *mqh;
2040 acl_user.sort= get_sort(2,acl_user.host.get_host(), acl_user.user);
2041 //acl_user.hostname_length=(uint) strlen(host);
2042 acl_user.ssl_type=
2043 (ssl_type != SSL_TYPE_NOT_SPECIFIED ? ssl_type : SSL_TYPE_NONE);
2044 acl_user.ssl_cipher=
2045 ssl_cipher ? strdup_root(&global_acl_memory, ssl_cipher) : 0;
2046 acl_user.x509_issuer=
2047 x509_issuer ? strdup_root(&global_acl_memory, x509_issuer) : 0;

Callers 1

replace_user_tableFunction · 0.85

Calls 7

get_sortFunction · 0.85
set_user_saltFunction · 0.85
rebuild_check_hostFunction · 0.85
update_hostnameMethod · 0.80
get_hostMethod · 0.80
check_allow_all_hostsMethod · 0.80

Tested by

no test coverage detected