Nmap Development mailing list archives

Re: RFE: ncat should call shutdown on EOF


From: Michal Hlavinka <mhlavink () redhat com>
Date: Tue, 04 Sep 2012 14:34:33 +0200

Hi,

any comments on this?

On 08/02/2012 03:17 PM, Michal Hlavinka wrote:
Hi,

we're replacing nc in fedora with ncat and testing if the behaviour is
similar enough.

One of the differences is old nc calls shutdown on EOF. When ncat is
used and gets EOF (ctrl-d) as an input, it does nothing unless
--send-only is used. Would it be possible to call shutdown(fd,SHUT_WR)
when ncat gets EOF in input?

I used following patch. It works, but I don't know if it's correct way
and correct place for this.

--- nmap-6.01/ncat/ncat_connect.c.shutdown       2012-06-19
09:49:19.000000000 +0200
+++ nmap-6.01/ncat/ncat_connect.c       2012-08-02 15:10:34.173929687 +0200
@@ -713,7 +713,7 @@ static void read_stdin_handler(nsock_poo
          if (o.sendonly) {
              /* In --send-only mode, exit after EOF on stdin. */
              nsock_loop_quit(nsp);
-        }
+        } else shutdown(nsi_getsd(cs.sock_nsi), SHUT_WR);
          return;
      } else if (status == NSE_STATUS_ERROR) {
          loguser("%s.\n", socket_strerror(nse_errorcode(evt)));

Cheers,
Michal

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


Current thread: