Nmap Development mailing list archives

ncat unix domain datagram socket receive only mode


From: Guy Lichtman <guy () guylichtman com>
Date: Mon, 15 Dec 2014 22:44:39 +0200

Hi,

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 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. Here is a
suggested patch:

svn diff ncat_listen.c
Index: ncat_listen.c
===================================================================
--- ncat_listen.c       (revision 33864)
+++ ncat_listen.c       (working copy)
@@ -818,7 +818,9 @@
          * We're using connected udp. This has the down side of only
          * being able to handle one udp client at a time
          */
-        Connect(socket_n, &remotess.sockaddr, sslen);
+       /* Connect only if not recvonly */
+       if (!o.recvonly)
+               Connect(socket_n, &remotess.sockaddr, sslen);

         /* clean slate for buf */
         zmem(buf, sizeof(buf));


Best,

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

Current thread: