From 63f2b8c3dec936eeb67135ec471f270f41aac9ee Mon Sep 17 00:00:00 2001 From: fyodor Date: Thu, 26 Jan 2006 09:50:57 +0000 Subject: [PATCH] Nmap 3.999 truly just about ready now --- CHANGELOG | 34 +++++++++---- Makefile.in | 2 +- docs/nmap.1 | 2 +- docs/nmap.usage.txt | 2 +- libpcap/configure | 2 +- libpcre/Makefile.in | 6 --- libpcre/NON-UNIX-USE | 2 +- libpcre/{config.in => config.h.in} | 2 +- libpcre/configure.ac | 10 ++-- libpcre/libpcre.vcproj | 3 -- libpcre/{pcre.in => pcre.h.in} | 0 libpcre/pcre_compile.c | 18 +++++-- libpcre/pcre_config.c | 2 +- libpcre/pcre_dfa_exec.c | 40 ++++++++-------- libpcre/pcre_exec.c | 34 ++++++------- libpcre/pcre_fullinfo.c | 2 +- libpcre/pcre_info.c | 2 +- libpcre/pcre_internal.h | 19 ++++++-- .../{pcre_printint.c => pcre_printint.src} | 15 +++--- libpcre/pcre_refcount.c | 2 +- libpcre/pcre_study.c | 2 +- libpcre/pcre_tables.c | 7 +-- libpcre/pcre_try_flipped.c | 2 +- libpcre/pcre_version.c | 2 +- libpcre/pcre_winconfig.h | 2 +- libpcre/pcre_xclass.c | 4 +- libpcre/pcreposix.c | 8 ++-- libpcre/ucp.h | 2 - mswin32/nsis/Nmap.nsi | 2 +- nmap_winconfig.h | 2 +- scripts/Makefile | 6 +-- tcpip.cc | 2 +- tty.cc | 48 +++++++++---------- 33 files changed, 156 insertions(+), 132 deletions(-) rename libpcre/{config.in => config.h.in} (99%) rename libpcre/{pcre.in => pcre.h.in} (100%) rename libpcre/{pcre_printint.c => pcre_printint.src} (96%) diff --git a/CHANGELOG b/CHANGELOG index 2c4800340..98b7eb099 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,32 @@ # Nmap Changelog ($Id$); -*-text-*- +3.999 + +o Added runtime interaction support to Windows, thanks to patches from + Andrew Lutomirski (luto(a)myrealbox.com) and Gisle Vanem (giva(a)bgnett.no). + +o Changed a couple lines of tcpip.cc (put certain IP header fields in + host byte order rather than NBO) to (hopefully) support Mac OS X on + Intel. Thanks to Kurt Grutzmacher (grutz(a)jingojango.net) for the + patch. + +o Upgraded the included LibPCRE from version 6.3 to 6.4. There was a + report of version detection crashes on the new Intel-based MACs with + 6.3. + +o Fixed an issue in which the installer would malfunction in rare + issues when installing to a directory with spaces in it. Thanks to + Thierry Zoller (Thierry(a)Zoller.lu) for the report. + 3.99 +o Integrated all remaining 2005 service submissions. The DB now has + surpassed 3,000 signatures for the first time. There now are 3,153 + signatures for 381 service protocols. Those protocols span the + gamut from abc, acap, afp, and afs to zebedee, zebra, and + zenimaging. It even covers obscure protocols such as http, ftp, + smtp, and ssh :). Thanks to Version Detection Czar Doug Hoyte for + his excellent work on this. + o Created a Windows executable installer using the open source NSIS (Nullsoft Scriptable Install System). It handles Pcap installation, registry performance changes, and adding Nmap to your cmd.exe @@ -17,14 +43,6 @@ o Fixed compilation to again work with gcc-derivatives such as MingW. Thanks to Gisle Vanem (giva(a)bgnett.no) for sending the patches -o Integrated all remaining 2005 service submissions. The DB now has - surpassed 3,000 signatures for the first time. There now are 3,153 - signatures for 381 service protocols. Those protocols span the - gamut from abc, acap, afp, and afs to zebedee, zebra, and - zenimaging. It even covers obscure protocols such as http, ftp, - smtp, and ssh :). Thanks to Version Detection Czar Doug Hoyte for - his excellent work on this. - 3.98BETA1 o Added run time interaction as documented at diff --git a/Makefile.in b/Makefile.in index 9cd9a8d88..fe285bc38 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -export NMAP_VERSION = 3.99 +export NMAP_VERSION = 3.999 NMAP_NAME= Nmap NMAP_URL= http://www.insecure.org/nmap/ NMAP_PLATFORM=@host@ diff --git a/docs/nmap.1 b/docs/nmap.1 index 66055aad3..0dab44d05 100644 --- a/docs/nmap.1 +++ b/docs/nmap.1 @@ -2,7 +2,7 @@ .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. -.TH "NMAP" "1" "01/24/2006" "" "Nmap Reference Guide" +.TH "NMAP" "1" "01/26/2006" "" "Nmap Reference Guide" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) diff --git a/docs/nmap.usage.txt b/docs/nmap.usage.txt index 520c7b495..0245f2a9d 100644 --- a/docs/nmap.usage.txt +++ b/docs/nmap.usage.txt @@ -1,4 +1,4 @@ -Nmap 3.99 ( http://www.insecure.org/nmap/ ) +Nmap 3.999 ( http://www.insecure.org/nmap/ ) Usage: nmap [Scan Type(s)] [Options] {target specification} TARGET SPECIFICATION: Can pass hostnames, IP addresses, networks, etc. diff --git a/libpcap/configure b/libpcap/configure index bd8a1b82a..7894ef6bf 100755 --- a/libpcap/configure +++ b/libpcap/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 2864 . +# From configure.ac Revision: 2867 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # diff --git a/libpcre/Makefile.in b/libpcre/Makefile.in index fe1b601c3..e9b83e8ef 100644 --- a/libpcre/Makefile.in +++ b/libpcre/Makefile.in @@ -122,7 +122,6 @@ OBJ = pcre_chartables.@OBJEXT@ \ pcre_globals.@OBJEXT@ \ pcre_info.@OBJEXT@ \ pcre_maketables.@OBJEXT@ \ - pcre_printint.@OBJEXT@ \ pcre_refcount.@OBJEXT@ \ pcre_study.@OBJEXT@ \ pcre_tables.@OBJEXT@ \ @@ -185,11 +184,6 @@ pcre_maketables.@OBJEXT@: Makefile config.h pcre.h \ $(CC) -c $(CFLAGS) $(INCLS) $(DEFS) $(POSIX_MALLOC_THRESHOLD) \ $(top_srcdir)/pcre_maketables.c -pcre_printint.@OBJEXT@: Makefile config.h pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_printint.c - $(CC) -c $(CFLAGS) $(INCLS) $(DEFS) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_printint.c - pcre_refcount.@OBJEXT@: Makefile config.h pcre.h \ $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_refcount.c $(CC) -c $(CFLAGS) $(INCLS) $(DEFS) $(POSIX_MALLOC_THRESHOLD) \ diff --git a/libpcre/NON-UNIX-USE b/libpcre/NON-UNIX-USE index b7fe4301a..fc02ba154 100644 --- a/libpcre/NON-UNIX-USE +++ b/libpcre/NON-UNIX-USE @@ -46,7 +46,7 @@ configure.in. write pcre.h (3) Compile dftables.c as a stand-alone program, and then run it with -the single argument "chartables.c". This generates a set of standard +the single argument "pcre_chartables.c". This generates a set of standard character tables and writes them to that file. rem Mark Tetrode's commands diff --git a/libpcre/config.in b/libpcre/config.h.in similarity index 99% rename from libpcre/config.in rename to libpcre/config.h.in index fc17ddd13..a6d1451db 100644 --- a/libpcre/config.in +++ b/libpcre/config.h.in @@ -23,7 +23,7 @@ this can be done via --enable-ebcdic. */ before the definition of an exported function, define this macro to contain the relevant magic. It apears at the start of every exported function. */ -#define EXPORT +#define PCRE_EXPORT /* Define to empty if the "const" keyword does not work. */ diff --git a/libpcre/configure.ac b/libpcre/configure.ac index 78035c8d7..425bdebd9 100644 --- a/libpcre/configure.ac +++ b/libpcre/configure.ac @@ -18,10 +18,10 @@ dnl A safety precaution AC_PREREQ(2.57) -dnl Arrange to build config.h from config.in. Note that pcre.h is +dnl Arrange to build config.h from config.h.in. Note that pcre.h is dnl built differently, as it is just a "substitution" file. dnl Manual says this macro should come right after AC_INIT. -AC_CONFIG_HEADER(config.h:config.in) +AC_CONFIG_HEADER(config.h) dnl Provide the current PCRE version information. Do not use numbers dnl with leading zeros for the minor version, as they end up in a C @@ -30,8 +30,8 @@ dnl digits for minor numbers less than 10. There are unlikely to be dnl that many releases anyway. PCRE_MAJOR=6 -PCRE_MINOR=3 -PCRE_DATE=15-Aug-2005 +PCRE_MINOR=4 +PCRE_DATE=05-Sep-2005 PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR} dnl Default values for miscellaneous macros @@ -201,4 +201,4 @@ if test "x$enable_shared" = "xno" ; then fi dnl This must be last; it determines what files are written as well as config.h -AC_OUTPUT(Makefile pcre.h:pcre.in) +AC_OUTPUT(Makefile pcre.h:pcre.h.in) diff --git a/libpcre/libpcre.vcproj b/libpcre/libpcre.vcproj index cefddcf22..c4565baab 100644 --- a/libpcre/libpcre.vcproj +++ b/libpcre/libpcre.vcproj @@ -129,9 +129,6 @@ - - diff --git a/libpcre/pcre.in b/libpcre/pcre.h.in similarity index 100% rename from libpcre/pcre.in rename to libpcre/pcre.h.in diff --git a/libpcre/pcre_compile.c b/libpcre/pcre_compile.c index 228995252..9850399a8 100644 --- a/libpcre/pcre_compile.c +++ b/libpcre/pcre_compile.c @@ -45,6 +45,15 @@ supporting internal functions that are not used by other modules. */ #include "pcre_internal.h" +/* When DEBUG is defined, we need the pcre_printint() function, which is also +used by pcretest. DEBUG is not defined when building a production library. */ + +#ifdef DEBUG +#include "pcre_printint.src" +#endif + + + /************************************************* * Code parameters and static tables * *************************************************/ @@ -3839,7 +3848,7 @@ Returns: pointer to compiled data block, or NULL on error, with errorptr and erroroffset set */ -EXPORT pcre * +PCRE_EXPORT pcre * pcre_compile(const char *pattern, int options, const char **errorptr, int *erroroffset, const unsigned char *tables) { @@ -3847,7 +3856,7 @@ return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables); } -EXPORT pcre * +PCRE_EXPORT pcre * pcre_compile2(const char *pattern, int options, int *errorcodeptr, const char **errorptr, int *erroroffset, const unsigned char *tables) { @@ -5000,7 +5009,8 @@ if (reqbyte >= 0 && re->options |= PCRE_REQCHSET; } -/* Print out the compiled data for debugging */ +/* Print out the compiled data if debugging is enabled. This is never the +case when building a production library. */ #ifdef DEBUG @@ -5038,7 +5048,7 @@ if ((re->options & PCRE_REQCHSET) != 0) else printf("Req char = \\x%02x%s\n", ch, caseless); } -_pcre_printint(re, stdout); +pcre_printint(re, stdout); /* This check is done here in the debugging case so that the code that was compiled can be seen. */ diff --git a/libpcre/pcre_config.c b/libpcre/pcre_config.c index 04029a946..5538a70a3 100644 --- a/libpcre/pcre_config.c +++ b/libpcre/pcre_config.c @@ -58,7 +58,7 @@ Arguments: Returns: 0 if data returned, negative on error */ -EXPORT int +PCRE_EXPORT int pcre_config(int what, void *where) { switch (what) diff --git a/libpcre/pcre_dfa_exec.c b/libpcre/pcre_dfa_exec.c index 710157043..c68f2329f 100644 --- a/libpcre/pcre_dfa_exec.c +++ b/libpcre/pcre_dfa_exec.c @@ -758,7 +758,7 @@ for (;;) if (clen > 0) { int rqdtype, category; - category = ucp_findchar(c, &chartype, &othercase); + category = _pcre_ucp_findchar(c, &chartype, &othercase); rqdtype = code[1]; if (rqdtype >= 128) { @@ -865,7 +865,7 @@ for (;;) if (count > 0) { ADD_ACTIVE(state_offset + 3, 0); } if (clen > 0) { - int category = ucp_findchar(c, &chartype, &othercase); + int category = _pcre_ucp_findchar(c, &chartype, &othercase); int rqdtype = code[2]; if ((d == OP_PROP) == (rqdtype == ((rqdtype >= 128)? (category + 128) : chartype))) @@ -878,7 +878,7 @@ for (;;) case OP_EXTUNI_EXTRA + OP_TYPEMINPLUS: count = current_state->count; /* Already matched */ if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); } - if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M) + if (clen > 0 && _pcre_ucp_findchar(c, &chartype, &othercase) != ucp_M) { const uschar *nptr = ptr + clen; int ncount = 0; @@ -887,7 +887,7 @@ for (;;) int nd; int ndlen = 1; GETCHARLEN(nd, nptr, ndlen); - if (ucp_findchar(nd, &chartype, &othercase) != ucp_M) break; + if (_pcre_ucp_findchar(nd, &chartype, &othercase) != ucp_M) break; ncount++; nptr += ndlen; } @@ -911,7 +911,7 @@ for (;;) ADD_ACTIVE(state_offset + 3, 0); if (clen > 0) { - int category = ucp_findchar(c, &chartype, &othercase); + int category = _pcre_ucp_findchar(c, &chartype, &othercase); int rqdtype = code[2]; if ((d == OP_PROP) == (rqdtype == ((rqdtype >= 128)? (category + 128) : chartype))) @@ -932,7 +932,7 @@ for (;;) QS2: ADD_ACTIVE(state_offset + 2, 0); - if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M) + if (clen > 0 && _pcre_ucp_findchar(c, &chartype, &othercase) != ucp_M) { const uschar *nptr = ptr + clen; int ncount = 0; @@ -941,7 +941,7 @@ for (;;) int nd; int ndlen = 1; GETCHARLEN(nd, nptr, ndlen); - if (ucp_findchar(nd, &chartype, &othercase) != ucp_M) break; + if (_pcre_ucp_findchar(nd, &chartype, &othercase) != ucp_M) break; ncount++; nptr += ndlen; } @@ -958,7 +958,7 @@ for (;;) count = current_state->count; /* Number already matched */ if (clen > 0) { - int category = ucp_findchar(c, &chartype, &othercase); + int category = _pcre_ucp_findchar(c, &chartype, &othercase); int rqdtype = code[4]; if ((d == OP_PROP) == (rqdtype == ((rqdtype >= 128)? (category + 128) : chartype))) @@ -978,7 +978,7 @@ for (;;) if (codevalue != OP_EXTUNI_EXTRA + OP_TYPEEXACT) { ADD_ACTIVE(state_offset + 4, 0); } count = current_state->count; /* Number already matched */ - if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M) + if (clen > 0 && _pcre_ucp_findchar(c, &chartype, &othercase) != ucp_M) { const uschar *nptr = ptr + clen; int ncount = 0; @@ -987,7 +987,7 @@ for (;;) int nd; int ndlen = 1; GETCHARLEN(nd, nptr, ndlen); - if (ucp_findchar(nd, &chartype, &othercase) != ucp_M) break; + if (_pcre_ucp_findchar(nd, &chartype, &othercase) != ucp_M) break; ncount++; nptr += ndlen; } @@ -1022,11 +1022,11 @@ for (;;) /* If we have Unicode property support, we can use it to test the other case of the character, if there is one. The result of - ucp_findchar() is < 0 if the char isn't found, and othercase is + _pcre_ucp_findchar() is < 0 if the char isn't found, and othercase is returned as zero if there isn't another case. */ #ifdef SUPPORT_UCP - if (ucp_findchar(c, &chartype, &othercase) < 0) + if (_pcre_ucp_findchar(c, &chartype, &othercase) < 0) #endif othercase = -1; @@ -1050,7 +1050,7 @@ for (;;) to wait for them to pass before continuing. */ case OP_EXTUNI: - if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M) + if (clen > 0 && _pcre_ucp_findchar(c, &chartype, &othercase) != ucp_M) { const uschar *nptr = ptr + clen; int ncount = 0; @@ -1058,7 +1058,7 @@ for (;;) { int nclen = 1; GETCHARLEN(c, nptr, nclen); - if (ucp_findchar(c, &chartype, &othercase) != ucp_M) break; + if (_pcre_ucp_findchar(c, &chartype, &othercase) != ucp_M) break; ncount++; nptr += nclen; } @@ -1096,7 +1096,7 @@ for (;;) if (utf8 && c >= 128) { #ifdef SUPPORT_UCP - if (ucp_findchar(d, &chartype, &otherd) < 0) otherd = -1; + if (_pcre_ucp_findchar(d, &chartype, &otherd) < 0) otherd = -1; #endif /* SUPPORT_UCP */ } else @@ -1123,7 +1123,7 @@ for (;;) if (utf8 && c >= 128) { #ifdef SUPPORT_UCP - if (ucp_findchar(c, &chartype, &otherd) < 0) otherd = -1; + if (_pcre_ucp_findchar(c, &chartype, &otherd) < 0) otherd = -1; #endif /* SUPPORT_UCP */ } else @@ -1150,7 +1150,7 @@ for (;;) if (utf8 && c >= 128) { #ifdef SUPPORT_UCP - if (ucp_findchar(c, &chartype, &otherd) < 0) otherd = -1; + if (_pcre_ucp_findchar(c, &chartype, &otherd) < 0) otherd = -1; #endif /* SUPPORT_UCP */ } else @@ -1181,7 +1181,7 @@ for (;;) if (utf8 && c >= 128) { #ifdef SUPPORT_UCP - if (ucp_findchar(d, &chartype, &otherd) < 0) otherd = -1; + if (_pcre_ucp_findchar(d, &chartype, &otherd) < 0) otherd = -1; #endif /* SUPPORT_UCP */ } else @@ -1424,7 +1424,6 @@ for (;;) /*-----------------------------------------------------------------*/ case OP_ONCE: { - const uschar *endcode; int local_offsets[2]; int local_workspace[1000]; @@ -1446,7 +1445,6 @@ for (;;) const uschar *end_subpattern = code; int charcount = local_offsets[1] - local_offsets[0]; int next_state_offset, repeat_state_offset; - BOOL is_repeated; do { end_subpattern += GET(end_subpattern, 1); } while (*end_subpattern == OP_ALT); @@ -1613,7 +1611,7 @@ Returns: > 0 => number of match offset pairs placed in offsets < -1 => some kind of unexpected problem */ -EXPORT int +PCRE_EXPORT int pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data, const char *subject, int length, int start_offset, int options, int *offsets, int offsetcount, int *workspace, int wscount) diff --git a/libpcre/pcre_exec.c b/libpcre/pcre_exec.c index 65173e2ba..133b3a743 100644 --- a/libpcre/pcre_exec.c +++ b/libpcre/pcre_exec.c @@ -1354,7 +1354,7 @@ for (;;) { int chartype, rqdtype; int othercase; - int category = ucp_findchar(c, &chartype, &othercase); + int category = _pcre_ucp_findchar(c, &chartype, &othercase); rqdtype = *(++ecode); ecode++; @@ -1381,7 +1381,7 @@ for (;;) { int chartype; int othercase; - int category = ucp_findchar(c, &chartype, &othercase); + int category = _pcre_ucp_findchar(c, &chartype, &othercase); if (category == ucp_M) RRETURN(MATCH_NOMATCH); while (eptr < md->end_subject) { @@ -1390,7 +1390,7 @@ for (;;) { GETCHARLEN(c, eptr, len); } - category = ucp_findchar(c, &chartype, &othercase); + category = _pcre_ucp_findchar(c, &chartype, &othercase); if (category != ucp_M) break; eptr += len; } @@ -1841,7 +1841,7 @@ for (;;) ecode += length; /* If we have Unicode property support, we can use it to test the other - case of the character, if there is one. The result of ucp_findchar() is + case of the character, if there is one. The result of _pcre_ucp_findchar() is < 0 if the char isn't found, and othercase is returned as zero if there isn't one. */ @@ -1850,7 +1850,7 @@ for (;;) #ifdef SUPPORT_UCP int chartype; int othercase; - if (ucp_findchar(fc, &chartype, &othercase) < 0 || dc != othercase) + if (_pcre_ucp_findchar(fc, &chartype, &othercase) < 0 || dc != othercase) #endif RRETURN(MATCH_NOMATCH); } @@ -1920,7 +1920,7 @@ for (;;) int othercase; int chartype; if ((ims & PCRE_CASELESS) != 0 && - ucp_findchar(fc, &chartype, &othercase) >= 0 && + _pcre_ucp_findchar(fc, &chartype, &othercase) >= 0 && othercase > 0) oclength = _pcre_ord2utf8(othercase, occhars); #endif /* SUPPORT_UCP */ @@ -2439,7 +2439,7 @@ for (;;) for (i = 1; i <= min; i++) { GETCHARINC(c, eptr); - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if ((*prop_test_variable == prop_test_against) == prop_fail_result) RRETURN(MATCH_NOMATCH); } @@ -2453,7 +2453,7 @@ for (;;) for (i = 1; i <= min; i++) { GETCHARINCTEST(c, eptr); - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); while (eptr < md->end_subject) { @@ -2462,7 +2462,7 @@ for (;;) { GETCHARLEN(c, eptr, len); } - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if (prop_category != ucp_M) break; eptr += len; } @@ -2632,7 +2632,7 @@ for (;;) if (rrc != MATCH_NOMATCH) RRETURN(rrc); if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); GETCHARINC(c, eptr); - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if ((*prop_test_variable == prop_test_against) == prop_fail_result) RRETURN(MATCH_NOMATCH); } @@ -2649,7 +2649,7 @@ for (;;) if (rrc != MATCH_NOMATCH) RRETURN(rrc); if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); GETCHARINCTEST(c, eptr); - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); while (eptr < md->end_subject) { @@ -2658,7 +2658,7 @@ for (;;) { GETCHARLEN(c, eptr, len); } - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if (prop_category != ucp_M) break; eptr += len; } @@ -2790,7 +2790,7 @@ for (;;) int len = 1; if (eptr >= md->end_subject) break; GETCHARLEN(c, eptr, len); - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if ((*prop_test_variable == prop_test_against) == prop_fail_result) break; eptr+= len; @@ -2816,7 +2816,7 @@ for (;;) { if (eptr >= md->end_subject) break; GETCHARINCTEST(c, eptr); - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if (prop_category == ucp_M) break; while (eptr < md->end_subject) { @@ -2825,7 +2825,7 @@ for (;;) { GETCHARLEN(c, eptr, len); } - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if (prop_category != ucp_M) break; eptr += len; } @@ -2846,7 +2846,7 @@ for (;;) { GETCHARLEN(c, eptr, len); } - prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase); + prop_category = _pcre_ucp_findchar(c, &prop_chartype, &prop_othercase); if (prop_category != ucp_M) break; eptr--; } @@ -3200,7 +3200,7 @@ Returns: > 0 => success; value is the number of elements filled in < -1 => some kind of unexpected problem */ -EXPORT int +PCRE_EXPORT int pcre_exec(const pcre *argument_re, const pcre_extra *extra_data, const char *subject, int length, int start_offset, int options, int *offsets, int offsetcount) diff --git a/libpcre/pcre_fullinfo.c b/libpcre/pcre_fullinfo.c index ac80e65e2..cd1a9a4ff 100644 --- a/libpcre/pcre_fullinfo.c +++ b/libpcre/pcre_fullinfo.c @@ -61,7 +61,7 @@ Arguments: Returns: 0 if data returned, negative on error */ -EXPORT int +PCRE_EXPORT int pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what, void *where) { diff --git a/libpcre/pcre_info.c b/libpcre/pcre_info.c index 228949d0c..18741b173 100644 --- a/libpcre/pcre_info.c +++ b/libpcre/pcre_info.c @@ -68,7 +68,7 @@ Returns: number of capturing subpatterns or negative values on error */ -EXPORT int +PCRE_EXPORT int pcre_info(const pcre *argument_re, int *optptr, int *first_byte) { real_pcre internal_re; diff --git a/libpcre/pcre_internal.h b/libpcre/pcre_internal.h index e3182a4ed..e2330396f 100644 --- a/libpcre/pcre_internal.h +++ b/libpcre/pcre_internal.h @@ -43,6 +43,11 @@ modules, but which are not relevant to the exported API. This includes some functions whose names all begin with "_pcre_". */ /* Get the definitions provided by running "configure" */ + +#ifndef PCRE_INTERNAL_H +#define PCRE_INTERNAL_H + + #ifndef WIN32 #include "config.h" #else @@ -51,9 +56,9 @@ functions whose names all begin with "_pcre_". */ /* Define DEBUG to get debugging output on stdout. */ -/**** +#if 0 #define DEBUG -****/ +#endif /* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef inline, and there are *still* stupid compilers about that don't like indented @@ -116,9 +121,12 @@ Unix, where it is defined in sys/types, so use "uschar" instead. */ typedef unsigned char uschar; -/* Include the public PCRE header */ +/* Include the public PCRE header and the definitions of UCP character + property values. */ #include "pcre.h" +#include "ucp.h" + /* Include the (copy of) the public ucp header, changing the external name into a private one. This does no harm, even if we aren't compiling UCP support. */ @@ -865,7 +873,7 @@ total length. */ #define tables_length (ctypes_offset + 256) /* Layout of the UCP type table that translates property names into codes for -ucp_findchar(). */ +pcre_ucp_findchar(). */ typedef struct { const char *name; @@ -898,11 +906,12 @@ one of the exported public functions. They have to be "external" in the C sense, but are not part of the PCRE public API. */ extern int _pcre_ord2utf8(int, uschar *); -extern void _pcre_printint(pcre *, FILE *); extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *, const pcre_study_data *, pcre_study_data *); extern int _pcre_ucp_findchar(const int, int *, int *); extern int _pcre_valid_utf8(const uschar *, int); extern BOOL _pcre_xclass(int, const uschar *); +#endif + /* End of pcre_internal.h */ diff --git a/libpcre/pcre_printint.c b/libpcre/pcre_printint.src similarity index 96% rename from libpcre/pcre_printint.c rename to libpcre/pcre_printint.src index d18f39925..410f92082 100644 --- a/libpcre/pcre_printint.c +++ b/libpcre/pcre_printint.src @@ -38,12 +38,15 @@ POSSIBILITY OF SUCH DAMAGE. */ -/* This module contains an PCRE private debugging function for printing out the +/* This module contains a PCRE private debugging function for printing out the internal form of a compiled regular expression, along with some supporting -local functions. */ +local functions. This source file is used in two places: +(1) It is #included by pcre_compile.c when it is compiled in debugging mode +(DEBUG defined in pcre_internal.h). It is not included in production compiles. -#include "pcre_internal.h" +(2) It is always #included by pcretest.c, which can be asked to print out a +compiled regex for debugging purposes. */ static const char *OP_names[] = { OP_NAME_LIST }; @@ -121,8 +124,8 @@ return "??"; /* Make this function work for a regex with integers either byte order. However, we assume that what we are passed is a compiled regex. */ -EXPORT void -_pcre_printint(pcre *external_re, FILE *f) +static void +pcre_printint(pcre *external_re, FILE *f) { real_pcre *re = (real_pcre *)external_re; uschar *codestart, *code; @@ -448,4 +451,4 @@ for(;;) } } -/* End of pcre_printint.c */ +/* End of pcre_printint.src */ diff --git a/libpcre/pcre_refcount.c b/libpcre/pcre_refcount.c index 35a7ee869..79fde4249 100644 --- a/libpcre/pcre_refcount.c +++ b/libpcre/pcre_refcount.c @@ -63,7 +63,7 @@ Returns: the (possibly updated) count value (a non-negative number), or a negative error number */ -EXPORT int +PCRE_EXPORT int pcre_refcount(pcre *argument_re, int adjust) { real_pcre *re = (real_pcre *)argument_re; diff --git a/libpcre/pcre_study.c b/libpcre/pcre_study.c index 7c10c0491..58f241400 100644 --- a/libpcre/pcre_study.c +++ b/libpcre/pcre_study.c @@ -401,7 +401,7 @@ Returns: pointer to a pcre_extra block, with study_data filled in and the NULL on error or if no optimization possible */ -EXPORT pcre_extra * +PCRE_EXPORT pcre_extra * pcre_study(const pcre *external_re, int options, const char **errorptr) { uschar start_bits[32]; diff --git a/libpcre/pcre_tables.c b/libpcre/pcre_tables.c index 4f442eae0..f91e881c6 100644 --- a/libpcre/pcre_tables.c +++ b/libpcre/pcre_tables.c @@ -39,7 +39,9 @@ POSSIBILITY OF SUCH DAMAGE. /* This module contains some fixed tables that are used by more than one of the -PCRE code modules. */ +PCRE code modules. The tables are also #included by the pcretest program, which +uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name +clashes with the library. */ #include "pcre_internal.h" @@ -81,8 +83,7 @@ const uschar _pcre_utf8_table4[] = { 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 }; /* This table translates Unicode property names into code values for the -ucp_findchar() function. It is used by pcretest as well as by the library -functions. */ +ucp_findchar() function. */ const ucp_type_table _pcre_utt[] = { { "C", 128 + ucp_C }, diff --git a/libpcre/pcre_try_flipped.c b/libpcre/pcre_try_flipped.c index a07bb23db..536eb05a4 100644 --- a/libpcre/pcre_try_flipped.c +++ b/libpcre/pcre_try_flipped.c @@ -94,7 +94,7 @@ Returns: the new block if is is indeed a byte-flipped regex NULL if it is not */ -EXPORT real_pcre * +PCRE_EXPORT real_pcre * _pcre_try_flipped(const real_pcre *re, real_pcre *internal_re, const pcre_study_data *study, pcre_study_data *internal_study) { diff --git a/libpcre/pcre_version.c b/libpcre/pcre_version.c index d296eea80..2d3080a70 100644 --- a/libpcre/pcre_version.c +++ b/libpcre/pcre_version.c @@ -52,7 +52,7 @@ string that identifies the PCRE version that is in use. */ #define STRING(a) # a #define XSTRING(s) STRING(s) -EXPORT const char * +PCRE_EXPORT const char * pcre_version(void) { return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE); diff --git a/libpcre/pcre_winconfig.h b/libpcre/pcre_winconfig.h index c4e14a43f..a6632829b 100644 --- a/libpcre/pcre_winconfig.h +++ b/libpcre/pcre_winconfig.h @@ -1,4 +1,4 @@ -#define EXPORT +#define PCRE_EXPORT #define HAVE_STRERROR 1 #define HAVE_MEMMOVE 1 diff --git a/libpcre/pcre_xclass.c b/libpcre/pcre_xclass.c index 40d2654da..4a4f895f0 100644 --- a/libpcre/pcre_xclass.c +++ b/libpcre/pcre_xclass.c @@ -60,7 +60,7 @@ Arguments: Returns: TRUE if character matches, else FALSE */ -EXPORT BOOL +PCRE_EXPORT BOOL _pcre_xclass(int c, const uschar *data) { int t; @@ -102,7 +102,7 @@ while ((t = *data++) != XCL_END) { int chartype, othercase; int rqdtype = *data++; - int category = ucp_findchar(c, &chartype, &othercase); + int category = _pcre_ucp_findchar(c, &chartype, &othercase); if (rqdtype >= 128) { if ((rqdtype - 128 == category) == (t == XCL_PROP)) return !negated; diff --git a/libpcre/pcreposix.c b/libpcre/pcreposix.c index 06fd58bcb..c8f25ad3a 100644 --- a/libpcre/pcreposix.c +++ b/libpcre/pcreposix.c @@ -131,7 +131,7 @@ static const char *const pstring[] = { * Translate error code to string * *************************************************/ -EXPORT size_t +PCRE_EXPORT size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) { const char *message, *addmessage; @@ -166,7 +166,7 @@ return length + addlength; * Free store held by a regex * *************************************************/ -EXPORT void +PCRE_EXPORT void regfree(regex_t *preg) { (pcre_free)(preg->re_pcre); @@ -189,7 +189,7 @@ Returns: 0 on success various non-zero codes on failure */ -EXPORT int +PCRE_EXPORT int regcomp(regex_t *preg, const char *pattern, int cflags) { const char *errorptr; @@ -225,7 +225,7 @@ ints. However, if the number of possible capturing brackets is small, use a block of store on the stack, to reduce the use of malloc/free. The threshold is in a macro that can be changed at configure time. */ -EXPORT int +PCRE_EXPORT int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) { diff --git a/libpcre/ucp.h b/libpcre/ucp.h index 955e104a6..b216e0e5e 100644 --- a/libpcre/ucp.h +++ b/libpcre/ucp.h @@ -53,8 +53,6 @@ enum { ucp_Zs /* Space separator */ }; -extern int ucp_findchar(const int, int *, int *); - #endif /* End of ucp.h */ diff --git a/mswin32/nsis/Nmap.nsi b/mswin32/nsis/Nmap.nsi index a8b6d0026..776973a46 100644 --- a/mswin32/nsis/Nmap.nsi +++ b/mswin32/nsis/Nmap.nsi @@ -80,7 +80,7 @@ SectionEnd Section "WinPcap 3.1" SecWinPcap File winpcap_3_1.exe - Exec "$INSTDIR\WinPcap_3_1.exe" + Exec '"$INSTDIR\WinPcap_3_1.exe"' Delete "$INSTDIR\Winpcap_3_1.exe" SectionEnd diff --git a/nmap_winconfig.h b/nmap_winconfig.h index de622c700..dc01c342e 100644 --- a/nmap_winconfig.h +++ b/nmap_winconfig.h @@ -104,7 +104,7 @@ #ifndef NMAP_WINCONFIG_H #define NMAP_WINCONFIG_H -#define NMAP_VERSION "3.99" +#define NMAP_VERSION "3.999" #define NMAP_NAME "Nmap" #define NMAP_URL "http://www.insecure.org/nmap" #define NMAP_PLATFORM "i686-pc-windows-windows" diff --git a/scripts/Makefile b/scripts/Makefile index 14ba696d5..0782b9459 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -145,14 +145,14 @@ distro: *.c *.h CHANGELOG /usr/tmp/nmap-$(NMAP_VERSION)/nbase $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/libpcre - cd ../libpcre; cp -a AUTHORS config.guess config.in config.sub \ + cd ../libpcre; cp -a AUTHORS config.guess config.h.in config.sub \ configure configure.ac dftables.c INSTALL install-sh \ libpcre.vcproj LICENCE Makefile.in makevp.bat mkinstalldirs \ NMAP_MODIFICATIONS NON-UNIX-USE pcre_chartables.c \ pcre_compile.c pcre_config.c pcre_dfa_exec.c pcre_exec.c \ - pcre_fullinfo.c pcre_get.c pcre_globals.c pcre.h pcre.in \ + pcre_fullinfo.c pcre_get.c pcre_globals.c pcre.h pcre.h.in \ pcre_info.c pcre_internal.h pcre_maketables.c pcreposix.c \ - pcreposix.h pcre_printint.c pcre_refcount.c pcre_study.c \ + pcreposix.h pcre_printint.src pcre_refcount.c pcre_study.c \ pcre_tables.c pcre_try_flipped.c pcre_version.c \ pcre_winconfig.h pcre_xclass.c README ucp.h \ /usr/tmp/nmap-$(NMAP_VERSION)/libpcre diff --git a/tcpip.cc b/tcpip.cc index 26f5324ca..037cc54f6 100644 --- a/tcpip.cc +++ b/tcpip.cc @@ -987,7 +987,7 @@ int send_ip_packet(int sd, struct eth_nfo *eth, u8 *packet, unsigned int packetl must deal with it here rather than when building the packet, because they should be in NBO when I'm sending over raw ethernet */ -#if FREEBSD || BSDI || NETBSD || DEC +#if FREEBSD || BSDI || NETBSD || DEC || MACOSX ip->ip_len = ntohs(ip->ip_len); ip->ip_off = ntohs(ip->ip_off); #endif diff --git a/tty.cc b/tty.cc index ba137b1b7..93bcd68a8 100644 --- a/tty.cc +++ b/tty.cc @@ -115,16 +115,18 @@ #endif #include +#include "output.h" +#include "tty.h" +#include "NmapOps.h" + +extern NmapOps o; + #ifdef WIN32 #include -// We currently just have stub functions for Win32 that don't actually -// do anything. Any volunteers to add real support? +// Microsoft's runtime makes this fairly simple. :) void tty_init() { return; } -bool keyWasPressed() { - return false; - //return _kbhit(); -} +static int tty_getchar() { return _kbhit() ? getch() : -1; } void tty_done() { return; } #else @@ -141,12 +143,6 @@ extern int tcsetattr(int fd, int actions, struct termios *termios_p); #endif #endif -#include "output.h" -#include "tty.h" -#include "NmapOps.h" - -extern NmapOps o; - static int tty_fd = 0; static struct termios saved_ti; @@ -204,6 +200,20 @@ static int tty_getchar() return -1; } +void tty_done() +{ + int fd; + + if (!tty_fd) return; + + fd = tty_fd; tty_fd = 0; + tcsetattr(fd, TCSANOW, &saved_ti); + + close(fd); +} + +#endif //!win32 + /* This is the best method here. It will catch all of the predefined keypresses and interpret them, and it will also tell you if you should print anything. A value of true being returned means a @@ -248,17 +258,3 @@ bool keyWasPressed() } return false; } - -void tty_done() -{ - int fd; - - if (!tty_fd) return; - - fd = tty_fd; tty_fd = 0; - tcsetattr(fd, TCSANOW, &saved_ti); - - close(fd); -} - -#endif //!win32