Just as a warning, I don't use windows, and I haven't tested this,
but...
I found a page that talks about winsock vs bsd sockets a bit. (Keeping
in mind that winsock actually has bsd code under the covers.) It might
help you out, here's the URL:
http://tangentsoft.net/wskfaq/articles/bsd-compatibility.html
The section about fcntl() says the following:
> The Unix fcntl() call has no direct equivalent under Winsock. Where
> necessary, similar functionality exists in Winsock's ioctlsocket() call.
> For example, the equivalent of using Unix's fcntl() to set a socket's
> O_NONBLOCK flag is setting the FIONBIO flag with Winsock's
> ioctlsocket().
Grepping through the nmap source code, I found fcntl was used a number
of places. I picked one at random, it happened to be tcpip.cc. Here's
the section fcntl appears in:
#ifdef WIN32
u_long one = 1;
if(sd != 501) // Hack related to WinIP Raw Socket support
ioctlsocket (sd, FIONBIO, &one);
#else
int options;
/*Unblock our socket to prevent recvfrom from blocking forever
on certain target ports. */
options = O_NONBLOCK | fcntl(sd, F_GETFL);
fcntl(sd, F_SETFL, options);
#endif //WIN32
So, it looks to me like you will have to rewrite ncat with a bunch of
conditional blocks to get around the fact that Microsoft decided to
change the sockets API on their platform.
Hope this helps.
Benson
On Sun, Jun 01, 2008 at 11:55:24AM +0200, mixter_at_gmail.com wrote:
> Next issue, fcntl() and gethostbyname() and
> several related definitions cannot be found on windows. :(
>
> Even though I already include nbase/nbase.h in the file
> in question (ncat_connect.c), and verified that this
> includes win32 compatibility code and with it, fcntl.h.
>
> Directly including fcntl.h doesn't work either.
>
> How can this be, i.e. if I already, specifically
> #include "nbase/nbase.h"
> from that file, and it still doesn't know fcntl,
> which seems working in nmap?
>
> Including any other nbase, or nsock, header,
> does not work either...
>
> Thanks for any insight.
>
> _______________________________________________
> Sent through the nmap-dev mailing list
> http://cgi.insecure.org/mailman/listinfo/nmap-dev
> Archived at http://SecLists.Org
>
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org
- application/pgp-signature attachment: stored
Received on Jun 01 2008