Skip to content

Commit ca23558

Browse files
committed
--skip-name-resolve=0 didn't work
custom code in `case OPT_SKIP_RESOLVE` was overriding the correct value from handle_options().
1 parent d78ac04 commit ca23558

File tree

7 files changed

+12
-21
lines changed

7 files changed

+12
-21
lines changed

sql/mysqld.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9484,12 +9484,6 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
94849484
case (int) OPT_SKIP_HOST_CACHE:
94859485
opt_specialflag|= SPECIAL_NO_HOST_CACHE;
94869486
break;
9487-
case (int) OPT_SKIP_RESOLVE:
9488-
if ((opt_skip_name_resolve= (argument != disabled_my_option)))
9489-
opt_specialflag|= SPECIAL_NO_RESOLVE;
9490-
else
9491-
opt_specialflag&= ~SPECIAL_NO_RESOLVE;
9492-
break;
94939487
case (int) OPT_WANT_CORE:
94949488
test_flags |= TEST_CORE_ON_SIGNAL;
94959489
break;

sql/mysqld.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,6 @@ enum options_mysqld
680680
OPT_SERVER_ID,
681681
OPT_SILENT,
682682
OPT_SKIP_HOST_CACHE,
683-
OPT_SKIP_RESOLVE,
684683
OPT_SLAVE_PARALLEL_MODE,
685684
OPT_SSL_CA,
686685
OPT_SSL_CAPATH,

sql/sql_acl.cc

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ class ACL_PROXY_USER :public ACL_ACCESS
315315
update_hostname(&host, safe_strdup_root(mem, host_arg));
316316
}
317317

318-
bool check_validity(bool check_no_resolve)
318+
bool check_validity()
319319
{
320-
if (check_no_resolve &&
320+
if (opt_skip_name_resolve &&
321321
(hostname_requires_resolving(host.hostname) ||
322322
hostname_requires_resolving(proxied_host.hostname)))
323323
{
@@ -1781,7 +1781,6 @@ static bool set_user_plugin (ACL_USER *user, size_t password_len)
17811781
static bool acl_load(THD *thd, const Grant_tables& tables)
17821782
{
17831783
READ_RECORD read_record_info;
1784-
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
17851784
char tmp_name[SAFE_NAME_LEN+1];
17861785
int password_length;
17871786
Sql_mode_save old_mode_save(thd);
@@ -1825,7 +1824,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
18251824
host.access= host_table.get_access();
18261825
host.access= fix_rights_for_db(host.access);
18271826
host.sort= get_sort(2, host.host.hostname, host.db);
1828-
if (check_no_resolve && hostname_requires_resolving(host.host.hostname))
1827+
if (opt_skip_name_resolve && hostname_requires_resolving(host.host.hostname))
18291828
{
18301829
sql_print_warning("'host' entry '%s|%s' "
18311830
"ignored in --skip-name-resolve mode.",
@@ -1929,7 +1928,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
19291928
continue;
19301929
}
19311930

1932-
if (!is_role && check_no_resolve &&
1931+
if (!is_role && opt_skip_name_resolve &&
19331932
hostname_requires_resolving(user.host.hostname))
19341933
{
19351934
sql_print_warning("'user' entry '%s@%s' "
@@ -2105,7 +2104,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
21052104
sql_print_warning("Found an entry in the 'db' table with empty database name; Skipped");
21062105
continue;
21072106
}
2108-
if (check_no_resolve && hostname_requires_resolving(db.host.hostname))
2107+
if (opt_skip_name_resolve && hostname_requires_resolving(db.host.hostname))
21092108
{
21102109
sql_print_warning("'db' entry '%s %s@%s' "
21112110
"ignored in --skip-name-resolve mode.",
@@ -2160,7 +2159,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
21602159
{
21612160
ACL_PROXY_USER proxy;
21622161
proxy.init(proxies_priv_table, &acl_memroot);
2163-
if (proxy.check_validity(check_no_resolve))
2162+
if (proxy.check_validity())
21642163
continue;
21652164
if (push_dynamic(&acl_proxy_users, (uchar*) &proxy))
21662165
DBUG_RETURN(TRUE);
@@ -7348,7 +7347,6 @@ static bool grant_load(THD *thd,
73487347
{
73497348
bool return_val= 1;
73507349
TABLE *t_table, *c_table, *p_table;
7351-
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
73527350
MEM_ROOT *save_mem_root= thd->mem_root;
73537351
sql_mode_t old_sql_mode= thd->variables.sql_mode;
73547352
DBUG_ENTER("grant_load");
@@ -7392,7 +7390,7 @@ static bool grant_load(THD *thd,
73927390
goto end_unlock;
73937391
}
73947392

7395-
if (check_no_resolve)
7393+
if (opt_skip_name_resolve)
73967394
{
73977395
if (hostname_requires_resolving(mem_check->host.hostname))
73987396
{
@@ -7437,7 +7435,7 @@ static bool grant_load(THD *thd,
74377435
goto end_unlock_p;
74387436
}
74397437

7440-
if (check_no_resolve)
7438+
if (opt_skip_name_resolve)
74417439
{
74427440
if (hostname_requires_resolving(mem_check->host.hostname))
74437441
{

sql/sql_connect.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ int thd_set_peer_addr(THD *thd,
887887
return 1; /* The error is set by my_strdup(). */
888888
}
889889
thd->main_security_ctx.host_or_ip = thd->main_security_ctx.ip;
890-
if (!(specialflag & SPECIAL_NO_RESOLVE))
890+
if (!opt_skip_name_resolve)
891891
{
892892
int rc;
893893

sql/sql_parse.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5248,7 +5248,7 @@ mysql_execute_command(THD *thd)
52485248
List_iterator <LEX_USER> user_list(lex->users_list);
52495249
while ((user= user_list++))
52505250
{
5251-
if (specialflag & SPECIAL_NO_RESOLVE &&
5251+
if (opt_skip_name_resolve &&
52525252
hostname_requires_resolving(user->host.str))
52535253
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
52545254
ER_WARN_HOSTNAME_WONT_WORK,

sql/sys_vars.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2811,7 +2811,7 @@ static Sys_var_mybool Sys_skip_name_resolve(
28112811
"skip_name_resolve",
28122812
"Don't resolve hostnames. All hostnames are IP's or 'localhost'.",
28132813
READ_ONLY GLOBAL_VAR(opt_skip_name_resolve),
2814-
CMD_LINE(OPT_ARG, OPT_SKIP_RESOLVE),
2814+
CMD_LINE(OPT_ARG),
28152815
DEFAULT(FALSE));
28162816

28172817
static Sys_var_mybool Sys_skip_show_database(

sql/unireg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */
6868
#define SPECIAL_SAME_DB_NAME 16 /* form name = file name */
6969
#define SPECIAL_ENGLISH 32 /* English error messages */
70-
#define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */
70+
#define SPECIAL_NO_RESOLVE 64 /* Obsolete */
7171
#define SPECIAL_NO_PRIOR 128 /* Obsolete */
7272
#define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */
7373
#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */

0 commit comments

Comments
 (0)