diff -urNb nmap-4.03/TargetGroup.cc nmap-4.03.new/TargetGroup.cc --- nmap-4.03/TargetGroup.cc 2006-02-07 01:15:37.000000000 -0500 +++ nmap-4.03.new/TargetGroup.cc 2006-05-15 22:08:08.133375000 -0400 @@ -198,7 +198,7 @@ } if (netmask != 32 || namedhost) { targets_type = IPV4_NETMASK; - if (!inet_aton(target_net, &(startaddr))) { + if (!inet_pton(AF_INET, target_net, &(startaddr))) { if ((target = gethostbyname(target_net))) memcpy(&(startaddr), target->h_addr_list[0], sizeof(struct in_addr)); else { diff -urNb nmap-4.03/nbase/getaddrinfo.c nmap-4.03.new/nbase/getaddrinfo.c --- nmap-4.03/nbase/getaddrinfo.c 2006-01-25 01:49:36.000000000 -0500 +++ nmap-4.03.new/nbase/getaddrinfo.c 2006-05-15 21:47:33.930250000 -0400 @@ -206,7 +206,7 @@ return 0; } - if (inet_aton(node, &ip)) { + if (inet_pton(AF_INET, node, &ip)) { *res = new_ai(portno, ip.s_addr); return 0; } diff -urNb nmap-4.03/nbase/inet_aton.c nmap-4.03.new/nbase/inet_aton.c --- nmap-4.03/nbase/inet_aton.c 2005-04-14 21:23:49.000000000 -0400 +++ nmap-4.03.new/nbase/inet_aton.c 1969-12-31 19:00:00.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id: inet_aton.c 903 2000-11-30 07:53:28Z fyodor $ */ - -#ifndef lint -static const char rcsid[] = - "@(#) $Header$"; -#endif - -#if HAVE_CONFIG_H -#include "nbase_config.h" -#else -#ifdef WIN32 -#include "nbase_winconfig.h" -#endif /* WIN32 */ -#endif /* HAVE_CONFIG_H */ - -#include "nbase.h" - -#ifdef WIN32 -#include -#endif - -#include -#if HAVE_NETINET_IN_H -#include -#endif - -#if HAVE_NETDB_H -#include -#endif - -#if HAVE_ARPA_INET_H -#include -#endif - -/* Minimal implementation of inet_aton. - * Cannot distinguish between failure and a local broadcast address. */ - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -int -inet_aton(const char *cp, struct in_addr *addr) -{ - addr->s_addr = inet_addr(cp); - return (addr->s_addr == INADDR_NONE) ? 0 : 1; -} diff -urNb nmap-4.03/nbase/nbase.h nmap-4.03.new/nbase/nbase.h --- nmap-4.03/nbase/nbase.h 2006-03-26 00:44:25.000000000 -0500 +++ nmap-4.03.new/nbase/nbase.h 2006-05-15 21:32:43.227125000 -0400 @@ -3,7 +3,7 @@ * nbase.h -- The main include file exposing the external API for * * libnbase, a library of base (often compatability) routines. Programs * * using libnbase can guarantee the availability of functions like * - * (v)snprintf and inet_aton. This library also provides consistency and * + * (v)snprintf and inet_pton. This library also provides consistency and * * extended features for some functions. It was originally written for * * use in the Nmap Security Scanner ( http://www.insecure.org/nmap/ ). * * * @@ -112,7 +112,7 @@ * * 'inline' is defined to what is neccessary for the C compiler being * used (which may be nothing) * - * * snprintf, inet_aton, inet_pton, inet_aton, memcpy, and bzero are + * * snprintf, inet_pton, memcpy, and bzero are * provided if you don't have them (prototypes for these are * included either way). * @@ -369,11 +369,6 @@ unsigned int sleep(unsigned int seconds); #endif -#ifndef HAVE_INET_ATON -struct in_addr; -int inet_aton(const char *cp, struct in_addr *addr); -#endif - /* Strncpy is like strcpy() except it ALWAYS zero-terminates, even if it must truncate */ int Strncpy(char *dest, const char *src, size_t n); diff -urNb nmap-4.03/nbase/nbase.vcproj nmap-4.03.new/nbase/nbase.vcproj --- nmap-4.03/nbase/nbase.vcproj 2005-08-11 01:02:58.000000000 -0400 +++ nmap-4.03.new/nbase/nbase.vcproj 2006-05-15 22:48:07.070875000 -0400 @@ -104,9 +104,6 @@ RelativePath=".\getopt1.c"> - - h_addr_list[0], 4); else { @@ -1646,7 +1646,7 @@ q = strchr(found, ' '); if (!q) fatal("Unable to parse supposed log file %s. Sorry", fname); *q = '\0'; - if (inet_aton(found, &lastip) == 0) + if (inet_pton(o.af(), found, &lastip) == 0) fatal("Unable to parse supposed log file %s. Sorry", fname); *q = ' '; } else { @@ -1674,7 +1674,7 @@ q = strchr(found, ')'); if (!q) fatal("Unable to parse supposed log file %s. Sorry", fname); *q = '\0'; - if (inet_aton(found, &lastip) == 0) + if (inet_pton(o.af(), found, &lastip) == 0) fatal("Unable to parse ip (%s) supposed log file %s. Sorry", found, fname); *q = ')'; } else { diff -urNb nmap-4.03/nmap.h nmap-4.03.new/nmap.h --- nmap-4.03/nmap.h 2006-03-25 17:56:16.000000000 -0500 +++ nmap-4.03.new/nmap.h 2006-05-15 21:32:42.555250000 -0400 @@ -464,9 +464,4 @@ int nmap_fetchfile(char *filename_returned, int bufferlen, char *file); int gather_logfile_resumption_state(char *fname, int *myargc, char ***myargv); -/* From glibc 2.0.6 because Solaris doesn't seem to have this function */ -#ifndef HAVE_INET_ATON -int inet_aton(register const char *, struct in_addr *); -#endif - #endif /* NMAP_H */ diff -urNb nmap-4.03/nmap_dns.cc nmap-4.03.new/nmap_dns.cc --- nmap-4.03/nmap_dns.cc 2006-04-22 00:40:27.000000000 -0400 +++ nmap-4.03.new/nmap_dns.cc 2006-05-15 21:36:42.492750000 -0400 @@ -953,7 +953,7 @@ while (*tp == ' ' || *tp == '\t') tp++; if (sscanf(tp, "%15s %255s", ipaddrstr, hname) == 2) { - if (inet_aton(ipaddrstr, &ia)) { + if (inet_pton(o.af(), ipaddrstr, &ia)) { he = new host_elem; he->name = strdup(hname); he->addr = (u32) ia.s_addr; diff -urNb nmap-4.03/tcpip.cc nmap-4.03.new/tcpip.cc --- nmap-4.03/tcpip.cc 2006-04-22 19:03:01.000000000 -0400 +++ nmap-4.03.new/tcpip.cc 2006-05-15 21:39:25.149000000 -0400 @@ -780,7 +780,7 @@ if (!hostname || !*hostname) fatal("NULL or zero-length hostname passed to resolve()"); - if (inet_aton(hostname, ip)) + if (inet_pton(AF_INET, hostname, ip)) return 1; /* damn, that was easy ;) */ if ((h = gethostbyname(hostname))) { memcpy(ip, h->h_addr_list[0], sizeof(struct in_addr)); diff -urNb nmap-4.03/tcpip.h nmap-4.03.new/tcpip.h --- nmap-4.03/tcpip.h 2006-03-25 17:56:16.000000000 -0500 +++ nmap-4.03.new/tcpip.h 2006-05-15 21:32:42.836500000 -0400 @@ -750,10 +750,6 @@ int read_arp_reply_pcap(pcap_t *pd, u8 *sendermac, struct in_addr *senderIP, long to_usec, struct timeval *rcvdtime); -#ifndef HAVE_INET_ATON -int inet_aton(register const char *, struct in_addr *); -#endif - /* Examines the given tcp packet and obtains the TCP timestamp option information if available. Note that the CALLER must ensure that "tcp" contains a valid header (in particular the th_off must be the