---------------------
PatchSet 4734 
Date: 2007/06/14 11:26:51
Author: amosjeffries
Branch: squid3-ipv6
Tag: (none) 
Log:
Remove obsolete function safe_inet_addr()

Members: 
	include/util.h:1.10.8.12->1.10.8.13 
	lib/Makefile.am:1.12.4.6->1.12.4.7 
	lib/safe_inet_addr.c:1.1.30.9->1.1.30.10(DEAD) 
	src/ftp.cc:1.26.2.26->1.26.2.27 

Index: squid3/include/util.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/include/util.h,v
retrieving revision 1.10.8.12
retrieving revision 1.10.8.13
diff -u -r1.10.8.12 -r1.10.8.13
--- squid3/include/util.h	7 Apr 2007 11:16:40 -0000	1.10.8.12
+++ squid3/include/util.h	14 Jun 2007 11:26:51 -0000	1.10.8.13
@@ -1,5 +1,5 @@
 /*
- * $Id: util.h,v 1.10.8.12 2007/04/07 11:16:40 amosjeffries Exp $
+ * $Id: util.h,v 1.10.8.13 2007/06/14 11:26:51 amosjeffries Exp $
  *
  * AUTHOR: Harvest Derived
  *
@@ -127,7 +127,6 @@
 extern void xmalloc_find_leaks(void);
 #endif
 
-SQUIDCEXTERN int safe_inet_addr(const char *, struct in_addr *);
 SQUIDCEXTERN time_t parse_iso3307_time(const char *buf);
 SQUIDCEXTERN char *base64_decode(const char *coded);
 SQUIDCEXTERN const char *base64_encode(const char *decoded);
Index: squid3/lib/Makefile.am
===================================================================
RCS file: /cvsroot/squid-sf//squid3/lib/Makefile.am,v
retrieving revision 1.12.4.6
retrieving revision 1.12.4.7
diff -u -r1.12.4.6 -r1.12.4.7
--- squid3/lib/Makefile.am	24 Apr 2007 10:59:25 -0000	1.12.4.6
+++ squid3/lib/Makefile.am	14 Jun 2007 11:26:51 -0000	1.12.4.7
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-#  $Id: Makefile.am,v 1.12.4.6 2007/04/24 10:59:25 amosjeffries Exp $
+#  $Id: Makefile.am,v 1.12.4.7 2007/06/14 11:26:51 amosjeffries Exp $
 #
 
 DIST_SUBDIRS = libTrie
@@ -74,7 +74,6 @@
 	rfc1738.c \
 	rfc2617.c \
 	rfc3596.c \
-	safe_inet_addr.c \
 	$(SNPRINTFSOURCE) \
 	Splay.cc \
 	$(STRSEPSOURCE) \
--- squid3/lib/safe_inet_addr.c	Fri Jun 15 00:19:22 2007
+++ /dev/null	Fri Jun 15 00:19:22 2007
@@ -1,66 +0,0 @@
-
-/*
- * $Id: safe_inet_addr.c,v 1.1.30.9 2007/04/05 01:44:26 amosjeffries Exp $
- */
-
-#include "config.h"
-#include "util.h"
-
-#if HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-#include "snprintf.h"
-
-int
-safe_inet_addr(const char *buf, struct in_addr *addr)
-{
-    static char addrbuf[32];
-    int a1 = 0, a2 = 0, a3 = 0, a4 = 0;
-    struct in_addr A;
-    char x;
-#if defined(_SQUID_HPUX_)
-    /*
-     * MIYOSHI Tsutomu <mijosxi@ike.tottori-u.ac.jp> says scanning 'buf'
-     * causes a bus error on hppa1.1-hp-hpux9.07, so we
-     * have a broad hack for all HP systems.
-     */
-    static char buftmp[32];
-    snprintf(buftmp, 32, "%s", buf);
-    if (sscanf(buftmp, "%d.%d.%d.%d%c", &a1, &a2, &a3, &a4, &x) != 4)
-#else
-    if (sscanf(buf, "%d.%d.%d.%d%c", &a1, &a2, &a3, &a4, &x) != 4)
-#endif
-	return 0;
-    if (a1 < 0 || a1 > 255)
-	return 0;
-    if (a2 < 0 || a2 > 255)
-	return 0;
-    if (a3 < 0 || a3 > 255)
-	return 0;
-    if (a4 < 0 || a4 > 255)
-	return 0;
-    snprintf(addrbuf, 32, "%d.%d.%d.%d", a1, a2, a3, a4);
-    A.s_addr = inet_addr(addrbuf);
-    if (addr)
-	addr->s_addr = A.s_addr;
-    return 1;
-}
Index: squid3/src/ftp.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v
retrieving revision 1.26.2.26
retrieving revision 1.26.2.27
diff -u -r1.26.2.26 -r1.26.2.27
--- squid3/src/ftp.cc	3 Jun 2007 12:14:47 -0000	1.26.2.26
+++ squid3/src/ftp.cc	14 Jun 2007 11:26:53 -0000	1.26.2.27
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.26.2.26 2007/06/03 12:14:47 amosjeffries Exp $
+ * $Id: ftp.cc,v 1.26.2.27 2007/06/14 11:26:53 amosjeffries Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -2349,6 +2349,7 @@
     int p1, p2;
     int n;
     u_short port;
+    IPAddress ipa_remote;
     int fd = ftpState->data.fd;
     char *buf;
     LOCAL_ARRAY(char, ipaddr, 1024);
@@ -2379,7 +2380,9 @@
 
     snprintf(ipaddr, 1024, "%d.%d.%d.%d", h1, h2, h3, h4);
 
-    if (!safe_inet_addr(ipaddr, NULL)) {
+    ipa_remote = ipaddr;
+
+    if( ipa_remote.IsAnyAddr() ) {
         debugs(9, 1, "Unsafe PASV reply from " <<
                fd_table[ftpState->ctrl.fd].ipaddr << ": " <<
                ftpState->ctrl.last_reply);
