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: Missing getaddrinfo on Windows 2000--almost solved

Missing getaddrinfo on Windows 2000--almost solved

From: David Fifield <david_at_bamsoftware.com>
Date: Mon, 18 Aug 2008 00:12:54 -0600

I researched the problem of the getaddrinfo function being missing on
Windows 2000. The error message looks like this:

        ENTRY POINT NOT FOUND The procedure entry point getaddrinfo
        could not be located in the dynamic link library ws2_32.dll.

The immediate cause is that getaddrinfo, which is declared in the header
file ws2tcpip.h, isn't available before Windows XP. However, as
described at http://msdn.microsoft.com/en-us/library/ms738520.aspx, you
can compile in a replacement IPv4-only getaddrinfo by including the
header file wspiapi.h after ws2tcpip.h. In Nmap this is done in
nbase/nbase_winunix.h.

Adding that include does in fact fix the problem of the missing
getaddrinfo, which you can verify by checking the proprocessor output
(/P option in Visual Studio). However a different issue keeps that from
being a complete solution in this case. Before including ws2tcpip.h,
nbase/nbase_winunix.h undefines the symbol NTDDI_VERSION to omit
declarations of inet_ntop and inet_pton that are incompatible with those
of Nmap. I guess this workaround is what was discussed in

http://seclists.org/nmap-dev/2008/q2/0018.html
http://seclists.org/nmap-dev/2008/q2/0074.html

But wspiapi.h requires NTDDI_VERSION to be defined in order to do its
work; the whole file is basically

        #ifndef _WSPIAPI_H_
        #define _WSPIAPI_H_
        #if (NTDDI_VERSION >= NTDDI_WIN2K)
        // (code including replacement getaddrinfo)
        #endif
        #endif

If I remove the undefinition of NTTDI_VERSION I hit a compilation error
alluded to in the above messages, which I couldn't trivially fix.
ws2tcpip.h declares inet_ntop and inet_pton if NTDDI_VERSION >=
NTDDI_LONGHORN; I tried defining HAVE_INET_NTOP and HAVE_INET_PTON in
that case. But that doesn't work because Microsoft's declarations differ
in constness with those expected by Nmap.

So the summary is: undefining NTTDI_VERSION seems wrong. Including
wspiapi.h after ws2tcpip.h in nbase/nbase_winconfig.h will make
getaddrinfo work on Windows 2000. What remains is to find an alternative
solution to the inet_ntop/inet_pton problem. Does someone ahve an idea
or want to experiment? It might be as simple as making some arguments to
inet_ntop and inet_pton non-const.

David Fifield

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

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