Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 31390 invoked by uid 500); 18 Dec 2000 20:31:21 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 31338 invoked by uid 500); 18 Dec 2000 20:31:19 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 18 Dec 2000 20:31:18 -0000 Message-ID: <20001218203118.31289.qmail@locus.apache.org> From: trawick@locus.apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/http http_core.c trawick 00/12/18 12:31:17 Modified: modules/http http_core.c Log: Remove an IPv4 dependency in do_double_reverse() by calling apr_getaddrinfo() instead of gethostbyname(). Revision Changes Path 1.230 +13 -15 httpd-2.0/modules/http/http_core.c Index: http_core.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/http/http_core.c,v retrieving revision 1.229 retrieving revision 1.230 diff -u -r1.229 -r1.230 --- http_core.c 2000/12/18 16:49:09 1.229 +++ http_core.c 2000/12/18 20:31:17 1.230 @@ -84,9 +84,6 @@ #include "util_ebcdic.h" #include "mpm.h" -#ifdef HAVE_NETDB_H -#include -#endif #ifdef HAVE_SYS_SOCKET_H #include #endif @@ -586,7 +583,8 @@ /* Code from Harald Hanche-Olsen */ static apr_inline void do_double_reverse (conn_rec *conn) { - struct hostent *hptr; + apr_sockaddr_t *sa; + apr_status_t rv; if (conn->double_reverse) { /* already done */ @@ -597,17 +595,17 @@ conn->double_reverse = -1; return; } - hptr = gethostbyname(conn->remote_host); - if (hptr) { - char **haddr; - - for (haddr = hptr->h_addr_list; *haddr; haddr++) { - if (((struct in_addr *)(*haddr))->s_addr - == conn->remote_addr->sa.sin.sin_addr.s_addr) { - conn->double_reverse = 1; - return; - } - } + rv = apr_getaddrinfo(&sa, conn->remote_host, APR_UNSPEC, 0, 0, conn->pool); + if (rv == APR_SUCCESS) { + while (sa) { + if (sa->ipaddr_len == conn->remote_addr->ipaddr_len && + !memcmp(sa->ipaddr_ptr, conn->remote_addr->ipaddr_ptr, + sa->ipaddr_len)) { + conn->double_reverse = 1; + return; + } + sa = sa->next; + } } conn->double_reverse = -1; }