nmap/nmap — pull request #23 by guylichtman (2014-12-27 20:49:54+00:00)
Title: ncat datagram connect only if not in recvonly mode

I am trying to use ncat to listen on a unix domain datagram socket in
receive only mode. I am using this as a simple syslog receiving server for
testing.

When I use the following command:

`ncat --recv-only -luU /tmp/test.socket`

and then try to log a message using logger with the following command:

`logger -d -u /tmp/test.socket "this is a test"`

I get the following error on the ncat side:

`connect: Invalid argument`

From looking at the ncat_listen.c code it looks like ncat tries to connect
a sending socket even when in recv-only mode. I added a check to connect
only when not in recv-only mode and then ncat worked as expected.

I've also sent this out a few days back to the dev mailing list: http://seclists.org/nmap-dev/2014/q4/343 .

Hope this fix is something you can merge in.

Thanks,

Guy