nmap updated to 6.25

This commit is contained in:
Michal Hlavinka 2013-03-08 16:07:55 +01:00
parent fb0d11b3e3
commit d79fb8d93c
5 changed files with 13 additions and 200 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ nmap-5.21.tar.bz2
/nmap-5.61TEST5.tar.bz2
/nmap-6.00.tar.bz2
/nmap-6.01.tar.bz2
/nmap-6.25.tar.bz2

View File

@ -1,43 +0,0 @@
diff -up nmap-6.01/ncat/ncat_core.c.shutdown nmap-6.01/ncat/ncat_core.c
diff -up nmap-6.01/ncat/ncat_core.h.shutdown nmap-6.01/ncat/ncat_core.h
diff -up nmap-6.01/ncat/ncat_listen.c.shutdown nmap-6.01/ncat/ncat_listen.c
--- nmap-6.01/ncat/ncat_listen.c.shutdown 2012-03-01 07:53:35.000000000 +0100
+++ nmap-6.01/ncat/ncat_listen.c 2012-11-22 18:14:05.991381724 +0100
@@ -317,10 +317,13 @@ static int ncat_listen_stream(int proto)
}else {
/* Read from stdin and write to all clients. */
rc = read_stdin();
- if (rc == 0 && o.sendonly)
- /* There will be nothing more to send. If we're not
- receiving anything, we can quit here. */
- return 0;
+ if (rc == 0) {
+ if (o.sendonly)
+ /* There will be nothing more to send. If we're not
+ receiving anything, we can quit here. */
+ return 0;
+ shutdown_sockets(SHUT_WR);
+ }
if (rc < 0)
return 1;
}
@@ -495,6 +498,19 @@ int read_stdin(void)
return nbytes;
}
+void shutdown_sockets(int how)
+{
+ struct fdinfo *fdn;
+ int i;
+ for (i = 0; i <= broadcast_fdlist.fdmax; i++) {
+ if (!FD_ISSET(i, &master_broadcastfds))
+ continue;
+
+ fdn = get_fdinfo(&broadcast_fdlist, i);
+ shutdown(fdn->fd, how);
+ }
+}
+
/* Read from a client socket and write to stdout. Return the number of bytes
read from the socket, or -1 on error. */
int read_socket(int recv_fd)

View File

