resolv: Remove processing of unimplemented "spoof" host.conf options

This commit is contained in:
Florian Weimer 2016-12-27 16:01:06 +01:00
parent 5c6e674735
commit 7d68cdaa4f
3 changed files with 9 additions and 38 deletions

View File

@ -1,3 +1,12 @@
2016-12-27 Florian Weimer <fweimer@redhat.com>
* resolv/res_hconf.h (HCONF_FLAG_SPOOF, HCONF_FLAG_SPOOFALERT):
Remove.
* resolv/res_hconf.c (ENV_SPOOF, arg_spoof): Remove.
(cmd): Remove spoof, nospoof, spoofalert.
(parse_line): Ignore spoof-related lines.
(do_init): Do not process RESOLV_SPOOF_CHECK.
2016-12-27 Florian Weimer <fweimer@redhat.com> 2016-12-27 Florian Weimer <fweimer@redhat.com>
[BZ #20964] [BZ #20964]

View File

@ -21,9 +21,6 @@
Though mostly compatibly, the following differences exist compared Though mostly compatibly, the following differences exist compared
to the original implementation: to the original implementation:
- new command "spoof" takes an arguments like RESOLV_SPOOF_CHECK
environment variable (i.e., `off', `nowarn', or `warn').
- line comments can appear anywhere (not just at the beginning of - line comments can appear anywhere (not just at the beginning of
a line) a line)
*/ */
@ -55,7 +52,6 @@
/* Environment vars that all user to override default behavior: */ /* Environment vars that all user to override default behavior: */
#define ENV_HOSTCONF "RESOLV_HOST_CONF" #define ENV_HOSTCONF "RESOLV_HOST_CONF"
#define ENV_SPOOF "RESOLV_SPOOF_CHECK"
#define ENV_TRIM_OVERR "RESOLV_OVERRIDE_TRIM_DOMAINS" #define ENV_TRIM_OVERR "RESOLV_OVERRIDE_TRIM_DOMAINS"
#define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS" #define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS"
#define ENV_MULTI "RESOLV_MULTI" #define ENV_MULTI "RESOLV_MULTI"
@ -65,7 +61,6 @@ enum parse_cbs
{ {
CB_none, CB_none,
CB_arg_trimdomain_list, CB_arg_trimdomain_list,
CB_arg_spoof,
CB_arg_bool CB_arg_bool
}; };
@ -78,10 +73,7 @@ static const struct cmd
{ {
{"order", CB_none, 0}, {"order", CB_none, 0},
{"trim", CB_arg_trimdomain_list, 0}, {"trim", CB_arg_trimdomain_list, 0},
{"spoof", CB_arg_spoof, 0},
{"multi", CB_arg_bool, HCONF_FLAG_MULTI}, {"multi", CB_arg_bool, HCONF_FLAG_MULTI},
{"nospoof", CB_arg_bool, HCONF_FLAG_SPOOF},
{"spoofalert", CB_arg_bool, HCONF_FLAG_SPOOFALERT},
{"reorder", CB_arg_bool, HCONF_FLAG_REORDER} {"reorder", CB_arg_bool, HCONF_FLAG_REORDER}
}; };
@ -163,28 +155,6 @@ arg_trimdomain_list (const char *fname, int line_num, const char *args)
} }
static const char *
arg_spoof (const char *fname, int line_num, const char *args)
{
const char *start = args;
size_t len;
args = skip_string (args);
len = args - start;
if (len == 3 && __strncasecmp (start, "off", len) == 0)
_res_hconf.flags &= ~(HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT);
else
{
_res_hconf.flags |= (HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT);
if ((len == 6 && __strncasecmp (start, "nowarn", len) == 0)
|| !(len == 4 && __strncasecmp (start, "warn", len) == 0))
_res_hconf.flags &= ~HCONF_FLAG_SPOOFALERT;
}
return args;
}
static const char * static const char *
arg_bool (const char *fname, int line_num, const char *args, unsigned flag) arg_bool (const char *fname, int line_num, const char *args, unsigned flag)
{ {
@ -261,8 +231,6 @@ parse_line (const char *fname, int line_num, const char *str)
if (c->cb == CB_arg_trimdomain_list) if (c->cb == CB_arg_trimdomain_list)
str = arg_trimdomain_list (fname, line_num, str); str = arg_trimdomain_list (fname, line_num, str);
else if (c->cb == CB_arg_spoof)
str = arg_spoof (fname, line_num, str);
else if (c->cb == CB_arg_bool) else if (c->cb == CB_arg_bool)
str = arg_bool (fname, line_num, str, c->arg); str = arg_bool (fname, line_num, str, c->arg);
else else
@ -325,10 +293,6 @@ do_init (void)
fclose (fp); fclose (fp);
} }
envval = getenv (ENV_SPOOF);
if (envval)
arg_spoof (ENV_SPOOF, 1, envval);
envval = getenv (ENV_MULTI); envval = getenv (ENV_MULTI);
if (envval) if (envval)
arg_bool (ENV_MULTI, 1, envval, HCONF_FLAG_MULTI); arg_bool (ENV_MULTI, 1, envval, HCONF_FLAG_MULTI);

View File

@ -41,8 +41,6 @@ struct hconf
const char *trimdomain[TRIMDOMAINS_MAX]; const char *trimdomain[TRIMDOMAINS_MAX];
unsigned int flags; unsigned int flags;
# define HCONF_FLAG_INITED (1 << 0) /* initialized? */ # define HCONF_FLAG_INITED (1 << 0) /* initialized? */
# define HCONF_FLAG_SPOOF (1 << 1) /* refuse spoofed addresses */
# define HCONF_FLAG_SPOOFALERT (1 << 2) /* syslog warning of spoofed */
# define HCONF_FLAG_REORDER (1 << 3) /* list best address first */ # define HCONF_FLAG_REORDER (1 << 3) /* list best address first */
# define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */ # define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */
}; };