mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
dirmngr: Fix URL creation for literal IPv6 addresses in HKP.
* dirmngr/dns-stuff.c (is_ip_address): Make the return value depend on the address family. * dirmngr/ks-engine-hkp.c (map_host): Rename arg R_POOLNAME to R_HTTPHOST because that is its purpose. Note that the former behaviour of storing a NULL to indicate that it is not a pool has not been used. (make_host_part): Ditto. (make_host_part): Make sure that literal v6 addresses are correclty marked in the constructed URL. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
8b1611a960
commit
82646bbf1a
2 changed files with 39 additions and 31 deletions
|
@ -993,8 +993,10 @@ resolve_dns_addr (const struct sockaddr *addr, int addrlen,
|
|||
}
|
||||
|
||||
|
||||
/* Check whether NAME is an IP address. Returns true if it is either
|
||||
an IPv6 or IPv4 numerical address. */
|
||||
/* Check whether NAME is an IP address. Returns a true if it is
|
||||
* either an IPv6 or a IPv4 numerical address. The actual return
|
||||
* values can also be used to identify whether it is v4 or v6: The
|
||||
* true value will surprisingly be 4 for IPv4 and 6 for IPv6. */
|
||||
int
|
||||
is_ip_address (const char *name)
|
||||
{
|
||||
|
@ -1002,7 +1004,7 @@ is_ip_address (const char *name)
|
|||
int ndots, dblcol, n;
|
||||
|
||||
if (*name == '[')
|
||||
return 1; /* yes: A legal DNS name may not contain this character;
|
||||
return 6; /* yes: A legal DNS name may not contain this character;
|
||||
this mut be bracketed v6 address. */
|
||||
if (*name == '.')
|
||||
return 0; /* No. A leading dot is not a valid IP address. */
|
||||
|
@ -1035,7 +1037,7 @@ is_ip_address (const char *name)
|
|||
if (ndots > 7)
|
||||
return 0; /* No: Too many colons. */
|
||||
else if (ndots > 1)
|
||||
return 1; /* Yes: At least 2 colons indicate an v6 address. */
|
||||
return 6; /* Yes: At least 2 colons indicate an v6 address. */
|
||||
|
||||
legacy:
|
||||
/* Check whether it is legacy IP address. */
|
||||
|
@ -1056,7 +1058,7 @@ is_ip_address (const char *name)
|
|||
else if (++n > 3)
|
||||
return 0; /* No: More than 3 digits. */
|
||||
}
|
||||
return !!(ndots == 3);
|
||||
return (ndots == 3)? 4 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue