feborges / rpms / nmap

Forked from rpms/nmap 4 years ago
Clone
Blob Blame History Raw
diff -up nmap-6.01/ncat/ncat_connect.c.r29743 nmap-6.01/ncat/ncat_connect.c
--- nmap-6.01/ncat/ncat_connect.c.r29743	2012-09-19 14:56:37.889102887 +0200
+++ nmap-6.01/ncat/ncat_connect.c	2012-09-19 14:56:56.148241822 +0200
@@ -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;
@@ -732,6 +740,8 @@ static void read_stdin_handler(nsock_poo
         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) {