Nmap Development mailing list archives

RE: MinGW patch, getaddrinfo


From: "Rob Nicholls" <robert () everythingeverything co uk>
Date: Fri, 5 Sep 2008 11:02:59 +0100

I think the recent alterations to support MinGW has accidentally broken
compilation with Visual C++ 2008. The current SVN complains bitterly with:

6>c:\nmap-svn\nbase\nbase_winunix.h(126) : fatal error C1017: invalid
integer constant expression

It's caused by the line:

#if HAVE_WSPIAPI_H

It probably should have said ifdef rather than if, but in the attached patch
I decided to define it in nbase_winconfig.h with values of 0 or 1 and
correct a typo in that file at the same time. It now compiles in Visual C++
2008, but Gisle might want to check it still works on MinGW.


Rob


-----Original Message-----
From: Gisle Vanem [mailto:gvanem () broadpark no]
Sent: 04 September 2008 14:33
To: Nmap-dev
Subject: Re: MinGW patch, getaddrinfo

"David Fifield" <david () bamsoftware com> wrote:

It looks good. Is _MSC_VER the most reliable way to check for the
existence of the header? I ask only because I found
http://www.tremfusion.net/trac/changeset/443 which uses __MINGW32__
to
do the same thing.

I attached nbase-wspiapi-mingw.diff that does what you ask in a
different fashion, defining HAVE_WSPIAPI_H based on the value of
_MSC_VER. Please try it and if it works I'll apply it.

It looks good. Please commit.

I see two other places where getaddrinfo is used, so I'm curious why
only this one needs to be patched. What happens when you run

nmap -6 -S ::1 localhost

It works as expected. I.e. returns WSAEAFNOSUPPORT (incompatible
address).
So it don't crash there.

And what happens when you script scan one of the targets that
requires
the above patch? There is a call to getaddrinfo in nse_nsock too.

I failed to follow the codepath into those other getaddrinfo() calls.
Hint for you; patch nbase/getaddrinfo.c to set rc==0 and result==NULL
and test.

--gv

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

Attachment: nbase_winconfig_vcpp_fix.diff
Description:


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

Current thread: