diff --git a/CHANGELOG b/CHANGELOG index cd19ba548..98f3029b9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ # Nmap Changelog ($Id$) +Nmap 3.91 + o Fixed a crash on Windows when you -P0 scan an unused IP on a local network (or a range that contains unused IPs). This could also happen on UNIX if you specified the new --send_eth option. Thanks @@ -16,7 +18,10 @@ o Updated the included libpcre (used for version detection) from version 4.3 to 6.3. A libpcre securty issue was fixed in 6.3, but that issue never affected Nmap. -o Updated the included libpcap from 0.8.3 to 0.9.3. +o Updated the included libpcap from 0.8.3 to 0.9.3. I also changed + the directory name in the Nmap tarball from libpcap-possiblymodified + to just libpcap. As usual, the modifications are described in the + NMAP_MODIFICATIONS in that directory. Nmap 3.90 diff --git a/configure b/configure index 00a8cf57e..1eaeb4c9f 100755 --- a/configure +++ b/configure @@ -1341,7 +1341,7 @@ if test "$user_localdirs" = 1; then fi fi -libpcapdir=libpcap-possiblymodified +libpcapdir=libpcap pcredir=libpcre diff --git a/configure.ac b/configure.ac index 177dd9cfe..a95bb7b59 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ if test "$user_localdirs" = 1; then fi fi -libpcapdir=libpcap-possiblymodified +libpcapdir=libpcap AC_SUBST(libpcapdir) pcredir=libpcre diff --git a/libpcap-possiblymodified/packaging/pcap.spec b/libpcap-possiblymodified/packaging/pcap.spec deleted file mode 100644 index 11cd0f77e..000000000 --- a/libpcap-possiblymodified/packaging/pcap.spec +++ /dev/null @@ -1,65 +0,0 @@ -%define prefix /usr -%define version 0.9 - -Summary: packet capture library -Name: libpcap -Version: %version -Release: 1 -Group: Development/Libraries -Copyright: BSD -Source: libpcap-0.9-PRE-CVS.tar.gz -BuildRoot: /tmp/%{name}-buildroot -URL: http://www.tcpdump.org - -%description -Packet-capture library LIBPCAP 0.9 -Now maintained by "The Tcpdump Group" -See http://www.tcpdump.org -Please send inquiries/comments/reports to tcpdump-workers@tcpdump.org - -%prep -%setup - -%post -ldconfig - -%build -CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix -make - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/usr/{lib,include} -mkdir -p $RPM_BUILD_ROOT/usr/share/man -mkdir -p $RPM_BUILD_ROOT/usr/include/net -mkdir -p $RPM_BUILD_ROOT/usr/man/man3 -make install DESTDIR=$RPM_BUILD_ROOT mandir=/usr/share/man -cd $RPM_BUILD_ROOT/usr/lib -V1=`echo 0.9 | sed 's/\\.[^\.]*$//g'` -V2=`echo 0.9 | sed 's/\\.[^\.]*\.[^\.]*$//g'` -ln -sf libpcap.so.0.9 libpcap.so.$V1 -if test "$V2" -ne "$V1"; then - ln -sf libpcap.so.$V1 libpcap.so.$V2 - ln -sf libpcap.so.$V2 libpcap.so -else - ln -sf libpcap.so.$V1 libpcap.so -fi - -#install -m 755 -o root libpcap.a $RPM_BUILD_ROOT/usr/lib -#install -m 644 -o root pcap.3 $RPM_BUILD_ROOT/usr/man/man3 -#install -m 644 -o root pcap.h $RPM_BUILD_ROOT/usr/include -#install -m 644 -o root pcap-bpf.h $RPM_BUILD_ROOT/usr/include/net -#install -m 644 -o root pcap-namedb.h $RPM_BUILD_ROOT/usr/include - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%doc LICENSE CHANGES INSTALL.txt README.linux TODO VERSION CREDITS packaging/pcap.spec -/usr/lib/libpcap.a -/usr/share/man/man3/* -/usr/include/pcap.h -/usr/include/pcap-bpf.h -/usr/include/pcap-namedb.h -/usr/lib/libpcap.so* diff --git a/libpcap-possiblymodified/.cvsignore b/libpcap/.cvsignore similarity index 100% rename from libpcap-possiblymodified/.cvsignore rename to libpcap/.cvsignore diff --git a/libpcap-possiblymodified/CHANGES b/libpcap/CHANGES similarity index 100% rename from libpcap-possiblymodified/CHANGES rename to libpcap/CHANGES diff --git a/libpcap-possiblymodified/CREDITS b/libpcap/CREDITS similarity index 100% rename from libpcap-possiblymodified/CREDITS rename to libpcap/CREDITS diff --git a/libpcap-possiblymodified/ChmodBPF/ChmodBPF b/libpcap/ChmodBPF/ChmodBPF similarity index 100% rename from libpcap-possiblymodified/ChmodBPF/ChmodBPF rename to libpcap/ChmodBPF/ChmodBPF diff --git a/libpcap-possiblymodified/ChmodBPF/StartupParameters.plist b/libpcap/ChmodBPF/StartupParameters.plist similarity index 100% rename from libpcap-possiblymodified/ChmodBPF/StartupParameters.plist rename to libpcap/ChmodBPF/StartupParameters.plist diff --git a/libpcap-possiblymodified/FILES b/libpcap/FILES similarity index 100% rename from libpcap-possiblymodified/FILES rename to libpcap/FILES diff --git a/libpcap-possiblymodified/INSTALL.txt b/libpcap/INSTALL.txt similarity index 100% rename from libpcap-possiblymodified/INSTALL.txt rename to libpcap/INSTALL.txt diff --git a/libpcap-possiblymodified/LICENSE b/libpcap/LICENSE similarity index 100% rename from libpcap-possiblymodified/LICENSE rename to libpcap/LICENSE diff --git a/libpcap-possiblymodified/Makefile.in b/libpcap/Makefile.in similarity index 100% rename from libpcap-possiblymodified/Makefile.in rename to libpcap/Makefile.in diff --git a/libpcap-possiblymodified/NMAP_MODIFICATIONS b/libpcap/NMAP_MODIFICATIONS similarity index 93% rename from libpcap-possiblymodified/NMAP_MODIFICATIONS rename to libpcap/NMAP_MODIFICATIONS index 5c2f95f54..1b806dc16 100644 --- a/libpcap-possiblymodified/NMAP_MODIFICATIONS +++ b/libpcap/NMAP_MODIFICATIONS @@ -1,10 +1,13 @@ +NOTE: This has been upgraded to pcap 0.9.3 since the instructions +below were written. That upgrade was done by applying a diff +between pcap 0.8.3 and 0.9.3 to the Nmap libpcap dir. Nmap currently includes a modified version of the tcpdump.org release of libpcap version 0.8.3 (released March 30, 2004). My (fyodor@insecure.org) modifications are as follows: o Included this file, renamed directory from libpcap-0.8.3 to - libpcap-possiblymodified. + libpcap. o Renamed configure.in to configure.ac, which is the name now recommended by the autoconf project. @@ -16,7 +19,7 @@ o Rewrote Win32 version of eth_open() as the previous verson didn't o Added the gcc debugging flag (-g) to aclocal.m4 if gcc is being used: --- libpcap-0.8.3/aclocal.m4 2003-11-16 01:45:51.000000000 -0800 -+++ libpcap-possiblymodified/aclocal.m4 2004-07-31 22:34:47.000000000 -0700 ++++ libpcap/aclocal.m4 2004-07-31 22:34:47.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @(#) $Header$ (LBL) +dnl @(#) $Header$ (LBL) @@ -49,7 +52,7 @@ o Changed pcap-linux.c by adding a select() call guarding recvfrom() to insure that it returns after the timeout period specified in pcap_open_live() rather than blocking forever. --- libpcap-0.8.3/pcap-linux.c 2003-11-21 02:20:46.000000000 -0800 -+++ libpcap-possiblymodified/pcap-linux.c 2004-07-31 22:34:47.000000000 -0700 ++++ libpcap/pcap-linux.c 2004-07-31 22:34:47.000000000 -0700 @@ -27,7 +27,7 @@ #ifndef lint @@ -106,7 +109,7 @@ o Eliminated Lex/Yacc requirement (I now ship the generated .c files). o Changes to Makefile.in --- libpcap-0.8.3/Makefile.in 2003-12-14 17:42:23.000000000 -0800 -+++ libpcap-possiblymodified/Makefile.in 2004-07-31 22:34:47.000000000 -0700 ++++ libpcap/Makefile.in 2004-07-31 22:34:47.000000000 -0700 @@ -17,7 +17,7 @@ # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. @@ -138,7 +141,7 @@ o Eliminated Lex/Yacc requirement (I now ship the generated .c files). o Ripped LEX/YACC detection code from configure.in: --- libpcap-0.8.3/configure.in 2004-03-28 13:43:34.000000000 -0800 -+++ libpcap-possiblymodified/configure.ac 2004-07-31 22:34:47.000000000 -0700 ++++ libpcap/configure.ac 2004-07-31 22:34:47.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @(#) $Header$ (LBL) +dnl @(#) $Header$ (LBL) @@ -243,3 +246,4 @@ Ben Harris (bjh21(a)cam.ac.uk) /* +o Removed packaging/pcap.spec because it conflicted with the Nmap spec file when building RPMs from the tarball. diff --git a/libpcap-possiblymodified/README b/libpcap/README similarity index 100% rename from libpcap-possiblymodified/README rename to libpcap/README diff --git a/libpcap-possiblymodified/README.Win32 b/libpcap/README.Win32 similarity index 100% rename from libpcap-possiblymodified/README.Win32 rename to libpcap/README.Win32 diff --git a/libpcap-possiblymodified/README.aix b/libpcap/README.aix similarity index 100% rename from libpcap-possiblymodified/README.aix rename to libpcap/README.aix diff --git a/libpcap-possiblymodified/README.dag b/libpcap/README.dag similarity index 100% rename from libpcap-possiblymodified/README.dag rename to libpcap/README.dag diff --git a/libpcap-possiblymodified/README.hpux b/libpcap/README.hpux similarity index 100% rename from libpcap-possiblymodified/README.hpux rename to libpcap/README.hpux diff --git a/libpcap-possiblymodified/README.linux b/libpcap/README.linux similarity index 100% rename from libpcap-possiblymodified/README.linux rename to libpcap/README.linux diff --git a/libpcap-possiblymodified/README.macosx b/libpcap/README.macosx similarity index 100% rename from libpcap-possiblymodified/README.macosx rename to libpcap/README.macosx diff --git a/libpcap-possiblymodified/README.septel b/libpcap/README.septel similarity index 100% rename from libpcap-possiblymodified/README.septel rename to libpcap/README.septel diff --git a/libpcap-possiblymodified/README.tru64 b/libpcap/README.tru64 similarity index 100% rename from libpcap-possiblymodified/README.tru64 rename to libpcap/README.tru64 diff --git a/libpcap-possiblymodified/SUNOS4/nit_if.o.sparc b/libpcap/SUNOS4/nit_if.o.sparc similarity index 100% rename from libpcap-possiblymodified/SUNOS4/nit_if.o.sparc rename to libpcap/SUNOS4/nit_if.o.sparc diff --git a/libpcap-possiblymodified/SUNOS4/nit_if.o.sun3 b/libpcap/SUNOS4/nit_if.o.sun3 similarity index 100% rename from libpcap-possiblymodified/SUNOS4/nit_if.o.sun3 rename to libpcap/SUNOS4/nit_if.o.sun3 diff --git a/libpcap-possiblymodified/SUNOS4/nit_if.o.sun4c.4.0.3c b/libpcap/SUNOS4/nit_if.o.sun4c.4.0.3c similarity index 100% rename from libpcap-possiblymodified/SUNOS4/nit_if.o.sun4c.4.0.3c rename to libpcap/SUNOS4/nit_if.o.sun4c.4.0.3c diff --git a/libpcap-possiblymodified/TODO b/libpcap/TODO similarity index 100% rename from libpcap-possiblymodified/TODO rename to libpcap/TODO diff --git a/libpcap-possiblymodified/VERSION b/libpcap/VERSION similarity index 100% rename from libpcap-possiblymodified/VERSION rename to libpcap/VERSION diff --git a/libpcap-possiblymodified/Win32/Include/Gnuc.h b/libpcap/Win32/Include/Gnuc.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/Gnuc.h rename to libpcap/Win32/Include/Gnuc.h diff --git a/libpcap-possiblymodified/Win32/Include/addrinfo.h b/libpcap/Win32/Include/addrinfo.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/addrinfo.h rename to libpcap/Win32/Include/addrinfo.h diff --git a/libpcap-possiblymodified/Win32/Include/arpa/nameser.h b/libpcap/Win32/Include/arpa/nameser.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/arpa/nameser.h rename to libpcap/Win32/Include/arpa/nameser.h diff --git a/libpcap-possiblymodified/Win32/Include/bittypes.h b/libpcap/Win32/Include/bittypes.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/bittypes.h rename to libpcap/Win32/Include/bittypes.h diff --git a/libpcap-possiblymodified/Win32/Include/cdecl_ext.h b/libpcap/Win32/Include/cdecl_ext.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/cdecl_ext.h rename to libpcap/Win32/Include/cdecl_ext.h diff --git a/libpcap-possiblymodified/Win32/Include/inetprivate.h b/libpcap/Win32/Include/inetprivate.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/inetprivate.h rename to libpcap/Win32/Include/inetprivate.h diff --git a/libpcap-possiblymodified/Win32/Include/ip6_misc.h b/libpcap/Win32/Include/ip6_misc.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/ip6_misc.h rename to libpcap/Win32/Include/ip6_misc.h diff --git a/libpcap-possiblymodified/Win32/Include/net/if.h b/libpcap/Win32/Include/net/if.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/net/if.h rename to libpcap/Win32/Include/net/if.h diff --git a/libpcap-possiblymodified/Win32/Include/net/netdb.h b/libpcap/Win32/Include/net/netdb.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/net/netdb.h rename to libpcap/Win32/Include/net/netdb.h diff --git a/libpcap-possiblymodified/Win32/Include/net/paths.h b/libpcap/Win32/Include/net/paths.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/net/paths.h rename to libpcap/Win32/Include/net/paths.h diff --git a/libpcap-possiblymodified/Win32/Include/sockstorage.h b/libpcap/Win32/Include/sockstorage.h similarity index 100% rename from libpcap-possiblymodified/Win32/Include/sockstorage.h rename to libpcap/Win32/Include/sockstorage.h diff --git a/libpcap-possiblymodified/Win32/Prj/libpcap.dsp b/libpcap/Win32/Prj/libpcap.dsp similarity index 100% rename from libpcap-possiblymodified/Win32/Prj/libpcap.dsp rename to libpcap/Win32/Prj/libpcap.dsp diff --git a/libpcap-possiblymodified/Win32/Prj/libpcap.dsw b/libpcap/Win32/Prj/libpcap.dsw similarity index 100% rename from libpcap-possiblymodified/Win32/Prj/libpcap.dsw rename to libpcap/Win32/Prj/libpcap.dsw diff --git a/libpcap-possiblymodified/Win32/Src/ffs.c b/libpcap/Win32/Src/ffs.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/ffs.c rename to libpcap/Win32/Src/ffs.c diff --git a/libpcap-possiblymodified/Win32/Src/getaddrinfo.c b/libpcap/Win32/Src/getaddrinfo.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/getaddrinfo.c rename to libpcap/Win32/Src/getaddrinfo.c diff --git a/libpcap-possiblymodified/Win32/Src/getnetbynm.c b/libpcap/Win32/Src/getnetbynm.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/getnetbynm.c rename to libpcap/Win32/Src/getnetbynm.c diff --git a/libpcap-possiblymodified/Win32/Src/getnetent.c b/libpcap/Win32/Src/getnetent.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/getnetent.c rename to libpcap/Win32/Src/getnetent.c diff --git a/libpcap-possiblymodified/Win32/Src/getopt.c b/libpcap/Win32/Src/getopt.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/getopt.c rename to libpcap/Win32/Src/getopt.c diff --git a/libpcap-possiblymodified/Win32/Src/getservent.c b/libpcap/Win32/Src/getservent.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/getservent.c rename to libpcap/Win32/Src/getservent.c diff --git a/libpcap-possiblymodified/Win32/Src/inet_aton.c b/libpcap/Win32/Src/inet_aton.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/inet_aton.c rename to libpcap/Win32/Src/inet_aton.c diff --git a/libpcap-possiblymodified/Win32/Src/inet_net.c b/libpcap/Win32/Src/inet_net.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/inet_net.c rename to libpcap/Win32/Src/inet_net.c diff --git a/libpcap-possiblymodified/Win32/Src/inet_pton.c b/libpcap/Win32/Src/inet_pton.c similarity index 100% rename from libpcap-possiblymodified/Win32/Src/inet_pton.c rename to libpcap/Win32/Src/inet_pton.c diff --git a/libpcap-possiblymodified/acconfig.h b/libpcap/acconfig.h similarity index 100% rename from libpcap-possiblymodified/acconfig.h rename to libpcap/acconfig.h diff --git a/libpcap-possiblymodified/aclocal.m4 b/libpcap/aclocal.m4 similarity index 100% rename from libpcap-possiblymodified/aclocal.m4 rename to libpcap/aclocal.m4 diff --git a/libpcap-possiblymodified/arcnet.h b/libpcap/arcnet.h similarity index 100% rename from libpcap-possiblymodified/arcnet.h rename to libpcap/arcnet.h diff --git a/libpcap-possiblymodified/atmuni31.h b/libpcap/atmuni31.h similarity index 100% rename from libpcap-possiblymodified/atmuni31.h rename to libpcap/atmuni31.h diff --git a/libpcap-possiblymodified/bpf/net/bpf.h b/libpcap/bpf/net/bpf.h similarity index 100% rename from libpcap-possiblymodified/bpf/net/bpf.h rename to libpcap/bpf/net/bpf.h diff --git a/libpcap-possiblymodified/bpf/net/bpf_filter.c b/libpcap/bpf/net/bpf_filter.c similarity index 100% rename from libpcap-possiblymodified/bpf/net/bpf_filter.c rename to libpcap/bpf/net/bpf_filter.c diff --git a/libpcap-possiblymodified/bpf_dump.c b/libpcap/bpf_dump.c similarity index 100% rename from libpcap-possiblymodified/bpf_dump.c rename to libpcap/bpf_dump.c diff --git a/libpcap-possiblymodified/bpf_filter.c b/libpcap/bpf_filter.c similarity index 100% rename from libpcap-possiblymodified/bpf_filter.c rename to libpcap/bpf_filter.c diff --git a/libpcap-possiblymodified/bpf_image.c b/libpcap/bpf_image.c similarity index 100% rename from libpcap-possiblymodified/bpf_image.c rename to libpcap/bpf_image.c diff --git a/libpcap-possiblymodified/config.guess b/libpcap/config.guess similarity index 100% rename from libpcap-possiblymodified/config.guess rename to libpcap/config.guess diff --git a/libpcap-possiblymodified/config.h.in b/libpcap/config.h.in similarity index 100% rename from libpcap-possiblymodified/config.h.in rename to libpcap/config.h.in diff --git a/libpcap-possiblymodified/config.sub b/libpcap/config.sub similarity index 100% rename from libpcap-possiblymodified/config.sub rename to libpcap/config.sub diff --git a/libpcap-possiblymodified/configure b/libpcap/configure similarity index 100% rename from libpcap-possiblymodified/configure rename to libpcap/configure diff --git a/libpcap-possiblymodified/configure.ac b/libpcap/configure.ac similarity index 100% rename from libpcap-possiblymodified/configure.ac rename to libpcap/configure.ac diff --git a/libpcap-possiblymodified/doc/pcap.html b/libpcap/doc/pcap.html similarity index 100% rename from libpcap-possiblymodified/doc/pcap.html rename to libpcap/doc/pcap.html diff --git a/libpcap-possiblymodified/doc/pcap.txt b/libpcap/doc/pcap.txt similarity index 100% rename from libpcap-possiblymodified/doc/pcap.txt rename to libpcap/doc/pcap.txt diff --git a/libpcap-possiblymodified/doc/pcap.xml b/libpcap/doc/pcap.xml similarity index 100% rename from libpcap-possiblymodified/doc/pcap.xml rename to libpcap/doc/pcap.xml diff --git a/libpcap-possiblymodified/etherent.c b/libpcap/etherent.c similarity index 100% rename from libpcap-possiblymodified/etherent.c rename to libpcap/etherent.c diff --git a/libpcap-possiblymodified/ethertype.h b/libpcap/ethertype.h similarity index 100% rename from libpcap-possiblymodified/ethertype.h rename to libpcap/ethertype.h diff --git a/libpcap-possiblymodified/fad-getad.c b/libpcap/fad-getad.c similarity index 100% rename from libpcap-possiblymodified/fad-getad.c rename to libpcap/fad-getad.c diff --git a/libpcap-possiblymodified/fad-gifc.c b/libpcap/fad-gifc.c similarity index 100% rename from libpcap-possiblymodified/fad-gifc.c rename to libpcap/fad-gifc.c diff --git a/libpcap-possiblymodified/fad-glifc.c b/libpcap/fad-glifc.c similarity index 100% rename from libpcap-possiblymodified/fad-glifc.c rename to libpcap/fad-glifc.c diff --git a/libpcap-possiblymodified/fad-null.c b/libpcap/fad-null.c similarity index 100% rename from libpcap-possiblymodified/fad-null.c rename to libpcap/fad-null.c diff --git a/libpcap-possiblymodified/fad-win32.c b/libpcap/fad-win32.c similarity index 100% rename from libpcap-possiblymodified/fad-win32.c rename to libpcap/fad-win32.c diff --git a/libpcap-possiblymodified/gencode.c b/libpcap/gencode.c similarity index 100% rename from libpcap-possiblymodified/gencode.c rename to libpcap/gencode.c diff --git a/libpcap-possiblymodified/gencode.h b/libpcap/gencode.h similarity index 100% rename from libpcap-possiblymodified/gencode.h rename to libpcap/gencode.h diff --git a/libpcap-possiblymodified/grammar.c b/libpcap/grammar.c similarity index 100% rename from libpcap-possiblymodified/grammar.c rename to libpcap/grammar.c diff --git a/libpcap-possiblymodified/grammar.y b/libpcap/grammar.y similarity index 100% rename from libpcap-possiblymodified/grammar.y rename to libpcap/grammar.y diff --git a/libpcap-possiblymodified/inet.c b/libpcap/inet.c similarity index 100% rename from libpcap-possiblymodified/inet.c rename to libpcap/inet.c diff --git a/libpcap-possiblymodified/install-sh b/libpcap/install-sh similarity index 100% rename from libpcap-possiblymodified/install-sh rename to libpcap/install-sh diff --git a/libpcap-possiblymodified/lbl/os-aix4.h b/libpcap/lbl/os-aix4.h similarity index 100% rename from libpcap-possiblymodified/lbl/os-aix4.h rename to libpcap/lbl/os-aix4.h diff --git a/libpcap-possiblymodified/lbl/os-hpux11.h b/libpcap/lbl/os-hpux11.h similarity index 100% rename from libpcap-possiblymodified/lbl/os-hpux11.h rename to libpcap/lbl/os-hpux11.h diff --git a/libpcap-possiblymodified/lbl/os-osf4.h b/libpcap/lbl/os-osf4.h similarity index 100% rename from libpcap-possiblymodified/lbl/os-osf4.h rename to libpcap/lbl/os-osf4.h diff --git a/libpcap-possiblymodified/lbl/os-osf5.h b/libpcap/lbl/os-osf5.h similarity index 100% rename from libpcap-possiblymodified/lbl/os-osf5.h rename to libpcap/lbl/os-osf5.h diff --git a/libpcap-possiblymodified/lbl/os-solaris2.h b/libpcap/lbl/os-solaris2.h similarity index 100% rename from libpcap-possiblymodified/lbl/os-solaris2.h rename to libpcap/lbl/os-solaris2.h diff --git a/libpcap-possiblymodified/lbl/os-sunos4.h b/libpcap/lbl/os-sunos4.h similarity index 100% rename from libpcap-possiblymodified/lbl/os-sunos4.h rename to libpcap/lbl/os-sunos4.h diff --git a/libpcap-possiblymodified/lbl/os-ultrix4.h b/libpcap/lbl/os-ultrix4.h similarity index 100% rename from libpcap-possiblymodified/lbl/os-ultrix4.h rename to libpcap/lbl/os-ultrix4.h diff --git a/libpcap-possiblymodified/llc.h b/libpcap/llc.h similarity index 100% rename from libpcap-possiblymodified/llc.h rename to libpcap/llc.h diff --git a/libpcap-possiblymodified/missing/snprintf.c b/libpcap/missing/snprintf.c similarity index 100% rename from libpcap-possiblymodified/missing/snprintf.c rename to libpcap/missing/snprintf.c diff --git a/libpcap-possiblymodified/mkdep b/libpcap/mkdep similarity index 100% rename from libpcap-possiblymodified/mkdep rename to libpcap/mkdep diff --git a/libpcap-possiblymodified/msdos/bin2c.c b/libpcap/msdos/bin2c.c similarity index 100% rename from libpcap-possiblymodified/msdos/bin2c.c rename to libpcap/msdos/bin2c.c diff --git a/libpcap-possiblymodified/msdos/common.dj b/libpcap/msdos/common.dj similarity index 100% rename from libpcap-possiblymodified/msdos/common.dj rename to libpcap/msdos/common.dj diff --git a/libpcap-possiblymodified/msdos/makefile b/libpcap/msdos/makefile similarity index 100% rename from libpcap-possiblymodified/msdos/makefile rename to libpcap/msdos/makefile diff --git a/libpcap-possiblymodified/msdos/makefile.dj b/libpcap/msdos/makefile.dj similarity index 100% rename from libpcap-possiblymodified/msdos/makefile.dj rename to libpcap/msdos/makefile.dj diff --git a/libpcap-possiblymodified/msdos/makefile.wc b/libpcap/msdos/makefile.wc similarity index 100% rename from libpcap-possiblymodified/msdos/makefile.wc rename to libpcap/msdos/makefile.wc diff --git a/libpcap-possiblymodified/msdos/ndis2.c b/libpcap/msdos/ndis2.c similarity index 100% rename from libpcap-possiblymodified/msdos/ndis2.c rename to libpcap/msdos/ndis2.c diff --git a/libpcap-possiblymodified/msdos/ndis2.h b/libpcap/msdos/ndis2.h similarity index 100% rename from libpcap-possiblymodified/msdos/ndis2.h rename to libpcap/msdos/ndis2.h diff --git a/libpcap-possiblymodified/msdos/ndis_0.asm b/libpcap/msdos/ndis_0.asm similarity index 100% rename from libpcap-possiblymodified/msdos/ndis_0.asm rename to libpcap/msdos/ndis_0.asm diff --git a/libpcap-possiblymodified/msdos/pkt_rx0.asm b/libpcap/msdos/pkt_rx0.asm similarity index 100% rename from libpcap-possiblymodified/msdos/pkt_rx0.asm rename to libpcap/msdos/pkt_rx0.asm diff --git a/libpcap-possiblymodified/msdos/pkt_rx1.s b/libpcap/msdos/pkt_rx1.s similarity index 100% rename from libpcap-possiblymodified/msdos/pkt_rx1.s rename to libpcap/msdos/pkt_rx1.s diff --git a/libpcap-possiblymodified/msdos/pktdrvr.c b/libpcap/msdos/pktdrvr.c similarity index 100% rename from libpcap-possiblymodified/msdos/pktdrvr.c rename to libpcap/msdos/pktdrvr.c diff --git a/libpcap-possiblymodified/msdos/pktdrvr.h b/libpcap/msdos/pktdrvr.h similarity index 100% rename from libpcap-possiblymodified/msdos/pktdrvr.h rename to libpcap/msdos/pktdrvr.h diff --git a/libpcap-possiblymodified/msdos/readme.dos b/libpcap/msdos/readme.dos similarity index 100% rename from libpcap-possiblymodified/msdos/readme.dos rename to libpcap/msdos/readme.dos diff --git a/libpcap-possiblymodified/nametoaddr.c b/libpcap/nametoaddr.c similarity index 100% rename from libpcap-possiblymodified/nametoaddr.c rename to libpcap/nametoaddr.c diff --git a/libpcap-possiblymodified/net b/libpcap/net similarity index 100% rename from libpcap-possiblymodified/net rename to libpcap/net diff --git a/libpcap-possiblymodified/nlpid.h b/libpcap/nlpid.h similarity index 100% rename from libpcap-possiblymodified/nlpid.h rename to libpcap/nlpid.h diff --git a/libpcap-possiblymodified/optimize.c b/libpcap/optimize.c similarity index 100% rename from libpcap-possiblymodified/optimize.c rename to libpcap/optimize.c diff --git a/libpcap-possiblymodified/packaging/pcap.spec.in b/libpcap/packaging/pcap.spec.in similarity index 100% rename from libpcap-possiblymodified/packaging/pcap.spec.in rename to libpcap/packaging/pcap.spec.in diff --git a/libpcap-possiblymodified/pcap-bpf.c b/libpcap/pcap-bpf.c similarity index 100% rename from libpcap-possiblymodified/pcap-bpf.c rename to libpcap/pcap-bpf.c diff --git a/libpcap-possiblymodified/pcap-bpf.h b/libpcap/pcap-bpf.h similarity index 100% rename from libpcap-possiblymodified/pcap-bpf.h rename to libpcap/pcap-bpf.h diff --git a/libpcap-possiblymodified/pcap-dag.c b/libpcap/pcap-dag.c similarity index 100% rename from libpcap-possiblymodified/pcap-dag.c rename to libpcap/pcap-dag.c diff --git a/libpcap-possiblymodified/pcap-dag.h b/libpcap/pcap-dag.h similarity index 100% rename from libpcap-possiblymodified/pcap-dag.h rename to libpcap/pcap-dag.h diff --git a/libpcap-possiblymodified/pcap-dlpi.c b/libpcap/pcap-dlpi.c similarity index 100% rename from libpcap-possiblymodified/pcap-dlpi.c rename to libpcap/pcap-dlpi.c diff --git a/libpcap-possiblymodified/pcap-dos.c b/libpcap/pcap-dos.c similarity index 100% rename from libpcap-possiblymodified/pcap-dos.c rename to libpcap/pcap-dos.c diff --git a/libpcap-possiblymodified/pcap-dos.h b/libpcap/pcap-dos.h similarity index 100% rename from libpcap-possiblymodified/pcap-dos.h rename to libpcap/pcap-dos.h diff --git a/libpcap-possiblymodified/pcap-enet.c b/libpcap/pcap-enet.c similarity index 100% rename from libpcap-possiblymodified/pcap-enet.c rename to libpcap/pcap-enet.c diff --git a/libpcap-possiblymodified/pcap-int.h b/libpcap/pcap-int.h similarity index 100% rename from libpcap-possiblymodified/pcap-int.h rename to libpcap/pcap-int.h diff --git a/libpcap-possiblymodified/pcap-linux.c b/libpcap/pcap-linux.c similarity index 100% rename from libpcap-possiblymodified/pcap-linux.c rename to libpcap/pcap-linux.c diff --git a/libpcap-possiblymodified/pcap-namedb.h b/libpcap/pcap-namedb.h similarity index 100% rename from libpcap-possiblymodified/pcap-namedb.h rename to libpcap/pcap-namedb.h diff --git a/libpcap-possiblymodified/pcap-nit.c b/libpcap/pcap-nit.c similarity index 100% rename from libpcap-possiblymodified/pcap-nit.c rename to libpcap/pcap-nit.c diff --git a/libpcap-possiblymodified/pcap-nit.h b/libpcap/pcap-nit.h similarity index 100% rename from libpcap-possiblymodified/pcap-nit.h rename to libpcap/pcap-nit.h diff --git a/libpcap-possiblymodified/pcap-null.c b/libpcap/pcap-null.c similarity index 100% rename from libpcap-possiblymodified/pcap-null.c rename to libpcap/pcap-null.c diff --git a/libpcap-possiblymodified/pcap-pf.c b/libpcap/pcap-pf.c similarity index 100% rename from libpcap-possiblymodified/pcap-pf.c rename to libpcap/pcap-pf.c diff --git a/libpcap-possiblymodified/pcap-pf.h b/libpcap/pcap-pf.h similarity index 100% rename from libpcap-possiblymodified/pcap-pf.h rename to libpcap/pcap-pf.h diff --git a/libpcap-possiblymodified/pcap-septel.c b/libpcap/pcap-septel.c similarity index 100% rename from libpcap-possiblymodified/pcap-septel.c rename to libpcap/pcap-septel.c diff --git a/libpcap-possiblymodified/pcap-septel.h b/libpcap/pcap-septel.h similarity index 100% rename from libpcap-possiblymodified/pcap-septel.h rename to libpcap/pcap-septel.h diff --git a/libpcap-possiblymodified/pcap-snit.c b/libpcap/pcap-snit.c similarity index 100% rename from libpcap-possiblymodified/pcap-snit.c rename to libpcap/pcap-snit.c diff --git a/libpcap-possiblymodified/pcap-snoop.c b/libpcap/pcap-snoop.c similarity index 100% rename from libpcap-possiblymodified/pcap-snoop.c rename to libpcap/pcap-snoop.c diff --git a/libpcap-possiblymodified/pcap-stdinc.h b/libpcap/pcap-stdinc.h similarity index 100% rename from libpcap-possiblymodified/pcap-stdinc.h rename to libpcap/pcap-stdinc.h diff --git a/libpcap-possiblymodified/pcap-win32.c b/libpcap/pcap-win32.c similarity index 100% rename from libpcap-possiblymodified/pcap-win32.c rename to libpcap/pcap-win32.c diff --git a/libpcap-possiblymodified/pcap.3 b/libpcap/pcap.3 similarity index 100% rename from libpcap-possiblymodified/pcap.3 rename to libpcap/pcap.3 diff --git a/libpcap-possiblymodified/pcap.c b/libpcap/pcap.c similarity index 100% rename from libpcap-possiblymodified/pcap.c rename to libpcap/pcap.c diff --git a/libpcap-possiblymodified/pcap.h b/libpcap/pcap.h similarity index 100% rename from libpcap-possiblymodified/pcap.h rename to libpcap/pcap.h diff --git a/libpcap-possiblymodified/pcap1.h b/libpcap/pcap1.h similarity index 100% rename from libpcap-possiblymodified/pcap1.h rename to libpcap/pcap1.h diff --git a/libpcap-possiblymodified/pf.h b/libpcap/pf.h similarity index 100% rename from libpcap-possiblymodified/pf.h rename to libpcap/pf.h diff --git a/libpcap-possiblymodified/ppp.h b/libpcap/ppp.h similarity index 100% rename from libpcap-possiblymodified/ppp.h rename to libpcap/ppp.h diff --git a/libpcap/rawss7.h b/libpcap/rawss7.h new file mode 100644 index 000000000..518365267 --- /dev/null +++ b/libpcap/rawss7.h @@ -0,0 +1,105 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 2003 - The tcpdump group. + * + * 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. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#) $Header$ (LBL) + */ + +/* + * This file is never used in libpcap or tcpdump. It is provided as + * documentation linktypes 139 through 142 only. + */ + +/* + * Date: Tue, 09 Sep 2003 09:41:04 -0400 + * From: Jeff Morriss + * To: tcpdump-workers@tcpdump.org + * Subject: [tcpdump-workers] request for LINKTYPE_ + * + * We've had some discussion over on ethereal-dev about a "fake link" or + * "raw SS7" dissector that allows dumping an arbitrary protocol into a + * file without any (otherwise necessary) lower level protocols. The + * common example has been dumping MTP3 into a file without, well, MTP2 or + * M2PA. + * + * We want to store these protocols directly in PCAP file format because + * it's well defined and there isn't another (popular) file format for + * capturing SS7 messages that we can reverse engineer (and we want to read + * these files into Ethereal). Rather than creating a new file format, it's + * a lot easier to just allocate a LINKTYPE_. + * + * Here is the original post thread: + * + * http://ethereal.com/lists/ethereal-dev/200306/threads.html#00200 + * + * July's thread on the subject: + * + * http://ethereal.com/lists/ethereal-dev/200307/threads.html#00124 + * + * August's thread: + * + * http://ethereal.com/lists/ethereal-dev/200308/threads.html#00193 + * + * + * and one of the last messages--which is why I'm mailing you today: + * + * http://ethereal.com/lists/ethereal-dev/200308/msg00193.html + * + * + * Based on the message in the last URL, I'd like to request a new + * LINKTYPE_: LINKTYPE_RAWSS7. + * + * This packets in this file type will contain a header: + */ + +typedef struct _rawss7_hdr { + /* NOTE: These are in network-byte order. */ + guint32 type; + guint16 length; + guint16 spare; +} rawss7_hdr; + +/* + * + * followed by protocol data for whatever protocol 'type' indicates. + * + * There was some discussion about these protocol 'type's being allocated by + * tcpdump-workers as well. In fact it would be handy to have one place to + * allocate such numbers, so what do you think about allocating 3 more (for + * now) LINKTYPE_'s: + */ + +#define LINKTYPE_RAWSS7_MTP2 140 +#define LINKTYPE_RAWSS7_MTP3 141 +#define LINKTYPE_RAWSS7_SCCP 142 + +/* + * + * There is no reason this can't be used to store non-SS7 protocols, but + * it's what we need to use it for now... + * + */ diff --git a/libpcap-possiblymodified/savefile.c b/libpcap/savefile.c similarity index 100% rename from libpcap-possiblymodified/savefile.c rename to libpcap/savefile.c diff --git a/libpcap-possiblymodified/scanner.c b/libpcap/scanner.c similarity index 100% rename from libpcap-possiblymodified/scanner.c rename to libpcap/scanner.c diff --git a/libpcap-possiblymodified/scanner.l b/libpcap/scanner.l similarity index 100% rename from libpcap-possiblymodified/scanner.l rename to libpcap/scanner.l diff --git a/libpcap-possiblymodified/sll.h b/libpcap/sll.h similarity index 100% rename from libpcap-possiblymodified/sll.h rename to libpcap/sll.h diff --git a/libpcap/snprintf.c b/libpcap/snprintf.c new file mode 100644 index 000000000..0c5268f74 --- /dev/null +++ b/libpcap/snprintf.c @@ -0,0 +1,632 @@ +/* + * Copyright (c) 1995-1999 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. 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$ */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifndef lint +static const char rcsid[] _U_ = + "@(#) $Header$"; +#endif + +#include +#include +#include +#include +#include +#include + +#include + +enum format_flags { + minus_flag = 1, + plus_flag = 2, + space_flag = 4, + alternate_flag = 8, + zero_flag = 16 +}; + +/* + * Common state + */ + +struct state { + unsigned char *str; + unsigned char *s; + unsigned char *theend; + size_t sz; + size_t max_sz; + int (*append_char)(struct state *, unsigned char); + int (*reserve)(struct state *, size_t); + /* XXX - methods */ +}; + +#ifndef HAVE_VSNPRINTF +static int +sn_reserve (struct state *state, size_t n) +{ + return state->s + n > state->theend; +} + +static int +sn_append_char (struct state *state, unsigned char c) +{ + if (sn_reserve (state, 1)) { + return 1; + } else { + *state->s++ = c; + return 0; + } +} +#endif + +#if 0 +static int +as_reserve (struct state *state, size_t n) +{ + if (state->s + n > state->theend) { + int off = state->s - state->str; + unsigned char *tmp; + + if (state->max_sz && state->sz >= state->max_sz) + return 1; + + state->sz = max(state->sz * 2, state->sz + n); + if (state->max_sz) + state->sz = min(state->sz, state->max_sz); + tmp = realloc (state->str, state->sz); + if (tmp == NULL) + return 1; + state->str = tmp; + state->s = state->str + off; + state->theend = state->str + state->sz - 1; + } + return 0; +} + +static int +as_append_char (struct state *state, unsigned char c) +{ + if(as_reserve (state, 1)) + return 1; + else { + *state->s++ = c; + return 0; + } +} +#endif + +static int +append_number(struct state *state, + unsigned long num, unsigned base, char *rep, + int width, int prec, int flags, int minusp) +{ + int len = 0; + int i; + + /* given precision, ignore zero flag */ + if(prec != -1) + flags &= ~zero_flag; + else + prec = 1; + /* zero value with zero precision -> "" */ + if(prec == 0 && num == 0) + return 0; + do{ + if((*state->append_char)(state, rep[num % base])) + return 1; + len++; + num /= base; + }while(num); + prec -= len; + /* pad with prec zeros */ + while(prec-- > 0){ + if((*state->append_char)(state, '0')) + return 1; + len++; + } + /* add length of alternate prefix (added later) to len */ + if(flags & alternate_flag && (base == 16 || base == 8)) + len += base / 8; + /* pad with zeros */ + if(flags & zero_flag){ + width -= len; + if(minusp || (flags & space_flag) || (flags & plus_flag)) + width--; + while(width-- > 0){ + if((*state->append_char)(state, '0')) + return 1; + len++; + } + } + /* add alternate prefix */ + if(flags & alternate_flag && (base == 16 || base == 8)){ + if(base == 16) + if((*state->append_char)(state, rep[10] + 23)) /* XXX */ + return 1; + if((*state->append_char)(state, '0')) + return 1; + } + /* add sign */ + if(minusp){ + if((*state->append_char)(state, '-')) + return 1; + len++; + } else if(flags & plus_flag) { + if((*state->append_char)(state, '+')) + return 1; + len++; + } else if(flags & space_flag) { + if((*state->append_char)(state, ' ')) + return 1; + len++; + } + if(flags & minus_flag) + /* swap before padding with spaces */ + for(i = 0; i < len / 2; i++){ + char c = state->s[-i-1]; + state->s[-i-1] = state->s[-len+i]; + state->s[-len+i] = c; + } + width -= len; + while(width-- > 0){ + if((*state->append_char)(state, ' ')) + return 1; + len++; + } + if(!(flags & minus_flag)) + /* swap after padding with spaces */ + for(i = 0; i < len / 2; i++){ + char c = state->s[-i-1]; + state->s[-i-1] = state->s[-len+i]; + state->s[-len+i] = c; + } + + return 0; +} + +static int +append_string (struct state *state, + unsigned char *arg, + int width, + int prec, + int flags) +{ + if(prec != -1) + width -= prec; + else + width -= strlen((char *)arg); + if(!(flags & minus_flag)) + while(width-- > 0) + if((*state->append_char) (state, ' ')) + return 1; + if (prec != -1) { + while (*arg && prec--) + if ((*state->append_char) (state, *arg++)) + return 1; + } else { + while (*arg) + if ((*state->append_char) (state, *arg++)) + return 1; + } + if(flags & minus_flag) + while(width-- > 0) + if((*state->append_char) (state, ' ')) + return 1; + return 0; +} + +static int +append_char(struct state *state, + unsigned char arg, + int width, + int flags) +{ + while(!(flags & minus_flag) && --width > 0) + if((*state->append_char) (state, ' ')) + return 1; + + if((*state->append_char) (state, arg)) + return 1; + while((flags & minus_flag) && --width > 0) + if((*state->append_char) (state, ' ')) + return 1; + + return 0; +} + +/* + * This can't be made into a function... + */ + +#define PARSE_INT_FORMAT(res, arg, unsig) \ +if (long_flag) \ + res = (unsig long)va_arg(arg, unsig long); \ +else if (short_flag) \ + res = (unsig short)va_arg(arg, unsig int); \ +else \ + res = (unsig int)va_arg(arg, unsig int) + +/* + * zyxprintf - return 0 or -1 + */ + +static int +xyzprintf (struct state *state, const char *char_format, va_list ap) +{ + const unsigned char *format = (const unsigned char *)char_format; + unsigned char c; + + while((c = *format++)) { + if (c == '%') { + int flags = 0; + int width = 0; + int prec = -1; + int long_flag = 0; + int short_flag = 0; + + /* flags */ + while((c = *format++)){ + if(c == '-') + flags |= minus_flag; + else if(c == '+') + flags |= plus_flag; + else if(c == ' ') + flags |= space_flag; + else if(c == '#') + flags |= alternate_flag; + else if(c == '0') + flags |= zero_flag; + else + break; + } + + if((flags & space_flag) && (flags & plus_flag)) + flags ^= space_flag; + + if((flags & minus_flag) && (flags & zero_flag)) + flags ^= zero_flag; + + /* width */ + if (isdigit(c)) + do { + width = width * 10 + c - '0'; + c = *format++; + } while(isdigit(c)); + else if(c == '*') { + width = va_arg(ap, int); + c = *format++; + } + + /* precision */ + if (c == '.') { + prec = 0; + c = *format++; + if (isdigit(c)) + do { + prec = prec * 10 + c - '0'; + c = *format++; + } while(isdigit(c)); + else if (c == '*') { + prec = va_arg(ap, int); + c = *format++; + } + } + + /* size */ + + if (c == 'h') { + short_flag = 1; + c = *format++; + } else if (c == 'l') { + long_flag = 1; + c = *format++; + } + + switch (c) { + case 'c' : + if(append_char(state, va_arg(ap, int), width, flags)) + return -1; + break; + case 's' : + if (append_string(state, + va_arg(ap, unsigned char*), + width, + prec, + flags)) + return -1; + break; + case 'd' : + case 'i' : { + long arg; + unsigned long num; + int minusp = 0; + + PARSE_INT_FORMAT(arg, ap, signed); + + if (arg < 0) { + minusp = 1; + num = -arg; + } else + num = arg; + + if (append_number (state, num, 10, "0123456789", + width, prec, flags, minusp)) + return -1; + break; + } + case 'u' : { + unsigned long arg; + + PARSE_INT_FORMAT(arg, ap, unsigned); + + if (append_number (state, arg, 10, "0123456789", + width, prec, flags, 0)) + return -1; + break; + } + case 'o' : { + unsigned long arg; + + PARSE_INT_FORMAT(arg, ap, unsigned); + + if (append_number (state, arg, 010, "01234567", + width, prec, flags, 0)) + return -1; + break; + } + case 'x' : { + unsigned long arg; + + PARSE_INT_FORMAT(arg, ap, unsigned); + + if (append_number (state, arg, 0x10, "0123456789abcdef", + width, prec, flags, 0)) + return -1; + break; + } + case 'X' :{ + unsigned long arg; + + PARSE_INT_FORMAT(arg, ap, unsigned); + + if (append_number (state, arg, 0x10, "0123456789ABCDEF", + width, prec, flags, 0)) + return -1; + break; + } + case 'p' : { + unsigned long arg = (unsigned long)va_arg(ap, void*); + + if (append_number (state, arg, 0x10, "0123456789ABCDEF", + width, prec, flags, 0)) + return -1; + break; + } + case 'n' : { + int *arg = va_arg(ap, int*); + *arg = state->s - state->str; + break; + } + case '\0' : + --format; + /* FALLTHROUGH */ + case '%' : + if ((*state->append_char)(state, c)) + return -1; + break; + default : + if ( (*state->append_char)(state, '%') + || (*state->append_char)(state, c)) + return -1; + break; + } + } else + if ((*state->append_char) (state, c)) + return -1; + } + return 0; +} + +#ifndef HAVE_SNPRINTF +int +snprintf (char *str, size_t sz, const char *format, ...) +{ + va_list args; + int ret; + + va_start(args, format); + ret = vsnprintf (str, sz, format, args); + +#ifdef PARANOIA + { + int ret2; + char *tmp; + + tmp = malloc (sz); + if (tmp == NULL) + abort (); + + ret2 = vsprintf (tmp, format, args); + if (ret != ret2 || strcmp(str, tmp)) + abort (); + free (tmp); + } +#endif + + va_end(args); + return ret; +} +#endif + +#if 0 +#ifndef HAVE_ASPRINTF +int +asprintf (char **ret, const char *format, ...) +{ + va_list args; + int val; + + va_start(args, format); + val = vasprintf (ret, format, args); + +#ifdef PARANOIA + { + int ret2; + char *tmp; + tmp = malloc (val + 1); + if (tmp == NULL) + abort (); + + ret2 = vsprintf (tmp, format, args); + if (val != ret2 || strcmp(*ret, tmp)) + abort (); + free (tmp); + } +#endif + + va_end(args); + return val; +} +#endif + +#ifndef HAVE_ASNPRINTF +int +asnprintf (char **ret, size_t max_sz, const char *format, ...) +{ + va_list args; + int val; + + va_start(args, format); + val = vasnprintf (ret, max_sz, format, args); + +#ifdef PARANOIA + { + int ret2; + char *tmp; + tmp = malloc (val + 1); + if (tmp == NULL) + abort (); + + ret2 = vsprintf (tmp, format, args); + if (val != ret2 || strcmp(*ret, tmp)) + abort (); + free (tmp); + } +#endif + + va_end(args); + return val; +} +#endif + +#ifndef HAVE_VASPRINTF +int +vasprintf (char **ret, const char *format, va_list args) +{ + return vasnprintf (ret, 0, format, args); +} +#endif + + +#ifndef HAVE_VASNPRINTF +int +vasnprintf (char **ret, size_t max_sz, const char *format, va_list args) +{ + int st; + size_t len; + struct state state; + + state.max_sz = max_sz; + state.sz = 1; + state.str = malloc(state.sz); + if (state.str == NULL) { + *ret = NULL; + return -1; + } + state.s = state.str; + state.theend = state.s + state.sz - 1; + state.append_char = as_append_char; + state.reserve = as_reserve; + + st = xyzprintf (&state, format, args); + if (st) { + free (state.str); + *ret = NULL; + return -1; + } else { + char *tmp; + + *state.s = '\0'; + len = state.s - state.str; + tmp = realloc (state.str, len+1); + if (tmp == NULL) { + free (state.str); + *ret = NULL; + return -1; + } + *ret = tmp; + return len; + } +} +#endif +#endif + +#ifndef HAVE_VSNPRINTF +int +vsnprintf (char *str, size_t sz, const char *format, va_list args) +{ + struct state state; + int ret; + unsigned char *ustr = (unsigned char *)str; + + state.max_sz = 0; + state.sz = sz; + state.str = ustr; + state.s = ustr; + state.theend = ustr + sz - 1; + state.append_char = sn_append_char; + state.reserve = sn_reserve; + + ret = xyzprintf (&state, format, args); + *state.s = '\0'; + if (ret) + return sz; + else + return state.s - state.str; +} +#endif + diff --git a/libpcap-possiblymodified/sunatmpos.h b/libpcap/sunatmpos.h similarity index 100% rename from libpcap-possiblymodified/sunatmpos.h rename to libpcap/sunatmpos.h diff --git a/libpcap-possiblymodified/tokdefs.h b/libpcap/tokdefs.h similarity index 100% rename from libpcap-possiblymodified/tokdefs.h rename to libpcap/tokdefs.h diff --git a/libpcap-possiblymodified/version.h b/libpcap/version.h similarity index 100% rename from libpcap-possiblymodified/version.h rename to libpcap/version.h diff --git a/scripts/Makefile b/scripts/Makefile index e059be12f..512c51a69 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -1,13 +1,13 @@ CC=gcc CPP=g++ -INCLUDE_FLAGS= -I.. -I../nbase -I../libpcap-possiblymodified -LINK_FLAGS=-L.. -L../nbase -L../libpcap-possiblymodified +INCLUDE_FLAGS= -I.. -I../nbase -I../libpcap +LINK_FLAGS=-L.. -L../nbase -L../libpcap NMAP_OBJS=../osscan.o ../nmap_error.o ../utils.o ../tcpip.o ../output.o ../nmap.o ../scan_engine.o ../portlist.o ../timing.o ../nmap_rpc.o ../charpool.o ../services.o ../targets.o ../idle_scan.o ../MACLookup.o ../protocols.o ../FingerPrintResults.o ../NmapOps.o ../TargetGroup.o ../Target.o ../NmapOutputTable.o ../service_scan.o ../nsock/src/libnsock.a DEFINES=-DHAVE_CONFIG_H=1 DATAFILES = nmap-os-fingerprints nmap-service-probes nmap-services nmap-rpc nmap-protocols nmap-mac-prefixes SHTOOL = ../shtool -LIBPCAPDIR=libpcap-possiblymodified +LIBPCAPDIR=libpcap NBASEDIR=nbase all: fingermatch fingerdiff servicematch @@ -83,34 +83,43 @@ distro: /usr/tmp/nmap-$(NMAP_VERSION)/mswin32 $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/$(LIBPCAPDIR) - cd ../$(LIBPCAPDIR); cp -ra --parents SUNOS4/nit_if.o.sparc \ - SUNOS4/nit_if.o.sun3 SUNOS4/nit_if.o.sun4c.4.0.3c CHANGES \ - CREDITS FILES INSTALL.txt LICENSE Makefile.in \ - NMAP_MODIFICATIONS README README.aix README.linux \ - README.tru64 TODO VERSION acconfig.h aclocal.m4 \ - arcnet.h bpf_dump.c bpf_image.c config.guess config.h.in \ - config.sub configure configure.ac etherent.c ethertype.h gencode.c \ - gencode.h grammar.y inet.c install-sh llc.h mkdep nametoaddr.c \ - nlpid.h optimize.c pcap-bpf.c pcap-dlpi.c pcap-enet.c pcap-int.h \ - pcap-linux.c pcap-namedb.h pcap-nit.c pcap-nit.h pcap-null.c \ - pcap-pf.c pcap-pf.h pcap-snit.c pcap-snoop.c pcap.3 pcap.c pcap.h \ - ppp.h savefile.c scanner.c scanner.l sll.h tokdefs.h \ - bpf/net/bpf_filter.c bpf/net/bpf.h lbl/os-aix4.h lbl/os-osf4.h \ - lbl/os-solaris2.h lbl/os-sunos4.h lbl/os-ultrix4.h lbl/os-hpux11.h \ - lbl/os-osf5.h atmuni31.h config.h fad-getad.c fad-gifc.c \ - fad-glifc.c fad-null.c fad-win32.c pcap-bpf.h pcap-dag.c \ - pcap-dag.h version.h grammar.c pcap-stdinc.h pcap-win32.c pf.h \ - rawss7.h README.dag README.hpux README.Win32 snprintf.c \ - sunatmpos.h Win32/Include/addrinfo.h Win32/Include/Gnuc.h \ - Win32/Include/arpa/nameser.h Win32/Include/net/if.h \ - Win32/Include/net/netdb.h Win32/Include/net/paths.h \ - Win32/Include/bittypes.h Win32/Include/cdecl_ext.h \ - Win32/Include/inetprivate.h Win32/Include/ip6_misc.h \ - Win32/Include/sockstorage.h Win32/Prj/libpcap.dsp \ - Win32/Prj/libpcap.dsw Win32/Src/getnetbynm.c Win32/Src/ffs.c \ - Win32/Src/getaddrinfo.c Win32/Src/getnetent.c Win32/Src/getopt.c \ - Win32/Src/getservent.c Win32/Src/inet_aton.c Win32/Src/inet_net.c \ - Win32/Src/inet_pton.c /usr/tmp/nmap-$(NMAP_VERSION)/$(LIBPCAPDIR) + cd ../$(LIBPCAPDIR); cp -ra --parents acconfig.h aclocal.m4 arcnet.h \ + atmuni31.h bpf/net/bpf.h bpf/net/bpf_filter.c \ + bpf_dump.c bpf_image.c CHANGES \ + ChmodBPF/ChmodBPF ChmodBPF/StartupParameters.plist config.guess \ + config.h config.h.in config.log config.status config.sub \ + configure configure.ac CREDITS doc/pcap.txt doc/pcap.xml \ + doc/pcap.html etherent.c ethertype.h fad-getad.c fad-gifc.c \ + fad-glifc.c fad-null.c fad-win32.c FILES gencode.c gencode.h \ + grammar.c grammar.y inet.c install-sh INSTALL.txt lbl/os-sunos4.h \ + lbl/os-ultrix4.h lbl/os-aix4.h lbl/os-osf4.h lbl/os-hpux11.h \ + lbl/os-osf5.h lbl/os-solaris2.h LICENSE llc.h Makefile.in \ + missing/snprintf.c mkdep msdos/makefile.wc msdos/bin2c.c \ + msdos/pkt_rx0.asm msdos/pktdrvr.h msdos/ndis2.h msdos/ndis2.c \ + msdos/pkt_rx1.s msdos/common.dj msdos/makefile msdos/pktdrvr.c \ + msdos/readme.dos msdos/ndis_0.asm msdos/makefile.dj nametoaddr.c \ + nlpid.h NMAP_MODIFICATIONS optimize.c packaging/pcap.spec.in \ + packaging/pcap.spec pcap1.h pcap.3 pcap-bpf.c pcap-bpf.h pcap.c \ + pcap-dag.c pcap-dag.h pcap-dlpi.c pcap-dos.c pcap-dos.h \ + pcap-enet.c pcap.h pcap-int.h pcap-linux.c pcap-namedb.h \ + pcap-nit.c pcap-nit.h pcap-null.c pcap-pf.c pcap-pf.h \ + pcap-septel.c pcap-septel.h pcap-snit.c pcap-snoop.c \ + pcap-stdinc.h pcap-win32.c pf.h ppp.h README README.aix \ + README.dag README.hpux README.linux README.macosx README.septel \ + README.tru64 README.Win32 savefile.c scanner.c scanner.l sll.h \ + sunatmpos.h SUNOS4/nit_if.o.sun4c.4.0.3c SUNOS4/nit_if.o.sun3 \ + SUNOS4/nit_if.o.sparc TODO tokdefs.h VERSION version.h \ + Win32/Include/addrinfo.h Win32/Include/Gnuc.h \ + Win32/Include/arpa/nameser.h Win32/Include/cdecl_ext.h \ + Win32/Include/ip6_misc.h Win32/Include/bittypes.h \ + Win32/Include/net/if.h Win32/Include/net/paths.h \ + Win32/Include/net/netdb.h Win32/Include/sockstorage.h \ + Win32/Include/inetprivate.h Win32/Src/getservent.c \ + Win32/Src/getaddrinfo.c Win32/Src/ffs.c Win32/Src/getnetbynm.c \ + Win32/Src/inet_net.c Win32/Src/getnetent.c Win32/Src/getopt.c \ + Win32/Src/inet_aton.c Win32/Src/inet_pton.c Win32/Prj/libpcap.dsw \ + Win32/Prj/libpcap.dsp \ + /usr/tmp/nmap-$(NMAP_VERSION)/$(LIBPCAPDIR) $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/docs cd ../docs; cp -ra README nmap_gpgkeys.txt \ nmap-fingerprinting-article.txt \