mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[network] HAVE_INET_ATON
This commit is contained in:
parent
8afffa97ac
commit
f6af4d3538
@ -173,14 +173,14 @@ do_real_lookup(char *name, struct sockaddr_storage **addrs, int *addrno,
|
||||
{
|
||||
struct in_addr inp;
|
||||
|
||||
#ifndef HAVE_INET_PTON
|
||||
#if defined(HAVE_INET_PTON)
|
||||
if (is_ip_address(name, strlen(name)) && inet_pton(AF_INET, name, &inp))
|
||||
hostent = gethostbyaddr(&inp, sizeof(inp), AF_INET);
|
||||
#elif defined(HAVE_INET_ATON)
|
||||
if (is_ip_address(name, strlen(name)) && inet_aton(name, &inp))
|
||||
hostent = gethostbyaddr(&inp, sizeof(inp), AF_INET);
|
||||
#else
|
||||
if (is_ip_address(name, strlen(name)) && inet_pton(name, &inp))
|
||||
hostent = gethostbyaddr(&inp, sizeof(inp), AF_INET);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!hostent)
|
||||
#endif
|
||||
{
|
||||
|
@ -288,19 +288,20 @@ match_uri_host_ip(const char *uri_host,
|
||||
* network byte order. */
|
||||
switch (ASN1_STRING_length(cert_host_asn1)) {
|
||||
case 4:
|
||||
#ifndef HAVE_INET_PTON
|
||||
return inet_aton(uri_host, &uri_host_in) != 0
|
||||
&& memcmp(cert_host_addr, &uri_host_in.s_addr, 4) == 0;
|
||||
#else
|
||||
|
||||
#if defined(HAVE_INET_PTON)
|
||||
return inet_pton(AF_INET, uri_host, &uri_host_in) != 0
|
||||
&& memcmp(cert_host_addr, &uri_host_in.s_addr, 4) == 0;
|
||||
#elif defined(HAVE_INET_ATON)
|
||||
return inet_aton(uri_host, &uri_host_in) != 0
|
||||
&& memcmp(cert_host_addr, &uri_host_in.s_addr, 4) == 0;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IPV6
|
||||
case 16:
|
||||
#ifdef HAVE_INET_PTON
|
||||
return inet_pton(AF_INET6, uri_host, &uri_host_in6) == 1
|
||||
&& memcmp(cert_host_addr, &uri_host_in6.s6_addr, 16) == 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user