From patchwork Tue Dec 27 16:05:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 709023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tp11R3JvWz9sxS for ; Wed, 28 Dec 2016 03:05:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ncoBM4/U"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= LM/+oWKCqYKusiqjjX1kqRwEpQeNnGpCpdOXtmLVlf2UGw30gxUWrnIJ88EMff2s clzD5c8HQH77Z4bOGaqXT0ZK8fIqCHI3TrLuevhGXkHKjfKM0ul53nUCgOXu7tkG YFMdE5eKDXMSZn+7b2nB+2wAt9rXSPOKfcuTorxabVs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=dVUgBO 7pJrpMImS4S58KuWEmNEU=; b=ncoBM4/U9s5uhODveu8ZtOKD7Q9ZuCPri0kPW/ 7IgqcNCynXPi/j3uw6H+VD3cflQFdfkRkScCWQ7FkgQ3RqnaxRBGZWNkk87WbZDG Rsb5dgeXoT9IFOi2LdlUAVghc7A9NLDub74DJTUO5ePnDgGkGWYbkANTov+4JaMh Tl+wQ= Received: (qmail 126281 invoked by alias); 27 Dec 2016 16:05:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 126268 invoked by uid 89); 27 Dec 2016 16:05:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=multi, envval, refuse, UD:conf X-HELO: mx1.redhat.com Date: Tue, 27 Dec 2016 17:05:36 +0100 To: libc-alpha@sourceware.org Subject: [PATCH COMMITTED] resolv: Remove processing of unimplemented "spoof" host.conf options User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20161227160536.841CC4292DF1A@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) 2016-12-27 Florian Weimer * 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. diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c index 093c268..0021fa6 100644 --- a/resolv/res_hconf.c +++ b/resolv/res_hconf.c @@ -21,9 +21,6 @@ Though mostly compatibly, the following differences exist compared 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 a line) */ @@ -55,7 +52,6 @@ /* Environment vars that all user to override default behavior: */ #define ENV_HOSTCONF "RESOLV_HOST_CONF" -#define ENV_SPOOF "RESOLV_SPOOF_CHECK" #define ENV_TRIM_OVERR "RESOLV_OVERRIDE_TRIM_DOMAINS" #define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS" #define ENV_MULTI "RESOLV_MULTI" @@ -65,7 +61,6 @@ enum parse_cbs { CB_none, CB_arg_trimdomain_list, - CB_arg_spoof, CB_arg_bool }; @@ -78,10 +73,7 @@ static const struct cmd { {"order", CB_none, 0}, {"trim", CB_arg_trimdomain_list, 0}, - {"spoof", CB_arg_spoof, 0}, {"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} }; @@ -164,28 +156,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 * arg_bool (const char *fname, int line_num, const char *args, unsigned flag) { if (__strncasecmp (args, "on", 2) == 0) @@ -261,8 +231,6 @@ parse_line (const char *fname, int line_num, const char *str) if (c->cb == CB_arg_trimdomain_list) 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) str = arg_bool (fname, line_num, str, c->arg); else @@ -325,10 +293,6 @@ do_init (void) fclose (fp); } - envval = getenv (ENV_SPOOF); - if (envval) - arg_spoof (ENV_SPOOF, 1, envval); - envval = getenv (ENV_MULTI); if (envval) arg_bool (ENV_MULTI, 1, envval, HCONF_FLAG_MULTI); diff --git a/resolv/res_hconf.h b/resolv/res_hconf.h index a3d23f3..a6a1a9b 100644 --- a/resolv/res_hconf.h +++ b/resolv/res_hconf.h @@ -41,8 +41,6 @@ struct hconf const char *trimdomain[TRIMDOMAINS_MAX]; unsigned int flags; # 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_MULTI (1 << 4) /* see comments for gethtbyname() */ };