Nmap Development mailing list archives

Re: can not compile recent svn nmap on windows vc 2010


From: Henri Doreau <henri.doreau () gmail com>
Date: Sun, 12 May 2013 22:43:21 +0200

2013/5/12 Rob Nicholls <robert () robnicholls co uk>:
Hi Henri,

Thanks, I wasn't expecting such a quick response on a Sunday! My comments
are also inline.

-----Original Message-----
From: Henri Doreau [mailto:henri.doreau () gmail com]
Sent: 12 May 2013 18:44
To: Rob Nicholls
Cc: Nmap dev; jaebum shin
Subject: Re: can not compile recent svn nmap on windows vc 2010

Hi Rob,

thanks for the report. My comments inline.

I don't fully understand this error. What does the compiler complain
about? It
doesn't seem to me that any structure is re-defined... How did you fix it?

Visual C++ seems to be complaining that line 71 of proxy_http.c contains the
line:

const struct proxy_spec ProxySpecHttp;

But further down (from line 213) in the same file it's redefined as:

const struct proxy_spec ProxySpecHttp = {
  "http://";,
  PROXY_TYPE_HTTP,
  &ProxyOpsHttp,
};

I tried moving the redefined version further up to replace what's on line
71, but then it's defined before ProxyOptsHttp. I can't move the definition
of ProxyOptsHttp up there as that contains references to
proxy_http_node_new, proxy_http_node_delete and  proxy_http_handler, which
aren't defined until afterwards. I can't define proxy_http_node_new before
ProxyOptsHttp as that contains a reference to ProxySpecHttp (and I ended up
going around in a circle, hence giving up - sorry!).

It's a virtually identical issue for Socks4, which isn't a surprise as IIRC
the Socks4 file was based on the HTTP proxy file.

My "fix" was basically to revert all of the changes related to the nsock
directory until before April 22nd (to remove all the proxy related commits,
removing the offending code and all references to it).

Thanks, I see. I guess ranting against the compiler won't help... I'll
do what I did for the nsock engines:
  - declare functions prototypes
  - define the structure
  - define the (actual) functions.

It's not as terse and neat as the current way but it should fix it.
I'll try to do so tomorrow.

That compiled version also appears to run okay, albeit with lots of
SO_BROADCAST related errors with NSE:

NSOCK ERROR [96.3770s] nsock_make_socket(): Setting of SO_BROADCAST
failed (IOD #1): No error

But I think that's a separate issue to the proxy related issues.

Rob
I think so too. At least I've pushed a change (r30885) so that the error
codes
are also properly reported on windows. Can you give it a try? IIRC the
failure
of setsockopt(SO_BROADCAST) used to be ignored but I don't know why, I
should check and maybe re-add this behavior...

've manually edited the version of nsock_connect.c as I couldn't cleanly
apply a patch based on your recent commit due to differences when I reverted
the nsock changes so Nmap would compile (one line wasn't an exact match, so
I wrapped the socket_errno() call with socket_strerror() like you've done
for the rest). In particular, my SO_BROADCAST error line now looks like
this:

      nsock_log_error(ms, "Setting of SO_BROADCAST failed (IOD #%li): %s",
                      iod->id, socket_strerror(socket_errno()));

I'm not sure what I'm expected to see with this change, I'm guessing
something informative if it works; but a quick test came back with the same
as before, a few dozen lines saying "No error". E.g.:

NSOCK ERROR [96.5160s] nsock_make_socket(): Setting of SO_BROADCAST failed
(IOD #2): No error

You're right, the patch aimed to get an error message. Unfortunately I
can't test and from what I can read on MSDN the call looks correct...
Does a windows expert here know what's going on? Any idea why
setsockopt() returns -1 (SOCKET_ERROR is -1, right?) without setting
any error message?

Regards

--
Henri
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: