rpms/nc/devel nc-1.84-udp_port_scan.patch, NONE, 1.1 nc-1.84-udp_stop.patch, NONE, 1.1 nc.spec, 1.27, 1.28 nc-1.84-upd_stop.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Jul 10 08:46:17 UTC 2006


Author: rvokal

Update of /cvs/dist/rpms/nc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv18886

Modified Files:
	nc.spec 
Added Files:
	nc-1.84-udp_port_scan.patch nc-1.84-udp_stop.patch 
Removed Files:
	nc-1.84-upd_stop.patch 
Log Message:
- improve UDP port scanning (#159119) <varmojfekoj at gmail.com>

nc-1.84-udp_port_scan.patch:
 netcat.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

--- NEW FILE nc-1.84-udp_port_scan.patch ---
--- netcat.c.orig	2006-06-27 20:16:41.000000000 +0200
+++ netcat.c	2006-07-02 20:38:45.000000000 +0200
@@ -68,6 +68,8 @@
 #define CONNECTION_FAILED 1
 #define CONNECTION_TIMEOUT 2
 
+#define UDP_SCAN_TIMEOUT 3			/* Seconds */
+
 /* Command Line Options */
 int	dflag;					/* detached, no stdin */
 int	iflag;					/* Interval Flag */
@@ -370,7 +372,7 @@
 				continue;
 
 			ret = 0;
-			if (vflag || zflag) {
+			if ((vflag && !uflag) || zflag) {
 				/* For UDP, make sure we are connected. */
 				if (uflag) {
 					if (udptest(s) == -1) {
@@ -842,15 +844,20 @@
 int
 udptest(int s)
 {
-	int i, ret;
+	int i, t;
 
-	for (i = 0; i <= 3; i++) {
-		if (write(s, "X", 1) == 1)
-			ret = 1;
-		else
-			ret = -1;
+	if ((write(s, "X", 1) != 1) ||
+	    ((write(s, "X", 1) != 1) && (errno == ECONNREFUSED)))
+		return -1;
+
+	/* Give the remote host some time to reply. */
+	for (i = 0, t = (timeout == -1) ? UDP_SCAN_TIMEOUT : (timeout / 1000);
+	     i < t; i++) {
+		sleep(1);
+		if ((write(s, "X", 1) != 1) && (errno == ECONNREFUSED))
+			return -1;
 	}
-	return (ret);
+	return 1;
 }
 
 void

nc-1.84-udp_stop.patch:
 netcat.c |    3 +++
 1 files changed, 3 insertions(+)

--- NEW FILE nc-1.84-udp_stop.patch ---
--- nc/netcat.c.udp_stop	2006-07-10 09:46:00.000000000 +0200
+++ nc/netcat.c	2006-07-10 09:49:16.000000000 +0200
@@ -714,6 +714,9 @@
 			pfd[0].fd = -1;
 			pfd[0].events = 0;
 		}
+		else if (pfd[0].revents & POLLERR)
+			if (write(nfd, "", 1) == -1)
+			    warn("Write error");
 
 		if (!dflag) {
 		    if(pfd[1].revents & POLLIN) {


Index: nc.spec
===================================================================
RCS file: /cvs/dist/rpms/nc/devel/nc.spec,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- nc.spec	10 Jul 2006 07:52:28 -0000	1.27
+++ nc.spec	10 Jul 2006 08:46:14 -0000	1.28
@@ -1,7 +1,7 @@
 Summary: Reads and writes data across network connections using TCP or UDP.
 Name: nc
 Version: 1.84
-Release: 5
+Release: 6
 URL:	 http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/
 Source0: nc-%{version}.tar.bz2
 Patch0: nc-1.84-glib.patch
@@ -9,7 +9,8 @@
 Patch2: nc-1.82-reuseaddr.patch
 Patch3: nc-gcc_signess.patch
 Patch4: nc-1.84-connect_with_timeout.patch
-Patch5: nc-1.84-upd_stop.patch
+Patch5: nc-1.84-udp_stop.patch
+Patch6: nc-1.84-udp_port_scan.patch
 License: GPL
 Group: Applications/Internet
 BuildRoot: %{_tmppath}/%{name}-root
@@ -37,6 +38,7 @@
 %patch3 -p1 -b .gcc
 %patch4 -p1 -b .timeout
 %patch5 -p1 -b .udp_stop
+%patch6 -p0 -b .port_scan
 
 %build
 gcc $RPM_OPT_FLAGS -Werror `pkg-config --cflags --libs glib-2.0` netcat.c atomicio.c socks.c -o nc
@@ -58,10 +60,13 @@
 %doc README scripts
 
 %changelog
-* Mon Jul 10 2006 Radek Vokal <rvokal at redhat.com> 1.84-5
+* Mon Jul 10 2006 Radek Vokal <rvokal at redhat.com> - 1.84-6
+- improve UDP port scanning (#159119) <varmojfekoj at gmail.com>
+
+* Mon Jul 10 2006 Radek Vokal <rvokal at redhat.com> - 1.84-5
 - stop hanging when used as a UDP client (#188976) <varmojfekoj at gmail.com>
 
-* Mon Mar 06 2006 Radek Vokál <rvokal at redhat.com> 1.84-4
+* Mon Mar 06 2006 Radek Vokál <rvokal at redhat.com> - 1.84-4
 - timeout works also for connect (#182736)
 
 * Fri Feb 10 2006 Jesse Keating <jkeating at redhat.com> - 1.84-3.2


--- nc-1.84-upd_stop.patch DELETED ---




More information about the fedora-cvs-commits mailing list