1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

--skip-name-resolve=0 didn't work

custom code in `case OPT_SKIP_RESOLVE`
was overriding the correct value from handle_options().
This commit is contained in:
Sergei Golubchik
2022-12-12 13:18:46 +01:00
parent d78ac04ee6
commit ca23558a05
7 changed files with 12 additions and 21 deletions

View File

@ -315,9 +315,9 @@ public:
update_hostname(&host, safe_strdup_root(mem, host_arg));
}
bool check_validity(bool check_no_resolve)
bool check_validity()
{
if (check_no_resolve &&
if (opt_skip_name_resolve &&
(hostname_requires_resolving(host.hostname) ||
hostname_requires_resolving(proxied_host.hostname)))
{
@ -1781,7 +1781,6 @@ static bool set_user_plugin (ACL_USER *user, size_t password_len)
static bool acl_load(THD *thd, const Grant_tables& tables)
{
READ_RECORD read_record_info;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
char tmp_name[SAFE_NAME_LEN+1];
int password_length;
Sql_mode_save old_mode_save(thd);
@ -1825,7 +1824,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
host.access= host_table.get_access();
host.access= fix_rights_for_db(host.access);
host.sort= get_sort(2, host.host.hostname, host.db);
if (check_no_resolve && hostname_requires_resolving(host.host.hostname))
if (opt_skip_name_resolve && hostname_requires_resolving(host.host.hostname))
{
sql_print_warning("'host' entry '%s|%s' "
"ignored in --skip-name-resolve mode.",
@ -1929,7 +1928,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
continue;
}
if (!is_role && check_no_resolve &&
if (!is_role && opt_skip_name_resolve &&
hostname_requires_resolving(user.host.hostname))
{
sql_print_warning("'user' entry '%s@%s' "
@ -2105,7 +2104,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
sql_print_warning("Found an entry in the 'db' table with empty database name; Skipped");
continue;
}
if (check_no_resolve && hostname_requires_resolving(db.host.hostname))
if (opt_skip_name_resolve && hostname_requires_resolving(db.host.hostname))
{
sql_print_warning("'db' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.",
@ -2160,7 +2159,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
{
ACL_PROXY_USER proxy;
proxy.init(proxies_priv_table, &acl_memroot);
if (proxy.check_validity(check_no_resolve))
if (proxy.check_validity())
continue;
if (push_dynamic(&acl_proxy_users, (uchar*) &proxy))
DBUG_RETURN(TRUE);
@ -7348,7 +7347,6 @@ static bool grant_load(THD *thd,
{
bool return_val= 1;
TABLE *t_table, *c_table, *p_table;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
MEM_ROOT *save_mem_root= thd->mem_root;
sql_mode_t old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("grant_load");
@ -7392,7 +7390,7 @@ static bool grant_load(THD *thd,
goto end_unlock;
}
if (check_no_resolve)
if (opt_skip_name_resolve)
{
if (hostname_requires_resolving(mem_check->host.hostname))
{
@ -7437,7 +7435,7 @@ static bool grant_load(THD *thd,
goto end_unlock_p;
}
if (check_no_resolve)
if (opt_skip_name_resolve)
{
if (hostname_requires_resolving(mem_check->host.hostname))
{