Nmap Development mailing list archives

Re: nmap-4.02CSW failed build on Windows XP built in VS 2005 Express


From: kx <kxmail () gmail com>
Date: Thu, 20 Apr 2006 23:06:28 -0400

The pow(5.0, ...) patch works well.

The #define works less so, and for whatever reason, the compiler is
only respecting it when compiling nbase and nsock, but not nmap.
*sigh*  Not to mention, dnet and libpcre throw the same warnings. It
is just warnings, but it annoying.  If possible, would you mind adding
the define to the .sln file for all configurations of all projects.
Not sure on the VS 2003 interface, but here is what I do in VS2005:

For each project: Project -> Properties -> Configuration Properties ->
C/C++ -> Command Line and then select All Configurations from the
Configurations drop box and place /D "_CRT_SECURE_NO_DEPRECATE" in the
text box.

I know that means opening up VS and 5 cut and pastes, but it would be
greatly appreciated.

Cheers,
  kx


On 4/20/06, Fyodor <fyodor () insecure org> wrote:
On Wed, Apr 19, 2006 at 12:07:56AM -0400, kx wrote:

would you please edit your VS nmap.sln to add the following
define statement to all projects for all build configurations?  It
would save me from putting them in each time.

/D "_CRT_SECURE_NO_DEPRECATE"

Silly Microsoft.  Would you test whether this patch resolves the problem?

--- nbase/nbase_winconfig.h     (revision 3051)
+++ nbase/nbase_winconfig.h     (working copy)
@@ -142,6 +142,10 @@
 #define HAVE_AF_INET6 1
 #define HAVE_SOCKADDR_STORAGE 1

+/* Without this, Windows will give us all sorts of crap about using functions
+   like strcpy() even if they are done safely */
+#define _CRT_SECURE_NO_DEPRECATE 1
+
 #ifdef __GNUC__
 #define bzero(addr, num) __builtin_memset (addr, '\0', num)
 #else


pow(int,int) is no longer in math.h in VS 2005
http://msdn2.microsoft.com/en-US/library/da60x087(VS.80).aspx

No sure what you prefer for lines 721 and 723 of tcpip.cc? Could be:

(int) pow((float)5, failed));

Does the following patch remove the problem?

--- tcpip.cc    (revision 3224)
+++ tcpip.cc    (working copy)
@@ -718,9 +718,9 @@
          "*BSD:  If you are getting device not configured, you need to recompile your kernel with Berkeley Packet 
Filter support.  If you are getting No such file or directory, try creating the device (eg cd /dev; MAKEDEV <device>; 
or use mknod).\n"
          "SOLARIS:  If you are trying to scan localhost and getting '/dev/lo0: No such file or directory', complain 
to Sun.  I don't think Solaris can support advanced localhost scans.  You can probably use \"-P0 -sT localhost\" 
though.\n\n", pcapdev, snaplen, promisc, to_ms, err0r);
      } else {
-       error("pcap_open_live(%s, %d, %d, %d) FAILED. Reported error: %s.  Will wait %d seconds then retry.", 
pcapdev, snaplen, promisc, to_ms, err0r, (int) pow(5, failed));
+       error("pcap_open_live(%s, %d, %d, %d) FAILED. Reported error: %s.  Will wait %d seconds then retry.", 
pcapdev, snaplen, promisc, to_ms, err0r, (int) pow(5.0, failed));
      }
-      sleep((int) pow(5, failed));
+      sleep((int) pow(5.0, failed));
    }
  } while (!pt);


Thanks,
Fyodor



_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev


Current thread: