mmanders 2004/01/05 14:37:48
Modified: jk/native/common jk_connect.c
Log:
Added check for AF_INET (IPV4) type address from APR (when used).
Revision Changes Path
1.16 +14 -28 jakarta-tomcat-connectors/jk/native/common/jk_connect.c
Index: jk_connect.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- jk_connect.c 5 Nov 2003 09:15:39 -0000 1.15
+++ jk_connect.c 5 Jan 2004 22:37:48 -0000 1.16
@@ -66,35 +66,9 @@
*/
-#if defined(NETWARE) && defined(__NOVELL_LIBC__)
-/* Since we want to use WinSock functionality here, don't allow the
- * non-winsock headers
- */
-#define __sys_types_h__
-#define __sys_socket_h__
-#define __netdb_h__
-#define __netinet_in_h__
-#define __arpa_inet_h__
-#define __sys_timeval_h__
-#endif
-
#include "jk_connect.h"
#include "jk_util.h"
-#if defined(NETWARE) && defined(__NOVELL_LIBC__)
-/* Now remove the defines so that including the WinSock headers won't cause
- * complaining
- */
-#undef __sys_types_h__
-#undef __sys_socket_h__
-#undef __netdb_h__
-#undef __netinet_in_h__
-#undef __arpa_inet_h__
-#undef __sys_timeval_h__
-
-#include <novsock2.h>
-#endif
-
#ifdef HAVE_APR
#include "apr_network_io.h"
#include "apr_errno.h"
@@ -138,7 +112,7 @@
#ifdef HAVE_APR
apr_pool_t *context;
- apr_sockaddr_t *remote_sa;
+ apr_sockaddr_t *remote_sa, *temp_sa;
char *remote_ipaddr;
/* May be we could avoid to recreate it each time ? */
@@ -147,6 +121,18 @@
if (apr_sockaddr_info_get(&remote_sa, host, APR_UNSPEC, (apr_port_t)port,
0, context)
!= APR_SUCCESS)
+ return JK_FALSE;
+
+ /* Since we are only handling AF_INET (IPV4) address (in_addr_t) */
+ /* make sure we find one of those. */
+ temp_sa = remote_sa;
+ while ((NULL != temp_sa) && (AF_INET != temp_sa->family))
+ temp_sa = temp_sa->next;
+
+ /* if temp_sa is set, we have a valid address otherwise, just return */
+ if (NULL != temp_sa)
+ remote_sa = temp_sa;
+ else
return JK_FALSE;
apr_sockaddr_ip_get(&remote_ipaddr, remote_sa);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]