mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01: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:
parent
d78ac04ee6
commit
ca23558a05
7 changed files with 12 additions and 21 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue