diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-12-12 13:18:46 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2023-01-02 00:04:03 +0100 |
commit | ca23558a0561856cc7f3c1ab5db4025102482380 (patch) | |
tree | 51065e23f5ad0b459c87171fa649c58ccd49af4a | |
parent | d78ac04ee609b0b63bb688be2a837a6ca7670392 (diff) | |
download | mariadb-git-ca23558a0561856cc7f3c1ab5db4025102482380.tar.gz |
--skip-name-resolve=0 didn't work
custom code in `case OPT_SKIP_RESOLVE`
was overriding the correct value from handle_options().
-rw-r--r-- | sql/mysqld.cc | 6 | ||||
-rw-r--r-- | sql/mysqld.h | 1 | ||||
-rw-r--r-- | sql/sql_acl.cc | 18 | ||||
-rw-r--r-- | sql/sql_connect.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 2 | ||||
-rw-r--r-- | sql/unireg.h | 2 |
7 files changed, 12 insertions, 21 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d58f2ed557f..b1cf5ab2796 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9484,12 +9484,6 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) case (int) OPT_SKIP_HOST_CACHE: opt_specialflag|= SPECIAL_NO_HOST_CACHE; break; - case (int) OPT_SKIP_RESOLVE: - if ((opt_skip_name_resolve= (argument != disabled_my_option))) - opt_specialflag|= SPECIAL_NO_RESOLVE; - else - opt_specialflag&= ~SPECIAL_NO_RESOLVE; - break; case (int) OPT_WANT_CORE: test_flags |= TEST_CORE_ON_SIGNAL; break; diff --git a/sql/mysqld.h b/sql/mysqld.h index d40e1d170d0..f7d0fce910f 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -680,7 +680,6 @@ enum options_mysqld OPT_SERVER_ID, OPT_SILENT, OPT_SKIP_HOST_CACHE, - OPT_SKIP_RESOLVE, OPT_SLAVE_PARALLEL_MODE, OPT_SSL_CA, OPT_SSL_CAPATH, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f4a3ab14f57..7a01da3fa76 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -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)) { diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 91a99e0aded..b4b742f6c0b 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -887,7 +887,7 @@ int thd_set_peer_addr(THD *thd, return 1; /* The error is set by my_strdup(). */ } thd->main_security_ctx.host_or_ip = thd->main_security_ctx.ip; - if (!(specialflag & SPECIAL_NO_RESOLVE)) + if (!opt_skip_name_resolve) { int rc; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cf316c8cc1c..3102aa69b86 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5248,7 +5248,7 @@ mysql_execute_command(THD *thd) List_iterator <LEX_USER> user_list(lex->users_list); while ((user= user_list++)) { - if (specialflag & SPECIAL_NO_RESOLVE && + if (opt_skip_name_resolve && hostname_requires_resolving(user->host.str)) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_HOSTNAME_WONT_WORK, diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 0e24fc56529..d5164587900 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2811,7 +2811,7 @@ static Sys_var_mybool Sys_skip_name_resolve( "skip_name_resolve", "Don't resolve hostnames. All hostnames are IP's or 'localhost'.", READ_ONLY GLOBAL_VAR(opt_skip_name_resolve), - CMD_LINE(OPT_ARG, OPT_SKIP_RESOLVE), + CMD_LINE(OPT_ARG), DEFAULT(FALSE)); static Sys_var_mybool Sys_skip_show_database( diff --git a/sql/unireg.h b/sql/unireg.h index 03d63d0fd06..3b51bc06ff4 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -67,7 +67,7 @@ #define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */ #define SPECIAL_SAME_DB_NAME 16 /* form name = file name */ #define SPECIAL_ENGLISH 32 /* English error messages */ -#define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */ +#define SPECIAL_NO_RESOLVE 64 /* Obsolete */ #define SPECIAL_NO_PRIOR 128 /* Obsolete */ #define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */ #define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */ |