diff options
Diffstat (limited to 'net/netcat/patches/patch-ad')
-rw-r--r-- | net/netcat/patches/patch-ad | 87 |
1 files changed, 78 insertions, 9 deletions
diff --git a/net/netcat/patches/patch-ad b/net/netcat/patches/patch-ad index a6072329f2a..f9cfceb8743 100644 --- a/net/netcat/patches/patch-ad +++ b/net/netcat/patches/patch-ad @@ -1,12 +1,81 @@ -$NetBSD: patch-ad,v 1.1 2002/08/21 06:31:57 simonb Exp $ +$NetBSD: patch-ad,v 1.2 2002/10/08 14:29:37 abs Exp $ ---- data/rservice.c.orig Thu Feb 1 05:45:08 1996 -+++ data/rservice.c -@@ -10,6 +10,7 @@ - ... whatever. _H*/ +--- netcat.c.orig Tue Oct 8 13:24:18 2002 ++++ netcat.c +@@ -151,6 +151,7 @@ unsigned char * stage = NULL; /* hexdump - #include <stdio.h> -+#include <string.h> + /* global cmd flags: */ + USHORT o_alla = 0; ++USHORT o_allowbroad = 0; + unsigned int o_interval = 0; + USHORT o_listen = 0; + USHORT o_nflag = 0; +@@ -333,6 +334,7 @@ HINF * gethostpoop (name, numeric) + struct in_addr iaddr; + register HINF * poop = NULL; + register int x; ++ int rc; - /* change if you like; "id" is a good one for figuring out if you won too */ - static char cmd[] = "pwd"; + /* 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) + bail ("gethostpoop fuxored"); + strcpy (poop->name, unknown); /* preload it */ + /* see wzv:workarounds.c for dg/ux return-a-struct inet_addr lossage */ +- iaddr.s_addr = inet_addr (name); ++ rc = inet_aton(name, &iaddr); + +- if (iaddr.s_addr == INADDR_NONE) { /* here's the great split: names... */ ++ if (rc == 0) { /* here's the great split: names... */ + if (numeric) + bail ("Can't parse %s as an IP address", name); + hostent = gethostbyname (name); +@@ -620,6 +622,13 @@ newskt: + rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x)); + if (rr == -1) + holler ("nnetfd reuseaddr failed"); /* ??? */ ++#ifdef SO_BROADCAST ++ if (o_allowbroad) { ++ rr = setsockopt (nnetfd, SOL_SOCKET, SO_BROADCAST, &x, sizeof (x)); ++ if (rr == -1) ++ holler ("nnetfd reuseaddr failed"); /* ??? */ ++ } ++#endif + #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) + USHORT curport = 0; + char * randports = NULL; + +-#ifdef HAVE_BIND +-/* can *you* say "cc -yaddayadda netcat.c -lresolv -l44bsd" on SunLOSs? */ +- res_init(); +-#endif + /* 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) + + /* 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) { + /* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */ + switch (x) { + case 'a': + bail ("all-A-records NIY"); + o_alla++; break; ++ case 'b': ++ o_allowbroad++; break; + #ifdef GAPING_SECURITY_HOLE + case 'e': /* prog to exec */ + pr00gie = optarg; +@@ -1642,6 +1649,7 @@ options:"); + -e prog program to exec after connect [dangerous!!]"); + #endif + holler ("\ ++ -b allow broadcasts\n\ + -g gateway source-routing hop point[s], up to 8\n\ + -G num source-routing pointer: 4, 8, 12, ...\n\ + -h this cruft\n\ |