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: Sat, 9 Feb 2013 00:33:29 -0800

On Fri, Feb 08, 2013 at 06:30:44AM -0500, Tomas Hozza wrote:
I just noticed, that the server behaviour is the same as for client.
If server reads EOF from the socket it quits even if o.recvonly is
not set. Do you think that the server should be fixed, too? So that
it quits on reading EOF from socket only if o.recvonly is set.

I can prepare a patch and test if you think the server behaviour
should be fixed.

We've been dealing with all these EOF/shutdown situations piecemeal.
Let's look at all the possibilities of client/server
--send-only/--recv-only/not and EOF on stdin/socket. Here's my summary.
I'm assuming that the (--send-only,EOF on socket) and (--recv-only,EOF
on stdin) cases don't matter.

client !--send-only EOF on stdin  http://seclists.org/nmap-dev/2012/q3/491 r29743
client  --send-only EOF on stdin  http://seclists.org/nmap-dev/2009/q2/291 r13165
server !--send-only EOF on stdin  http://seclists.org/nmap-dev/2012/q4/337 r30308
server  --send-only EOF on stdin  working since before r30308?
client !--recv-only EOF on socket http://seclists.org/nmap-dev/2013/q1/188 r30597
client  --recv-only EOF on socket working since before r30597?
server !--recv-only EOF on socket http://seclists.org/nmap-dev/2013/q1/195 this message?
server  --recv-only EOF on socket apparently working?

I added new tests to cover each of these eight cases. If I understand
you correctly, you want to fix the second block of FAILs, that is,
server without --recv-only gets an EOF from its socket. Is that right?
The first block of FAILs is actually caused by the second, and the fix
you propose should fix them too.

FAIL Client closes socket write and keeps running after stdin EOF (tcp)
     Client stopped running at ./ncat-test.pl line 742.
FAIL Client closes socket write and keeps running after stdin EOF (tcp ssl)
     Client stopped running at ./ncat-test.pl line 742.
PASS --send-only client closes socket write and stops running after stdin EOF (tcp)
PASS --send-only client closes socket write and stops running after stdin EOF (tcp ssl)
PASS Server closes socket write and keeps running after stdin EOF (tcp)
PASS Server closes socket write and keeps running after stdin EOF (tcp ssl)
PASS --send-only server closes socket write and stops running after stdin EOF (tcp)
PASS --send-only server closes socket write and stops running after stdin EOF (tcp ssl)
PASS Client closes stdout and keeps running after socket EOF (tcp)
PASS Client closes stdout and keeps running after socket EOF (sctp)
PASS Client closes stdout and keeps running after socket EOF (tcp ssl)
PASS Client closes stdout and keeps running after socket EOF (sctp ssl)
PASS --recv-only client closes stdout and stops running after socket EOF (tcp)
PASS --recv-only client closes stdout and stops running after socket EOF (sctp)
PASS --recv-only client closes stdout and stops running after socket EOF (tcp ssl)
PASS --recv-only client closes stdout and stops running after socket EOF (sctp ssl)
FAIL Server closes stdout and keeps running after socket EOF (tcp)
     Server stopped running at ./ncat-test.pl line 851.
FAIL Server closes stdout and keeps running after socket EOF (sctp)
     Server stopped running at ./ncat-test.pl line 851.
FAIL Server closes stdout and keeps running after socket EOF (tcp ssl)
     Server stopped running at ./ncat-test.pl line 851.
FAIL Server closes stdout and keeps running after socket EOF (sctp ssl)
     Server stopped running at ./ncat-test.pl line 851.
PASS --recv-only server closes stdout and stops running after socket EOF (tcp)
PASS --recv-only server closes stdout and stops running after socket EOF (sctp)
PASS --recv-only server closes stdout and stops running after socket EOF (tcp ssl)
PASS --recv-only server closes stdout and stops running after socket EOF (sctp ssl)

So yes, it looks like this is the last case that needs to be fixed, and
we will welcome a patch.

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


Current thread: