mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
284ec54495
commit
af8b68fae3
6 changed files with 103 additions and 42 deletions
|
@ -157,6 +157,7 @@ main (int argc, char **argv)
|
|||
exit (1);
|
||||
}
|
||||
|
||||
set_dns_verbose (verbose, debug);
|
||||
init_sockets ();
|
||||
|
||||
if (opt_tor)
|
||||
|
@ -234,19 +235,27 @@ main (int argc, char **argv)
|
|||
else if (opt_srv)
|
||||
{
|
||||
struct srventry *srv;
|
||||
int rc,i;
|
||||
unsigned int count;
|
||||
int i;
|
||||
|
||||
rc=getsrv (name? name : "_hkp._tcp.wwwkeys.pgp.net", &srv);
|
||||
printf("Count=%d\n",rc);
|
||||
for(i=0;i<rc;i++)
|
||||
err = get_dns_srv (name? name : "_hkp._tcp.wwwkeys.pgp.net",
|
||||
&srv, &count);
|
||||
if (err)
|
||||
printf ("get_dns_srv failed: %s <%s>\n",
|
||||
gpg_strerror (err), gpg_strsource (err));
|
||||
else
|
||||
{
|
||||
printf("priority=%-8hu ",srv[i].priority);
|
||||
printf("weight=%-8hu ",srv[i].weight);
|
||||
printf("port=%-5hu ",srv[i].port);
|
||||
printf("target=%s\n",srv[i].target);
|
||||
}
|
||||
printf ("count=%u\n",count);
|
||||
for (i=0; i < count; i++)
|
||||
{
|
||||
printf("priority=%-8hu ",srv[i].priority);
|
||||
printf("weight=%-8hu ",srv[i].weight);
|
||||
printf("port=%-5hu ",srv[i].port);
|
||||
printf("target=%s\n",srv[i].target);
|
||||
}
|
||||
|
||||
xfree(srv);
|
||||
xfree(srv);
|
||||
}
|
||||
}
|
||||
else /* Standard lookup. */
|
||||
{
|
||||
|
@ -289,7 +298,7 @@ main (int argc, char **argv)
|
|||
(opt_bracket? DNS_WITHBRACKET:0),
|
||||
&host);
|
||||
if (err)
|
||||
printf ("[resolve_dns_addr failed (2): %s]", gpg_strerror (err));
|
||||
printf (" [resolve_dns_addr failed (2): %s]", gpg_strerror (err));
|
||||
else
|
||||
{
|
||||
if (!is_ip_address (host))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue