Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3626940ybk; Tue, 19 May 2020 09:07:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZAS5mLkHWHnCaVb41N1evVvQAQIOx+Tg79nR0LXPazkyPoa5/voamK88JKcX0FG4maBD1 X-Received: by 2002:a05:6402:31ad:: with SMTP id dj13mr18942124edb.232.1589904478939; Tue, 19 May 2020 09:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589904478; cv=none; d=google.com; s=arc-20160816; b=WTI6bCM7+gW5p5yvJdmIXPfOqoq7O81KLkGACT9wNR7vuP0VEO9NgX/ZOYMJmjmMWy MZxUyujS0hf75o8lCoxZxe3OnqjGxAFaAJuazyRpfFxl9tDyn1PNg4qBT8qh+zzrIMs8 8hf03xHZF8znMM7RVw7V6e/+9V07nbwoP1gC5XRSU8Uo6FbtTa4XBiYHgZl5F2nyNBVF C0yNiaziXktSQjdvNzfAfxDMFXswlPLS0sSRXijMCGa2lZ3+Ps9zy6lcFjHbp20Dceos EVbom6VeC9COwWX0ywXoRhkRweaVj3lJxG9hrbHhYvSuz+lofbxlHveFgYFaUJUdbdC9 nk7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=T+1wIgatcNw+bs4bC4UVA93HHDhP2YXSs8RVpPtE368=; b=bTsyPEiAhHLfaGkjtFTWFnj/X8WXrDfEflUFswqSQOcEvfdNom5ItepDpjbJ+OZw73 o5L3AhkU1wxWu4uEMBhkBC05aCspQ30e4jEB2YB5sJI420gA98MrMEoQbImAOSB2BSvJ RWapgg9UUztNQHPZSJdGYR4TfB37iwWbMb4Ywwg1nHPnpXDcH3srJEJ+N8ar+Tzxxvqk rWxAvVrr/56XKXm7A/qxdPGKOjwfYtVoyvipR3B0Cl/N2SvJL4pyusGEh0Mvom4rM95Z YQCyVg8VdYYmdy1JKD0UZPhY3kT/6zADHdeFUPH87UwiyGciflDNaN59IMsHTRBvfQLG jtNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c6P3Mmym; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl22si148171ejb.297.2020.05.19.09.07.28; Tue, 19 May 2020 09:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c6P3Mmym; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729328AbgESQHD (ORCPT + 99 others); Tue, 19 May 2020 12:07:03 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43246 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729316AbgESQHD (ORCPT ); Tue, 19 May 2020 12:07:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589904421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T+1wIgatcNw+bs4bC4UVA93HHDhP2YXSs8RVpPtE368=; b=c6P3MmymPM42wThTkKOWdNV88ZKCpRxZ9tCG3nvr72but/kZBxT8WStDQ/4JljpUpSOESc sBUuyTx0EU89jB3+L6+3ZZOTfrn17Hqe5zt8Ya8QC7u1+Aqi/N4L1VHxs700aTl1i+DQn1 cZSH3/PMofJXFm3h+RHWxsMTDsw8Gls= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-214-KfD76cAVOHCMJEdCOgDVPQ-1; Tue, 19 May 2020 12:06:57 -0400 X-MC-Unique: KfD76cAVOHCMJEdCOgDVPQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 350021005510; Tue, 19 May 2020 16:06:55 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-95.rdu2.redhat.com [10.10.112.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7730F5D9C5; Tue, 19 May 2020 16:06:53 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20200519141432.GA2949457@erythro.dev.benboeckel.internal> References: <20200519141432.GA2949457@erythro.dev.benboeckel.internal> <20200518155148.GA2595638@erythro.dev.benboeckel.internal> <158981176590.872823.11683683537698750702.stgit@warthog.procyon.org.uk> <1080378.1589895580@warthog.procyon.org.uk> To: me@benboeckel.net, fweimer@redhat.com Cc: dhowells@redhat.com, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, keyrings@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dns: Apply a default TTL to records obtained from getaddrinfo() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1512926.1589904409.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 19 May 2020 17:06:49 +0100 Message-ID: <1512927.1589904409@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Okay, how about this incremental change, then? If fixes the typo, only pr= ints the "READ CONFIG" line in verbose mode, filters escape chars in the config file and reduces the expiration time to 5s. David --- diff --git a/key.dns_resolver.c b/key.dns_resolver.c index c241eda3..7a7ec424 100644 --- a/key.dns_resolver.c +++ b/key.dns_resolver.c @@ -52,7 +52,7 @@ key_serial_t key; static int verbose; int debug_mode; unsigned mask =3D INET_ALL; -unsigned int key_expiry =3D 10 * 60; +unsigned int key_expiry =3D 5; = = /* @@ -109,7 +109,7 @@ void _error(const char *fmt, ...) } = /* - * Pring a warning to stderr or the syslog + * Print a warning to stderr or the syslog */ void warning(const char *fmt, ...) { @@ -454,7 +454,7 @@ static void read_config(void) unsigned int line =3D 0, u; int n; = - printf("READ CONFIG %s\n", config_file); + info("READ CONFIG %s", config_file); = f =3D fopen(config_file, "r"); if (!f) { @@ -514,6 +514,16 @@ static void read_config(void) v =3D p =3D b; while (*b) { if (esc) { + switch (*b) { + case ' ': + case '\t': + case '"': + case '\'': + case '\\': + break; + default: + goto invalid_escape_char; + } esc =3D false; *p++ =3D *b++; continue; @@ -563,6 +573,8 @@ static void read_config(void) = missing_value: error("%s:%u: %s: Missing value", config_file, line, k); +invalid_escape_char: + error("%s:%u: %s: Invalid char in escape", config_file, line, k); post_quote_data: error("%s:%u: %s: Data after closing quote", config_file, line, k); bad_value: diff --git a/man/key.dns_resolver.conf.5 b/man/key.dns_resolver.conf.5 index 03d04049..c944ad55 100644 --- a/man/key.dns_resolver.conf.5 +++ b/man/key.dns_resolver.conf.5 @@ -34,7 +34,7 @@ Available options include: The number of seconds to set as the expiration on a cached record. This = will be overridden if the program manages to retrieve TTL information along wi= th the addresses (if, for example, it accesses the DNS directly). The defau= lt is -600 seconds. The value must be in the range 1 to INT_MAX. +5 seconds. The value must be in the range 1 to INT_MAX. .P The file can also include comments beginning with a '#' character unless otherwise suppressed by being inside a quoted value or being escaped with= a