The formats has been tested and verified on Mac OS X 10.8.5,
Mac OS X 10.11.5 and Ubuntu 14.04 LTS, all on x86_64 machines
and OSs. It mainly silences warnings. There were no warnings on
Ubuntu but a few on Mac OS, so the fix is intended to silence
warnings on Mac OS whithout triggering new warnings on other OSs.
Example of warnings previously encountered:
netutil.cc:2828:74: warning: format specifies type 'unsigned short'
but the argument has type 'int' [-Wformat]
Fixes#275.
This results in fewer casts and less subtraction than the previous
method, and should still be portable. Only division and subtraction and
difftime are performed on the value, so it will not overflow. And the
TCP timestamp itself is a 32-bit value, so it can't refer to a time
farther in the past than the 32-bit epoch. One explicit cast (to long
long) is used in order to ensure the format string can handle any
conceivable value according to the compiler and avoid a warning message.
Make current loglevel and current log callback global
to the library. Attaching them to the nsock pool doesn't
bring any benefit and prevents from logging activity in
code sections that don't have access to a pool (such as
proxy chain specification parsing).
Updated external calls and nsock tests accordingly.
Previously, we would only request IPv4 addresses by default, or only
IPv6 when scanning with -6. Now, we'll request both (by not passing an
address family in the hints to getaddrinfo) and report them all in the
"Other addresses" line. This should encourage more users to scan with
-6. Additionally, it allows us to catch and report attempts to scan
IPv6-only hosts via IPv4, where previously we would just say "Failed to
resolve"
Closes#76
Some vsnprintf implementations (or perhaps some compiler options?) don't
like formatting NULL as %s, and will segfault (ran into this with
libstdc++ on Solaris). We don't get bug reports because at least some
(including mine on Ubuntu) will simply format it as "(null)".
This patch adds explicit checking for NULL to avoid the segfault
condition.
see http://seclists.org/nmap-dev/2013/q4/168
Move some includes out of nmap.h: nmap.h gets included lots of places,
and unconditionally included math.h, ctype.h, errno.h, stdio.h,
sys/stat.h, fcntl.h, sys/types.h, and stdarg.h. This commit moves those
includes into the .cc files where they are necessary and out of nmap.h
Remove redundant include global_structures.h, included from nmap.h
Removed redundant code included from nmap.h
Removing #include nbase.h when nmap.h is included (redundant)
Remove duplicate #include lines
Add ifndef guards to a few .h files
for file in `grep "* including the terms and conditions of this license text as well. \*" * -r --files-with-match `; do sed "s/\* including the terms and conditions of this license text as well. \*/* including the terms and conditions of this license text as well. */g" -i $file; done
This bug was introduced in r30334. We want to compare the contents of
the strings, not their addresses. This bug caused host script results to
be printed in arbitrary, perhaps not even well-defined, order.