Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Nmap Development: Nmap-2.54BETA30 compile fixes

Nmap-2.54BETA30 compile fixes

From: William McVey <wam_at_cisco.com>
Date: Wed, 31 Oct 2001 14:09:40 -0600

I decided to fix the following warnings I got when I compiled nmap-2.54BETA30
under Linux (Mandrake 8.1):

snprintf.c: In function `asprintf':
snprintf.c:570: warning: implicit declaration of function `vasprintf'

nmap_error.c: In function `fatal':
nmap_error.c:59: warning: implicit declaration of function `exit'

output.c: In function `xml_convert':
output.c:224: warning: unused variable `i'

nmapfe_error.c: In function `fatal':
nmapfe_error.c:60: warning: implicit declaration of function `exit'

In investigating these errors, I also found a couple of other subtle
compile errors which never ended up generating warnings (such as every
conditional evaluation of HAS_UNISTD_H being broken). Anyway, attached
is a patch to fix these compile errors/warnings. The patch basically
does the following:

    - adds libiberty.h logic to nbase's autoconf and into nbase/snprintf.h

    - The unistd.h check was commented out of toplevel configure.in for
            some reason. I un-commented it back in and added definitions for
        HAS_UNISTD_H into config.h.in

    - adds conditional inclusion of <stdlib.h> in nmap_error.h to get
        exit(3) prototype

    - removes the 'unsigned int i' declaration from output.c:xml_convert()

    - adds .. to nmapfe's header include path so that nmapfe_error.h can
            include config.h, to determine if it should include <stdlib.h>

    - fixes a typo in utils.h

The patch is attached below and, along with my other nmap patches, is linked
from http://www.networkexploits.com/projects/nmap/. It should be applied
from within the nmap-2.54BETA30 directory using the command
'patch -p1 < patchfile'. Since this patch fixes several of the autoconf
template files, autoconf should be run from within the toplevel directory,
as well as within the nbase/ and nmapfe/ subdirectories. The patch has been
tested under Linux Mandrake 8.1 and Solaris 2.7.

  -- William

diff -Naur nmap-2.54BETA30/config.h.in nmap-2.54BETA30-compilefixes/config.h.in
--- nmap-2.54BETA30/config.h.in Sat Jun 2 11:00:11 2001
+++ nmap-2.54BETA30-compilefixes/config.h.in Wed Oct 31 17:07:34 2001
@@ -17,6 +17,8 @@
 
 #undef STDC_HEADERS
 
+#undef HAVE_UNISTD_H
+
 #undef HAVE_STRING_H
 
 #undef HAVE_GETOPT_H
diff -Naur nmap-2.54BETA30/configure.in nmap-2.54BETA30-compilefixes/configure.in
--- nmap-2.54BETA30/configure.in Sat Jun 2 11:03:17 2001
+++ nmap-2.54BETA30-compilefixes/configure.in Wed Oct 31 17:12:48 2001
@@ -218,6 +218,9 @@
 AC_CHECK_HEADERS(string.h getopt.h strings.h memory.h sys/param.h sys/sockio.h netinet/if_ether.h bstring.h sys/time.h pwd.h )
 AC_HEADER_TIME
 
+dnl I do not know why these were commented out...
+dnl unistd is worth knowing though (wam)
+AC_CHECK_HEADERS(unistd.h)
 dnl AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
diff -Naur nmap-2.54BETA30/nbase/configure.in nmap-2.54BETA30-compilefixes/nbase/configure.in
--- nmap-2.54BETA30/nbase/configure.in Sat Mar 10 08:50:48 2001
+++ nmap-2.54BETA30-compilefixes/nbase/configure.in Wed Oct 31 16:34:05 2001
@@ -100,7 +100,7 @@
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS( string.h getopt.h strings.h memory.h sys/param.h sys/time.h unistd.h bstring.h netinet/if_ether.h netinet/in.h sys/time.h sys/socket.h sys/sockio.h rpc/types.h netdb.h pwd.h arpa/inet.h sys/resource.h sys/stat.h sys/wait.h )
+AC_CHECK_HEADERS( string.h getopt.h strings.h memory.h sys/param.h sys/time.h unistd.h bstring.h netinet/if_ether.h netinet/in.h sys/time.h sys/socket.h sys/sockio.h rpc/types.h netdb.h pwd.h arpa/inet.h sys/resource.h sys/stat.h sys/wait.h libiberty.h )
 AC_HEADER_TIME
 
 dnl equiv to '#define inline' to 'inline', '__inline__', '__inline' or ''