@ -1,145 +0,0 @@
diff -up nmap-6.01/ncat/test/ncat-test.pl.shutdown_test nmap-6.01/ncat/test/ncat-test.pl
--- nmap-6.01/ncat/test/ncat-test.pl.shutdown_test 2011-12-19 20:12:48.000000000 +0100
+++ nmap-6.01/ncat/test/ncat-test.pl 2012-11-27 14:18:16.000000000 +0100
@@ -21,6 +21,8 @@ my $HOST = "localhost";
my $IPV6_ADDR = "::1";
my $PORT = 40000;
my $PROXY_PORT = 40001;
+my $UNIXSOCK = "ncat.unixsock";
+my $UNIXSOCK_TMP = "ncat.unixsock_tmp";
my $BUFSIZ = 1024;
@@ -531,6 +533,22 @@ sub {
};
kill_children;
+# Test UNIX domain sockets listening
+($s_pid, $s_out, $s_in) = ncat("-l", "-U", $UNIXSOCK);
+test "Server UNIX socket listen on $UNIXSOCK (STREAM)",
+sub {
+ my $resp;
+
+ unlink($UNIXSOCK);
+ my ($c_pid, $c_out, $c_in) = ncat("-U", $UNIXSOCK);
+ syswrite($c_in, "abc\n");
+ $resp = timeout_read($s_out);
+ $resp eq "abc\n" or die "Server got \"$resp\", not \"abc\\n\" from client";
+};
+kill_children;
+unlink($UNIXSOCK);
+
+
server_client_test "Connect success exit code",
[], ["--send-only"], sub {
my ($pid, $code);
@@ -655,16 +673,37 @@ sub {
};
kill_children;
+server_client_test_all "Messages are logged to output file",
+["--output", "server.log"], ["--output", "client.log"], sub {
+
+ syswrite($c_in, "abc\n");
+ sleep 1;
+ syswrite($s_in, "def\n");
+ sleep 1;
+ close($c_in);
+ open(FH, "server.log");
+ my $contents = join("", <FH>);
+ close(FH);
+ $contents eq "abc\ndef\n" or die "Server logged " . d($contents);
+ open(FH, "client.log");
+ $contents = join("", <FH>);
+ close(FH);
+ $contents eq "abc\ndef\n" or die "Client logged " . d($contents);
+};
+unlink "server.log";
+unlink "client.log";
+kill_children;
+
server_client_test_tcp_sctp_ssl "Debug messages go to stderr",
["-vvv"], ["-vvv"], sub {
my $resp;
syswrite($c_in, "abc\n");
- close($c_in);
$resp = timeout_read($s_out) or die "Read timeout";
$resp eq "abc\n" or die "Server got \"$resp\", not \"abc\\n\"";
syswrite($s_in, "abc\n");
close($s_in);
+ close($c_in);
$resp = timeout_read($c_out) or die "Read timeout";
$resp eq "abc\n" or die "Server got \"$resp\", not \"abc\\n\"";
};
@@ -690,6 +729,36 @@ server_client_test_tcp_sctp_ssl "Server
};
kill_children;
+server_client_test "Client shutdown()s connection when reading EOF",
+[], [], sub {
+ my $resp;
+
+ syswrite($c_in, "abc\n");
+ $resp = timeout_read($s_out) or die "Read timeout";
+ $resp eq "abc\n" or die "Server got \"$resp\", not \"abc\\n\"";
+
+ close($c_in);
+
+ $resp = timeout_read($s_out);
+ !defined($resp) or die "Server didn't get EOF (got \"$resp\")";
+};
+kill_children;
+
+server_client_test "Server shutdown()s connection when reading EOF",
+[], [], sub {
+ my $resp;
+
+ syswrite($s_in, "abc\n");
+ $resp = timeout_read($c_out) or die "Read timeout";
+ $resp eq "abc\n" or die "Client got \"$resp\", not \"abc\\n\"";
+
+ close($s_in);
+
+ $resp = timeout_read($c_out);
+ !defined($resp) or die "Client didn't get EOF (got \"$resp\")";
+};
+kill_children;
+
# Tests to check that server defaults to non-persistent without --keep-open.
# Server immediately quits after the first connection closed without --keep-open
@@ -1195,6 +1264,33 @@ sub {
};
kill_children;
+# Test connecting to UNIX datagram socket with -s
+test "Connect to UNIX datagram socket with -s",
+sub {
+ my ($pid, $code);
+ local $SIG{CHLD} = sub { };
+ local *SOCK;
+ my $buff;
+
+ unlink($UNIXSOCK);
+ unlink($UNIXSOCK_TMP);
+
+ socket(SOCK, AF_UNIX, SOCK_DGRAM, 0) or die;
+ bind(SOCK, sockaddr_un($UNIXSOCK)) or die;
+
+ my ($c_pid, $c_out, $c_in) = ncat("-U", "--udp", "-s", $UNIXSOCK_TMP, $UNIXSOCK);
+ syswrite($c_in, "abc\n");
+ close($c_in);
+
+ my $peeraddr = recv(SOCK, $buff, 4, 0) or die;
+ my ($path) = sockaddr_un($peeraddr);
+ $path eq $UNIXSOCK_TMP or die "Client connected to prosy with source socket path $path, not $UNIXSOCK_TMP";
+};
+kill_children;
+unlink($UNIXSOCK);
+unlink($UNIXSOCK_TMP);
+
+
# HTTP proxy tests.
sub http_request {

View File

@ -2,9 +2,9 @@
Summary: Network exploration tool and security scanner
Name: nmap
Epoch: 2
Version: 6.01
Version: 6.25
#global prerelease TEST5
Release: 11%{?dist}
Release: 1%{?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)
@ -34,16 +34,14 @@ 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
Patch7: nmap-6.01-shutdown.patch
Patch8: nmap-6.01-shutdown_test.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
BuildRequires: desktop-file-utils, dos2unix
# exception granted in FPC ticket 255
Provides: bundled(lua) = 5.2
%define pixmap_srcdir zenmap/share/pixmaps
%description
@ -90,12 +88,11 @@ uses.
%patch2 -p1 -b .noms
%patch4 -p1 -b .bz637403
%patch5 -p1 -b .ncat_reg_stdin
%patch6 -p1 -b .r29743
%patch7 -p1 -b .shutdown
%patch8 -p1 -b .shutdown_test
#be sure we're not using tarballed copies of some libraries
rm -rf liblua libpcap libpcre macosx mswin32
#rm -rf liblua libpcap libpcre macosx mswin32
rm -rf libpcap libpcre macosx mswin32
#fix locale dir
mv zenmap/share/zenmap/locale zenmap/share
@ -220,6 +217,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/xnmap.1.gz
%changelog
* Fri Mar 08 2013 Michal Hlavinka <mhlavink@redhat.com> - 2:6.25-1
- nmap updated to 6.25
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2:6.01-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

View File

@ -1 +1 @@
a1a71940f238abb835dbf3ee7412bcea nmap-6.01.tar.bz2
fcc80f94ff3adcb11eedf91092ea6f5e nmap-6.25.tar.bz2