1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-16 12:49:02 +00:00

Quit on EOF in non-TCP mode.

Apparently SCTP can't have the same kind of half-open sockets that TCP
has. When one direction is closed, we can't do anything further with the
socket.
http://seclists.org/nmap-dev/2013/q1/227
This commit is contained in:
david
2013-02-23 06:54:29 +00:00
parent a9cb84f189
commit 811d6096e1
2 changed files with 5 additions and 5 deletions

View File

@@ -786,8 +786,8 @@ static void read_stdin_handler(nsock_pool nsp, nsock_event evt, void *data)
if (status == NSE_STATUS_EOF) {
shutdown(nsi_getsd(cs.sock_nsi), SHUT_WR);
/* In --send-only mode, exit after EOF on stdin. */
if (o.sendonly)
/* In --send-only mode or non-TCP mode, exit after EOF on stdin. */
if (o.proto != IPPROTO_TCP || (o.proto == IPPROTO_TCP && o.sendonly))
nsock_loop_quit(nsp);
return;
} else if (status == NSE_STATUS_ERROR) {
@@ -833,8 +833,8 @@ static void read_socket_handler(nsock_pool nsp, nsock_event evt, void *data)
if (status == NSE_STATUS_EOF) {
Close(STDOUT_FILENO);
/* In --recv-only mode, exit after EOF on the socket. */
if (o.recvonly)
/* In --recv-only mode or non-TCP mode, exit after EOF on the socket. */
if (o.proto != IPPROTO_TCP || (o.proto == IPPROTO_TCP && o.recvonly))
nsock_loop_quit(nsp);
return;
} else if (status == NSE_STATUS_ERROR) {

View File

@@ -331,7 +331,7 @@ static int ncat_listen_stream(int proto)
/* Read from stdin and write to all clients. */
rc = read_stdin();
if (rc == 0) {
if (o.sendonly) {
if (o.proto != IPPROTO_TCP || (o.proto == IPPROTO_TCP && o.sendonly)) {
/* There will be nothing more to send. If we're not
receiving anything, we can quit here. */
return 0;