summaryrefslogtreecommitdiff
path: root/ext/sockets
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-07-08 05:00:13 +0000
committerSara Golemon <pollita@php.net>2003-07-08 05:00:13 +0000
commit6cb8ce2880058836d17ba24ffde439f6afa4a08e (patch)
tree6bf3da165377ffcc89f71ca5d0bc7a10a09129f7 /ext/sockets
parent010f5a12c7017f7325141e0a30aa9f3b41e95f4c (diff)
downloadphp-git-6cb8ce2880058836d17ba24ffde439f6afa4a08e.tar.gz
gethostbyname2() not thread safe. Use getaddrinfo() or nothing at all.
Diffstat (limited to 'ext/sockets')
-rw-r--r--ext/sockets/sockets.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 5421195739..9b1d3ad0d8 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -381,8 +381,6 @@ static int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socke
#ifdef HAVE_GETADDRINFO
struct addrinfo hints;
struct addrinfo *addrinfo = NULL;
-#elif defined(HAVE_GETHOSTBYNAME2)
- struct hostent *host_entry;
#endif
if (inet_pton(AF_INET6, string, &tmp)) {
@@ -410,25 +408,9 @@ static int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socke
memcpy(&(sin6->sin6_addr.s6_addr), ((struct sockaddr_in6*)(addrinfo->ai_addr))->sin6_addr.s6_addr, sizeof(struct in6_addr));
freeaddrinfo(addrinfo);
-#elif defined(HAVE_GETHOSTBYNAME2)
-
- if (! (host_entry = gethostbyname2(string, AF_INET6))) {
-#ifdef PHP_WIN32
- PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError());
-#else
- PHP_SOCKET_ERROR(php_sock, "Host lookup failed", (-10000 - h_errno));
-#endif
- return 0;
- }
- if (host_entry->h_addrtype != AF_INET6) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup failed: Non AF_INET6 domain returned on AF_INET6 socket");
- return 0;
- }
- memcpy(&(sin6->sin6_addr.s6_addr), host_entry->h_addr_list[0], host_entry->h_length);
-
#else
/* No IPv6 specific hostname resolution is available on this system? */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No IPv6 compatable hostname resolution available on system.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup failed: getaddrinfo() not available on system.");
reurn 0;
#endif