Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: [PATCH] [Ncat] Fix EOF handling (client-side)
From: David Fifield <david () bamsoftware com>
Date: Sun, 3 May 2009 21:31:45 -0600

On Sat, May 02, 2009 at 07:30:31PM +0200, Daniel Roethlisberger wrote:
David Fifield <david () bamsoftware com> 2009-04-19:
On Sun, Apr 19, 2009 at 10:56:50PM +0200, Daniel Roethlisberger wrote:
David Fifield <david () bamsoftware com> 2009-04-19:
In some cases quitting on EOF is the right behavior, as in your
        tar cvf - somedir | ncat server 1234
But in other cases, staying alive until the remote end closes the
connection is correct. Consider
        echo -e 'GET / HTTP/1.0\r\n\r\n' | ncat scanme.nmap.org 80
With current Ncat you get a web page printed to the screen, and Ncat
exits. With the EOF patch, you get nothing (and Ncat exits).

Doh, what an oversight.  So looking only at the client side, we
have two cases.  In one case, we want Ncat to quit on EOF on
stdin, since communication is one-way.  In the other case, we
want to wait for the server to close the connection before we
quit, since we are interested in the response.  We should be able
to differentiate the two cases based on the already existing
--send-only switch.

Would you agree with the following behaviour:
- when using --send-only, Ncat should close the socket and quit
  after EOF on stdin, and
- when not using --send-only, Ncat should always wait on the
  server to close the connection before quitting?

That sounds very reasonable.

Patch attached, please review.

Looks good, please apply.

David Fifield

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


  By Date           By Thread  

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