From: David Howells <dhowells@redhat.com>
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()
Date: Tue, 19 May 2020 17:06:49 +0100 [thread overview]
Message-ID: <1512927.1589904409@warthog.procyon.org.uk> (raw)
In-Reply-To: <20200519141432.GA2949457@erythro.dev.benboeckel.internal>
Okay, how about this incremental change, then? If fixes the typo, only prints
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 = INET_ALL;
-unsigned int key_expiry = 10 * 60;
+unsigned int key_expiry = 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 = 0, u;
int n;
- printf("READ CONFIG %s\n", config_file);
+ info("READ CONFIG %s", config_file);
f = fopen(config_file, "r");
if (!f) {
@@ -514,6 +514,16 @@ static void read_config(void)
v = p = b;
while (*b) {
if (esc) {
+ switch (*b) {
+ case ' ':
+ case '\t':
+ case '"':
+ case '\'':
+ case '\\':
+ break;
+ default:
+ goto invalid_escape_char;
+ }
esc = false;
*p++ = *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 with
the addresses (if, for example, it accesses the DNS directly). The default 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
next prev parent reply other threads:[~2020-05-19 16:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-18 14:22 [PATCH] dns: Apply a default TTL to records obtained from getaddrinfo() David Howells
2020-05-18 15:51 ` Ben Boeckel
2020-05-19 13:39 ` David Howells
2020-05-19 14:14 ` Ben Boeckel
2020-05-19 16:06 ` David Howells [this message]
2020-05-19 16:24 ` Ben Boeckel
2020-05-20 15:07 ` Jeff Layton
2020-05-19 14:17 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1512927.1589904409@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=fweimer@redhat.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=me@benboeckel.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).