Nmap Development mailing list archives

Re: nmap-4.50: -O option broken on Solaris 9?


From: David Fifield <david () bamsoftware com>
Date: Mon, 16 Jun 2008 17:17:53 -0600

On Mon, Dec 17, 2007 at 04:58:13PM -0700, Castle, Shane wrote:
So far so good.  I got a successful compile.  Now to test:

$ NMAPDIR=. sudo ./nmap -sS -sV -F -v -O netsec0

Unknown argument to -O.
QUITTING!

Hmm.  After lots of further investigations and comparisons with the
nmap-4.20 hierarchy, I figured out that nmap-4.50 is using the getopt()
included with Solaris 9 and not its own, which it did before.  This
version of getopt() behaves differently from the GNU-standard version:
it does not recognize two colons as denoting an optional argument, and
it may eat the next option on the command line if an option with a
required argument does not have one.  From the Solaris man page for
getopt():

     The getopt() function does not  fully  check  for  mandatory
     arguments; that is, given an option string a:b and the input
     -a -b, getopt() assumes that -b is the mandatory argument to
     the  -a  option and not that -a is missing a mandatory argu-
     ment.

Hi Shane. I know it's been a while, but I recently checked in a fix that
fixes this problem for me on Solaris 9. Now, if getopt or
getopt_long_only is not detected, Nmap will always use the versions of
both those functions that are in nbase. It will only use the system
versions of those functions when both are present.

David Fifield

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


Current thread: