Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: ncat should try connecting to all resolved addresses, not only the first one
From: Jacek Wielemborek <d33tah () gmail com>
Date: Mon, 09 Dec 2013 20:24:57 +0100

03/12/2013 15:20:34 Jaromir Koncicky <jkoncick () redhat com>:
Could you please look and this and give me a feedback?
I'd like to finish this issue and make an acceptable patch which could be
included in nmap. Thanks!


I took a look at your patch from the comment #11 and it looks fine, applies to 
the latest SVN with no problem and builds under Linux and FreeBSD properly. 
Also tested ncat-test.pl under Linux to make sure it didn't break anything and 
tried to build it under Windows. Unfortunately, for some reason this involves 
compiling under Microsoft Visual C++ in C++ mode and the original patch lead 
to the following errors:


"C:\cygwin\home\d33tah\shared\ncat\nmap-trunk\ncat\ncat.vcxproj" (default
target) (1) -> (ClCompile target) ->

  error C2440: 'initializing' : cannot convert from 'void *' to
  'sockaddr_list *'
  c:\cygwin\home\d33tah\shared\ncat\nmap-trunk\ncat\ncat_core.c(310): error
  C2440: '=' : cannot convert from 'void *' to 'sockaddr_list *'
    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:04.21

I fixed the casts, changed the coding style a bit and replaced malloc with 
safe_malloc. I attach the new patch (feel encouraged to diff it against your 
version to see what I changed). Before I merge the patch, could you post some 
test code, most preferrably as a patch to ncat_test.pl, so I could have a 
snippet to try this out on different platforms? Also, I'm a bit worried about 
the introduction of two new global variables - could you please explain me why 
targetaddrs_allocated is necessary here? Perhaps a new structure would be a 
better choice here, or a bit different code paths/return arguments? Also, I 
hadn't checked if a version of resolve_multi wasn't already in the nsock/nbase 

Jacek Wielemborek

Attachment: try-all-ips.patch

Attachment: signature.asc
Description: This is a digitally signed message part.

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

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]