1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-08 06:26:33 +00:00

Close connection endpoint when receiving EOF on stdin. Patch by Michal Hlavinka.

This commit is contained in:
henri
2012-09-10 20:41:46 +00:00
parent f9881bab18
commit 7dc93e0935
2 changed files with 12 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
# Nmap Changelog ($Id$); -*-text-*-
o [Ncat] Close connection endpoint when receiving EOF on stdin. [Michal Hlavinka].
o Fixed interface listing on NetBSD. The bug was first noticed by
Fredrik Pettai and diagnosed by Jan Schaumann. [David Fifield]

View File

@@ -113,6 +113,14 @@
#include <openssl/err.h>
#endif
#ifdef WIN32
/* Define missing constant for shutdown(2).
* See:
* http://msdn.microsoft.com/en-us/library/windows/desktop/ms740481%28v=vs.85%29.aspx
*/
#define SHUT_WR SD_SEND
#endif
struct conn_state {
nsock_iod sock_nsi;
nsock_iod stdin_nsi;
@@ -733,6 +741,8 @@ static void read_stdin_handler(nsock_pool nsp, nsock_event evt, void *data)
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) {