shutdown socket on EOF (#845075)

This commit is contained in:
Michal Hlavinka 2012-09-19 15:05:39 +02:00
parent beb89254d6
commit f8f73ddb46
2 changed files with 35 additions and 1 deletions

27
nmap-6.01-r29743.patch Normal file
View File

@ -0,0 +1,27 @@
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) {

View File

@ -4,7 +4,7 @@ Name: nmap
Epoch: 2
Version: 6.01
#global prerelease TEST5
Release: 5%{?dist}
Release: 6%{?dist}
# nmap is GPLv2
# zenmap is GPLv2 and LGPLv2+ (zenmap/higwidgets) and GPLv2+ (zenmap/radialnet)
# libdnet-stripped is BSD (advertising clause rescinded by the Univ. of California in 1999) with some parts as Public Domain (crc32)
@ -35,6 +35,9 @@ Patch4: zenmap-621887-workaround.patch
# upstream provided patch for rhbz#845005, not yet in upstream repository
Patch5: ncat_reg_stdin.diff
# shutdown socket on EOF, sent upstream
Patch6: nmap-6.01-r29743.patch
URL: http://nmap.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: openssl-devel, gtk2-devel, lua-devel, libpcap-devel, pcre-devel
@ -85,6 +88,7 @@ uses.
%patch2 -p1 -b .noms
%patch4 -p1 -b .bz637403
%patch5 -p1 -b .ncat_reg_stdin
%patch6 -p1 -b .r29743
#be sure we're not using tarballed copies of some libraries
rm -rf liblua libpcap libpcre macosx mswin32
@ -212,6 +216,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/xnmap.1.gz
%changelog
* Wed Sep 19 2012 Michal Hlavinka <mhlavink@redhat.com> - 2:6.01-6
- shutdown socket on EOF (#845075)
* Mon Aug 13 2012 Michal Hlavinka <mhlavink@redhat.com> - 2:6.01-5
- ncat did not work when file was used as input (#845005)