Home GnuPG
Diffusion GnuPG 48aae8167dca

dirmngr: Properly handle SRV records.

Description

dirmngr: Properly handle SRV records.

* dirmngr/ks-engine-hkp.c (enum ks_protocol): New type.
(struct hostinfo_s): New flags indicating whether we already did a
A lookup, or a SRV lookup per protocol.  Turn 'port' into an array.
(create_new_hostinfo): Initialize new fields.
(add_host): Update the port for the given protocol.
(map_host): Simplify hosttable lookup misses.  Check the SRV records
for both protocols on demand, do the A lookup just once.  Return the
correct port.

Previously, if a host had both a SRV record for hkp and hkps, the
wrong port was used for the protocol that was used second, because the
hostinfo did not store a port per protocol, and the hosttable does not
discriminate between hosts using the protocol.

Fix this by querying the SRV records on demand, storing a port per
protocol, and returning the right port.

  • GnuPG-bug-id: T3033
  • Signed-off-by: Justus Winter <justus@g10code.com>

Details

Provenance
justusAuthored on Jun 20 2017, 4:27 PM
Parents
rGfc4834d213af: dirmngr: Refactor variable-sized array code.
Branches
Unknown
Tags
Unknown
Tasks
T3033: bug: dirmngr latches SRV port cross-scheme