Nmap Development mailing list archives

[PATCH] Get nmap 3.77 compiling on HP-UX


From: Petter Reinholdtsen <pere () hungry com>
Date: Wed, 17 Nov 2004 17:14:38 +0100


The following patch fixes the build on HP-UX.

The namespace hacking is to work around a problem on HP-UX 11.00,
lacking the std namespace (but the compiler understand the notation,
and refuses to compile 'using namespace std;' as long as the name
space is undefined.

diff -ur src-3.77/output.cc src-3.77-local/output.cc
--- src-3.77/output.cc  2004-11-06 04:41:53.000000000 +0100
+++ src-3.77-local/output.cc    2004-11-17 17:04:03.000000000 +0100
@@ -111,6 +111,10 @@
 
 #include <string>
 
+/* Workaround for lack of namespace std on HP-UX 11.00 */
+namespace std {};
+using namespace std;
+
 extern NmapOps o;
 static char *logtypes[LOG_TYPES]=LOG_NAMES;
 
@@ -120,7 +124,7 @@
 // returns 0 for success.
 static int getServiceXMLBuf(struct serviceDeductions *sd, char *xmlbuf, 
                     unsigned int xmlbuflen) {
-  std::string versionxmlstring;
+  string versionxmlstring;
   char rpcbuf[128];
   char *xml_product = NULL, *xml_version = NULL, *xml_extrainfo = NULL;
 
diff -ur src-3.77/service_scan.h src-3.77-local/service_scan.h
--- src-3.77/service_scan.h     2004-10-12 11:34:12.000000000 +0200
+++ src-3.77-local/service_scan.h       2004-11-17 17:04:37.000000000 +0100
@@ -113,7 +113,8 @@
 # include <pcre.h>
 #endif
 
-
+/* Workaround for lack of namespace std on HP-UX 11.00 */
+namespace std {};
 using namespace std;
 
 /**********************  DEFINES/ENUMS ***********************************/


The second part, removing the redundant 'HostScanStats::', fixes a
compile problem on HP-UX 11.00 and 11.23.  This is fixing a plain code
error in scan_engine.cc.

diff -ur src-3.77/scan_engine.cc src-3.77-local/scan_engine.cc
--- src-3.77/scan_engine.cc     2004-11-10 03:07:50.000000000 +0100
+++ src-3.77-local/scan_engine.cc       2004-11-17 17:01:45.000000000 +0100
@@ -290,7 +290,7 @@
 /* If there are pending probe timeouts, fills in when with the time of
    the earliest one and returns true.  Otherwise returns false and
    puts now in when. */
-  bool HostScanStats::nextTimeout(struct timeval *when);
+  bool nextTimeout(struct timeval *when);
   UltraScanInfo *USI; /* The USI which contains this HSS */
 
   /* Removes a probe from probes_outstanding, adjusts HSS and USS
@@ -328,7 +328,7 @@
      probe_bench, and decrements num_probes_waiting_retransmit accordingly */
   void moveProbeToBench(list<UltraProbe *>::iterator probeI);
 /* Clears the bench -- returning all of its members to probes_outstanding */
-  void HostScanStats::clearBench();
+  void clearBench();
   bool completed(); /* Whether or not the scan of this Target has completed */
 
   /* This function provides the proper cwnd and ccthresh to use.  It

Please include in a future version of nmap.  With this change, the
compiling suceed, but the linking fail on HP-UX 11.23.  I'll look into
that later.

---------------------------------------------------------------------
For help using this (nmap-dev) mailing list, send a blank email to 
nmap-dev-help () insecure org . List archive: http://seclists.org



Current thread: