[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/nc/devel nc-1.84-verb.patch,NONE,1.1 nc.spec,1.30,1.31



Author: rvokal

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

Modified Files:
	nc.spec 
Added Files:
	nc-1.84-verb.patch 
Log Message:
- fix verbose option (#202321) <varmojfekoj gmail com>

nc-1.84-verb.patch:
 netcat.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

--- NEW FILE nc-1.84-verb.patch ---
--- nc/netcat.c.orig	2006-08-28 20:13:48.000000000 +0200
+++ nc/netcat.c	2006-08-29 02:11:28.000000000 +0200
@@ -41,6 +41,7 @@
 #include <netinet/tcp.h>
 #include <netinet/ip.h>
 #include <arpa/telnet.h>
+#include <arpa/inet.h>
 
 #include <err.h>
 #include <errno.h>
@@ -312,16 +313,15 @@
 			if (uflag) {
 				int rv, plen;
 				char buf[8192];
-				struct sockaddr_storage z;
 
-				len = sizeof(z);
+				len = sizeof(cliaddr);
 				plen = jflag ? 8192 : 1024;
 				rv = recvfrom(s, buf, plen, MSG_PEEK,
-				    (struct sockaddr *)&z, &len);
+				    (struct sockaddr *)&cliaddr, &len);
 				if (rv < 0)
 					err(1, "recvfrom");
 
-				rv = connect(s, (struct sockaddr *)&z, len);
+				rv = connect(s, (struct sockaddr *)&cliaddr, len);
 				if (rv < 0)
 					err(1, "connect");
 
@@ -332,6 +332,21 @@
 				    &len);
 			}
 
+			if(vflag) {
+				/* Don't look up port if -n. */
+				if (nflag)
+					sv = NULL;
+				else 
+					sv = getservbyport(ntohs(atoi(uport)),
+						uflag ? "udp" : "tcp");
+
+				fprintf(stderr, "Connection from %s port %s [%s/%s] accepted\n", 
+					inet_ntoa(((struct sockaddr_in *)(&cliaddr))->sin_addr),
+					uport,
+					uflag ? "udp" : "tcp", 
+					sv ? sv->s_name : "*");
+			}
+
 			readwrite(connfd);
 			close(connfd);
 			if (family != AF_UNIX)


Index: nc.spec
===================================================================
RCS file: /cvs/dist/rpms/nc/devel/nc.spec,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- nc.spec	28 Aug 2006 11:31:40 -0000	1.30
+++ nc.spec	29 Aug 2006 08:47:21 -0000	1.31
@@ -1,7 +1,7 @@
 Summary: Reads and writes data across network connections using TCP or UDP.
 Name: nc
 Version: 1.84
-Release: 7%{?dist}
+Release: 8%{?dist}
 URL:	 http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/
 Source0: nc-%{version}.tar.bz2
 Patch0: nc-1.84-glib.patch
@@ -12,6 +12,7 @@
 Patch5: nc-1.84-udp_stop.patch
 Patch6: nc-1.84-udp_port_scan.patch
 Patch7: nc-1.84-crlf.patch
+Patch8: nc-1.84-verb.patch
 License: GPL
 Group: Applications/Internet
 BuildRoot: %{_tmppath}/%{name}-root
@@ -41,6 +42,7 @@
 %patch5 -p1 -b .udp_stop
 %patch6 -p0 -b .port_scan
 %patch7 -p1 -b .crlf
+%patch8 -p1 -b .verb
 
 %build
 gcc $RPM_OPT_FLAGS -Werror `pkg-config --cflags --libs glib-2.0` netcat.c atomicio.c socks.c -o nc
@@ -62,6 +64,9 @@
 %doc README scripts
 
 %changelog
+* Tue Aug 29 2006 Radek Vokal <rvokal redhat com> - 1.84-8
+- fix verbose option (#202321) <varmojfekoj gmail com>
+
 * Mon Aug 28 2006 Radek Vokal <rvokal redhat com> - 1.84-7
 - add dist tag
 - add '-C' option and behaviour for sending CRLFs as line-ending (#203931) <koszorus reidea hu>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]