diff -Naur nmap-2.54BETA30/nbase/nbase_config.h.in nmap-2.54BETA30-compilefixes/nbase/nbase_config.h.in
--- nmap-2.54BETA30/nbase/nbase_config.h.in Sat Mar 10 08:50:48 2001
+++ nmap-2.54BETA30-compilefixes/nbase/nbase_config.h.in Wed Oct 31 16:33:19 2001
@@ -29,6 +29,8 @@
 
 #undef HAVE_MEMORY_H
 
+#undef HAVE_LIBIBERTY_H
+
 /* both bzero() and memcpy() are used in the source */
 #undef HAVE_BZERO
 #undef HAVE_MEMCPY
diff -Naur nmap-2.54BETA30/nbase/snprintf.c nmap-2.54BETA30-compilefixes/nbase/snprintf.c
--- nmap-2.54BETA30/nbase/snprintf.c Wed Nov 22 08:34:31 2000
+++ nmap-2.54BETA30-compilefixes/nbase/snprintf.c Wed Oct 31 16:38:21 2001
@@ -60,6 +60,10 @@
 #include <ctype.h>
 #include <sys/types.h>
 
+#if HAVE_LIBIBERTY_H
+#include <libiberty.h>
+#endif
+
 #include "nbase.h"
 
 #ifndef min
diff -Naur nmap-2.54BETA30/nmap_error.h nmap-2.54BETA30-compilefixes/nmap_error.h
--- nmap-2.54BETA30/nmap_error.h Wed Mar 7 20:34:56 2001
+++ nmap-2.54BETA30-compilefixes/nmap_error.h Wed Oct 31 18:54:04 2001
@@ -50,6 +50,20 @@
 #include "mswin32\winclude.h"
 #endif
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else
+#ifdef WIN32
+#include "nmap_winconfig.h"
+#endif /* WIN32 */
+#endif /* HAVE_CONFIG_H */
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#endif
+
+
+
 #include <stdarg.h>
 #include <stdio.h>
 
diff -Naur nmap-2.54BETA30/nmapfe/Makefile.in nmap-2.54BETA30-compilefixes/nmapfe/Makefile.in
--- nmap-2.54BETA30/nmapfe/Makefile.in Tue Jan 2 09:32:50 2001
+++ nmap-2.54BETA30-compilefixes/nmapfe/Makefile.in Wed Oct 31 19:01:58 2001
@@ -72,7 +72,7 @@
 CONFIG_CLEAN_FILES =
 PROGRAMS = $(bin_PROGRAMS)
 
-DEFS = @DEFS@ -DVERSION=\"$(VERSION)\" -DHAVE_CONFIG_H=1 -I$(srcdir)
+DEFS = @DEFS@ -DVERSION=\"$(VERSION)\" -DHAVE_CONFIG_H=1 -I$(srcdir) -I..
 CPPFLAGS = @CPPFLAGS@
 STATIC =
 LDFLAGS = @LDFLAGS@ $(STATIC)
diff -Naur nmap-2.54BETA30/nmapfe/nmapfe_error.h nmap-2.54BETA30-compilefixes/nmapfe/nmapfe_error.h
--- nmap-2.54BETA30/nmapfe/nmapfe_error.h Wed Mar 7 20:34:57 2001
+++ nmap-2.54BETA30-compilefixes/nmapfe/nmapfe_error.h Wed Oct 31 19:02:52 2001
@@ -48,8 +48,21 @@
 #ifndef NMAPFE_ERROR_H
 #define NMAPFE_ERROR_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else
+#ifdef WIN32
+#include "nmap_winconfig.h"
+#endif /* WIN32 */
+#endif /* HAVE_CONFIG_H */
+
+
 #include <stdarg.h>
 #include <stdio.h>
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#endif
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
diff -Naur nmap-2.54BETA30/output.c nmap-2.54BETA30-compilefixes/output.c
--- nmap-2.54BETA30/output.c Sun Oct 14 06:46:09 2001
+++ nmap-2.54BETA30-compilefixes/output.c Wed Oct 31 18:56:29 2001
@@ -221,7 +221,6 @@
 }
 
 char* xml_convert (const char* str) {
- unsigned int i;
   char *temp, ch, prevch = 0, *p;
   temp = malloc(strlen(str)*6+1);
   for (p = temp;(prevch = ch, ch = *str);str++) {
diff -Naur nmap-2.54BETA30/utils.h nmap-2.54BETA30-compilefixes/utils.h
--- nmap-2.54BETA30/utils.h Thu Aug 23 05:48:22 2001
+++ nmap-2.54BETA30-compilefixes/utils.h Wed Oct 31 19:23:30 2001
@@ -67,7 +67,7 @@
 #include "config.h"
 #endif
 
-#if HAVAE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 

---------------------------------------------------------------------
For help using this (nmap-dev) mailing list, send a blank email to
nmap-dev-help_at_insecure.org . List run by ezmlm-idx (www.ezmlm.org).
Received on Oct 31 2001

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos