From af8b68fae39b1378c769e0de6ba6437ea1aac7e3 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 19 Dec 2016 23:27:02 +0100 Subject: dirmngr: Fix problems with the getsrv function. * dirmngr/dns-stuff.c (opt_debug, opt_verbose): New vars. (set_dns_verbose): New func. (libdns_switch_port_p): Add debug output. (resolve_dns_name): Ditto. (get_dns_cert): Ditto. (get_dns_cname): Ditto. (getsrv_libdns, getsrv_standard): Change SRVCOUNT to an unsigend int. (getsrv): Rename to ... ((get_dns_srv): this. Add arg R_COUNT and return an error. Add debug output. * dirmngr/http.c: Adjust for chnaged getsrv(). * dirmngr/ks-engine-hkp.c (map_host): Ditto. * dirmngr/t-dns-stuff.c (main): Ditto. Call set_dns_verbose. * dirmngr/dirmngr.c (parse_rereadable_options): Call set_dns_verbose. -- Due to our switch to Libdns getsrv didn't worked correctly because it returned -1 for an NXDOMAIN. However, it is perfectly okay to have no SRV record and thus we change the way this function is called to be aligned with the other functions and also map NXDOMAIN to a zero SRV record count. Signed-off-by: Werner Koch --- dirmngr/dns-stuff.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'dirmngr/dns-stuff.h') diff --git a/dirmngr/dns-stuff.h b/dirmngr/dns-stuff.h index 2be972a53..075aeafab 100644 --- a/dirmngr/dns-stuff.h +++ b/dirmngr/dns-stuff.h @@ -92,6 +92,9 @@ struct srventry }; +/* Set verbosity and debug mode for this module. */ +void set_dns_verbose (int verbose, int debug); + /* Calling this function with YES set to True forces the use of the * standard resolver even if dirmngr has been built with support for * an alternative resolver. */ @@ -145,8 +148,9 @@ gpg_error_t get_dns_cert (const char *name, int want_certtype, unsigned char **r_fpr, size_t *r_fprlen, char **r_url); - -int getsrv (const char *name,struct srventry **list); +/* Return an array of SRV records. */ +gpg_error_t get_dns_srv (const char *name, + struct srventry **list, unsigned int *r_count); #endif /*GNUPG_DIRMNGR_DNS_STUFF_H*/ -- cgit v1.2.3