From 81c012787fabf734d9c952c6f18ecac21929d4d8 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 20 Dec 2016 09:53:58 +0100 Subject: dirmngr: New option --resolver-timeout. * dirmngr/dns-stuff.c (DEFAULT_TIMEOUT): New. (opt_timeout): New var. (set_dns_timeout): New. (libdns_res_open): Set the default timeout. (libdns_res_wait): Use configurable timeout. (resolve_name_libdns): Ditto. * dirmngr/dirmngr.c (oResolverTimeout): New const. (opts): New option --resolver-timeout. (parse_rereadable_options): Set that option. (main) : Add --nameserver and --resolver-timeout. * tools/gpgconf-comp.c (gc_options_dirmngr): Add --resolver-timeout and --nameserver. * dirmngr/http.c (connect_server): Fix yesterday introduced bug in error diagnostic. -- This timeout is a pretty crude thing because libdns has a few other internal timeouts as well. Signed-off-by: Werner Koch --- dirmngr/t-dns-stuff.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dirmngr/t-dns-stuff.c') diff --git a/dirmngr/t-dns-stuff.c b/dirmngr/t-dns-stuff.c index f58f3235a..b087b5ead 100644 --- a/dirmngr/t-dns-stuff.c +++ b/dirmngr/t-dns-stuff.c @@ -83,6 +83,7 @@ main (int argc, char **argv) " --cert lookup a CERT RR\n" " --srv lookup a SRV RR\n" " --cname lookup a CNAME RR\n" + " --timeout SECONDS timeout after SECONDS\n" , stdout); exit (0); } @@ -137,6 +138,15 @@ main (int argc, char **argv) any_options = opt_cname = 1; argc--; argv++; } + else if (!strcmp (*argv, "--timeout")) + { + argc--; argv++; + if (argc) + { + set_dns_timeout (atoi (*argv)); + argc--; argv++; + } + } else if (!strncmp (*argv, "--", 2)) { fprintf (stderr, PGM ": unknown option '%s'\n", *argv); -- cgit v1.2.3