summaryrefslogtreecommitdiff
path: root/net/netcat
diff options
context:
space:
mode:
authordrochner <drochner>2004-08-05 14:47:46 +0000
committerdrochner <drochner>2004-08-05 14:47:46 +0000
commite31a9d9ebc64fe23dc54bf98dba5785fd19a7ddc (patch)
tree90857ff4ad3efca0f933e5fabb3d4e0c798a83be /net/netcat
parent88eed0ad8e8be64c0f517bfc16d7acedfc98ccd3 (diff)
downloadpkgsrc-e31a9d9ebc64fe23dc54bf98dba5785fd19a7ddc.tar.gz
add a valuable feature from Debian: quit after EOF on stdin
being here, apply a string termination fix from Debian bump PKGREVISION
Diffstat (limited to 'net/netcat')
-rw-r--r--net/netcat/Makefile4
-rw-r--r--net/netcat/distinfo4
-rw-r--r--net/netcat/patches/patch-ad87
3 files changed, 82 insertions, 13 deletions
diff --git a/net/netcat/Makefile b/net/netcat/Makefile
index 1445b38cb64..8ad1e9a7b8d 100644
--- a/net/netcat/Makefile
+++ b/net/netcat/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.16 2004/02/24 09:15:47 jlam Exp $
+# $NetBSD: Makefile,v 1.17 2004/08/05 14:47:46 drochner Exp $
DISTNAME= nc110
PKGNAME= netcat-1.10
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= net
MASTER_SITES= ftp://coast.cs.purdue.edu/pub/tools/unix/netutils/netcat/ \
ftp://zippy.telcom.arizona.edu/pub/mirrors/avian.org/hacks/ \
diff --git a/net/netcat/distinfo b/net/netcat/distinfo
index 8dea39ea8e3..e8cc98cd3b4 100644
--- a/net/netcat/distinfo
+++ b/net/netcat/distinfo
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.8 2003/11/23 01:23:58 jlam Exp $
+$NetBSD: distinfo,v 1.9 2004/08/05 14:47:46 drochner Exp $
SHA1 (nc110.tgz) = f8ec3a39796b141b6654d39b7957b863c7f79a95
Size (nc110.tgz) = 75267 bytes
SHA1 (patch-aa) = 44dc8cf9072a1c127925a4efed6bb7f1428360bc
SHA1 (patch-ab) = 73990f9a87b04fffb22b94873e3225bd8ee496b5
SHA1 (patch-ac) = 8b0c41953ab0237304a31fb999e27a51df8cb0a9
-SHA1 (patch-ad) = ee5e1c6a8e3e2a239135d74dbf46fc25c8d2ec80
+SHA1 (patch-ad) = e55fc7036c3dbeedca49058e99725acf61e8f55c
SHA1 (patch-ae) = 510e4ac6c1649af4c719f3fc0ba5c65eadbe3564
SHA1 (patch-af) = 45b3824ff84c2557b0016d97b0309d5c8b597690
diff --git a/net/netcat/patches/patch-ad b/net/netcat/patches/patch-ad
index f9cfceb8743..94539a341fd 100644
--- a/net/netcat/patches/patch-ad
+++ b/net/netcat/patches/patch-ad
@@ -1,6 +1,6 @@
-$NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
+$NetBSD: patch-ad,v 1.3 2004/08/05 14:47:46 drochner Exp $
---- netcat.c.orig Tue Oct 8 13:24:18 2002
+--- netcat.c.orig 2004-08-05 16:17:46.000000000 +0200
+++ netcat.c
@@ -151,6 +151,7 @@ unsigned char * stage = NULL; /* hexdump
@@ -10,7 +10,30 @@ $NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
unsigned int o_interval = 0;
USHORT o_listen = 0;
USHORT o_nflag = 0;
-@@ -333,6 +334,7 @@ HINF * gethostpoop (name, numeric)
+@@ -160,6 +161,7 @@ USHORT o_udpmode = 0;
+ USHORT o_verbose = 0;
+ unsigned int o_wait = 0;
+ USHORT o_zero = 0;
++int o_quit = -1; /* 0 == quit-now; >0 == quit after o_quit seconds */
+ /* o_tn in optional section */
+
+ /* Debug macro: squirt whatever message and sleep a bit so we can see it go
+@@ -225,6 +227,14 @@ void catch ()
+ bail (" punt!");
+ }
+
++/* quit :
++ handler for a "-q" timeout (exit 0 instead of 1) */
++void quit()
++{
++ close(netfd);
++ exit(0);
++}
++
+ /* timeout and other signal handling cruft */
+ void tmtravel ()
+ {
+@@ -333,6 +343,7 @@ HINF * gethostpoop (name, numeric)
struct in_addr iaddr;
register HINF * poop = NULL;
register int x;
@@ -18,7 +41,7 @@ $NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
/* I really want to strangle the twit who dreamed up all these sockaddr and
hostent abstractions, and then forced them all to be incompatible with
-@@ -361,9 +363,9 @@ HINF * gethostpoop (name, numeric)
+@@ -361,9 +372,9 @@ HINF * gethostpoop (name, numeric)
bail ("gethostpoop fuxored");
strcpy (poop->name, unknown); /* preload it */
/* see wzv:workarounds.c for dg/ux return-a-struct inet_addr lossage */
@@ -30,7 +53,7 @@ $NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
if (numeric)
bail ("Can't parse %s as an IP address", name);
hostent = gethostbyname (name);
-@@ -620,6 +622,13 @@ newskt:
+@@ -620,6 +631,13 @@ newskt:
rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x));
if (rr == -1)
holler ("nnetfd reuseaddr failed"); /* ??? */
@@ -44,7 +67,26 @@ $NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
#ifdef SO_REUSEPORT /* doesnt exist everywhere... */
rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
if (rr == -1)
-@@ -1314,10 +1323,6 @@ main (argc, argv)
+@@ -1216,6 +1234,18 @@ Debug (("got %d from the net, errno %d",
+ if (rr <= 0) { /* at end, or fukt, or ... */
+ FD_CLR (0, ding1); /* disable and close stdin */
+ close (0);
++ /* if the user asked to exit on EOF, do it */
++ if (o_quit == 0) {
++ shutdown(netfd, 1);
++ close (fd);
++ exit (0);
++ }
++ /* if user asked to die after a while, arrange for it */
++ if (o_quit > 0) {
++ shutdown(netfd, 1);
++ signal (SIGALRM, quit);
++ alarm(o_quit);
++ }
+ } else {
+ rzleft = rr;
+ zp = bigbuf_in;
+@@ -1314,10 +1344,6 @@ main (argc, argv)
USHORT curport = 0;
char * randports = NULL;
@@ -55,12 +97,22 @@ $NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
/* I was in this barbershop quartet in Skokie IL ... */
/* round up the usual suspects, i.e. malloc up all the stuff we need */
lclend = (SAI *) Hmalloc (sizeof (SA));
-@@ -1389,12 +1394,14 @@ main (argc, argv)
+@@ -1354,7 +1380,8 @@ main (argc, argv)
+ argv[1] = cp; /* head of new arg block */
+ fprintf (stderr, "Cmd line: ");
+ fflush (stderr); /* I dont care if it's unbuffered or not! */
+- insaved = read (0, cp, BIGSIZ); /* we're gonna fake fgets() here */
++ insaved = read (0, cp, BIGSIZ-1); /* we're gonna fake fgets() here */
++ cp[BIGSIZ-1] = '\0';
+ if (insaved <= 0)
+ bail ("wrong");
+ x = findline (cp, insaved);
+@@ -1389,12 +1416,14 @@ main (argc, argv)
/* If your shitbox doesn't have getopt, step into the nineties already. */
/* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */
- while ((x = getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) != EOF) {
-+ while ((x = getopt (argc, argv, "abe:g:G:hi:lno:p:rs:tuvw:z")) != EOF) {
++ while ((x = getopt (argc, argv, "abe:g:G:hi:lno:p:q:rs:tuvw:z")) != EOF) {
/* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */
switch (x) {
case 'a':
@@ -71,7 +123,16 @@ $NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
#ifdef GAPING_SECURITY_HOLE
case 'e': /* prog to exec */
pr00gie = optarg;
-@@ -1642,6 +1649,7 @@ options:");
+@@ -1443,6 +1472,8 @@ main (argc, argv)
+ break;
+ case 'r': /* randomize various things */
+ o_random++; break;
++ case 'q': /* quit after stdin does EOF */
++ o_quit = atoi(optarg); break;
+ case 's': /* local source address */
+ /* do a full lookup [since everything else goes through the same mill],
+ unless -n was previously specified. In fact, careful placement of -n can
+@@ -1642,6 +1673,7 @@ options:");
-e prog program to exec after connect [dangerous!!]");
#endif
holler ("\
@@ -79,3 +140,11 @@ $NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $
-g gateway source-routing hop point[s], up to 8\n\
-G num source-routing pointer: 4, 8, 12, ...\n\
-h this cruft\n\
+@@ -1651,6 +1683,7 @@ options:");
+ -o file hex dump of traffic\n\
+ -p port local port number\n\
+ -r randomize local and remote ports\n\
++ -q secs quit after EOF on stdin and delay of secs\n\
+ -s addr local source address");
+ #ifdef TELNET
+ holler ("\