dirmngr: Handle missing nsswitch.conf.

* dirmngr/dns-stuff.c (libdns_init): Fallback to files,dns.

--

Signed-off-by: Phil Pennock <phil@pennock-tech.com>

ChangeLog entry by wk.

This fixed the problem:

  Short version: macOS doesn't include /etc/nsswitch.conf and GnuPG's
  dirmngr is hard-erroring when that file is missing, such that no DNS
  operations succeed and --recv-key returns ENOENT type errors to the
  caller.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Phil Pennock 2017-01-19 01:21:42 -05:00 committed by Werner Koch
parent b3e7a112e0
commit 88ade475c5
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 10 additions and 1 deletions

View File

@ -478,7 +478,16 @@ libdns_init (void)
if (err)
{
log_error ("failed to load '%s': %s\n", fname, gpg_strerror (err));
goto leave;
/* not fatal, nsswitch.conf is not used on all systems; assume
* classic behavior instead. Our dns library states "bf" which tries
* DNS then Files, which is not classic; FreeBSD
* /usr/src/lib/libc/net/gethostnamadr.c defines default_src[] which
* is Files then DNS, which is. */
log_debug ("dns: fallback resolution order, files then DNS");
ld.resolv_conf->lookup[0] = 'f';
ld.resolv_conf->lookup[1] = 'b';
ld.resolv_conf->lookup[2] = '\0';
err = GPG_ERR_NO_ERROR;
}
#endif /* Unix */