Skip to content

Commit 70a523d

Browse files
committed
Conditionally include arpa/inet.h if detected
Include <Ws2tcpip.h> for Windows inet_pton support Conditionally do subject_name IPv6 expansion only when both inet_pton is available and IPv6 support is comiled in
1 parent 3d10ba0 commit 70a523d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/openssl/xp_ssl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@
3939
#ifdef PHP_WIN32
4040
#include "win32/winutil.h"
4141
#include "win32/time.h"
42+
#include <Ws2tcpip.h>
4243
#include <Wincrypt.h>
4344
/* These are from Wincrypt.h, they conflict with OpenSSL */
4445
#undef X509_NAME
4546
#undef X509_CERT_PAIR
4647
#undef X509_EXTENSIONS
47-
#else
48+
#endif
49+
50+
#ifdef HAVE_ARPA_INET_H
4851
#include <arpa/inet.h>
4952
#endif
5053

@@ -441,9 +444,11 @@ static bool php_openssl_matches_san_list(X509 *peer, const char *subject_name) /
441444

442445
/* detect if subject name is an IPv6 address and expand once if required */
443446
ipv6_expanded[0] = 0;
447+
#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
444448
if (inet_pton(AF_INET6,subject_name,&ipv6)) {
445449
EXPAND_IPV6_ADDRESS(ipv6_expanded, ipv6);
446450
}
451+
#endif
447452

448453
for (i = 0; i < alt_name_count; i++) {
449454
GENERAL_NAME *san = sk_GENERAL_NAME_value(alt_names, i);

0 commit comments

Comments
 (0)