Nmap Development mailing list archives

Re: [PATCH] Ncat as a client should quit event loop on EOF only if recvonly


From: David Fifield <david () bamsoftware com>
Date: Thu, 7 Feb 2013 17:10:53 -0800

On Thu, Feb 07, 2013 at 03:52:32AM -0500, Tomas Hozza wrote:
Ncat acting as a client should call nsock_loop_quit()
on reading EOF from socket only if o.recvonly is set.
If not, Ncat should call shutdown(<sock_fd>, SHUT_RD).

The current code can result in situation when client
receives EOF from the server and quits the event loop.
This would prevent client from sending any more data
to the server.

This can be reproduced using TCP:

1. run server: # ncat -l 6666
2. run client: # ncat -4 localhost 6666
3. send EOF from server to client
4. client will exit the event loop and terminate the connection

- client should NOT quit the event loop if --recv-only
is not used.

I'm attaching proposed patch.

Looks good, thanks. Can you add a test along the lines of the one added
by Michal Hlavinka for a similar EOF issue?

http://seclists.org/nmap-dev/2012/q4/337
http://seclists.org/nmap-dev/2012/q4/att-337/ncat-shutdown2.patch

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


Current thread: