unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob e301f4c5807612eae9878dd014706117c3478f48 2596 bytes (raw)
name: gnu/packages/patches/netcat-openbsd-use-flags-to-specify-listen-address.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
 
From: Guilhem Moulin <guilhem@debian.org>
Date: Mon, 22 Oct 2018 04:50:54 +0200
Subject: use -s/-p flags to specify listen address

---
 nc.1     |   18 ++++++++++++++----
 netcat.c |   49 +++++++++++++++++++++++++++++--------------------
 2 files changed, 43 insertions(+), 24 deletions(-)

--- a/nc.1
+++ b/nc.1
@@ -143,8 +143,20 @@ multiple hosts.
 .It Fl l
 Listen for an incoming connection rather than initiating a
 connection to a remote host.
-Cannot be used together with any of the options
-.Fl psxz .
+The
+.Ar destination
+and
+.Ar port
+to listen on can be specified either as non-optional arguments, or with
+options
+.Fl s
+and
+.Fl p
+respectively.
+Cannot be used together with
+.Fl x
+or
+.Fl z .
 Additionally, any timeouts specified with the
 .Fl w
 option are ignored.
@@ -194,8 +206,6 @@ For
 datagram sockets, specifies the local temporary socket file
 to create and use so that datagrams can be received.
 Cannot be used together with
-.Fl l
-or
 .Fl x .
 .It Fl T Ar keyword
 Change the IPv4 TOS/IPv6 traffic class value.
--- a/netcat.c
+++ b/netcat.c
@@ -509,31 +509,40 @@ main(int argc, char *argv[])
 # endif
 
 	/* Cruft to make sure options are clean, and used properly. */
-	if (argv[0] && !argv[1] && family == AF_UNIX) {
-# if defined(IPPROTO_DCCP) && defined(SOCK_DCCP)
-		if (dccpflag)
-			errx(1, "cannot use -Z and -U");
-# endif
-		host = argv[0];
-		uport = NULL;
-	} else if (!argv[0] && lflag) {
-		if (sflag)
-			errx(1, "cannot use -s and -l");
-		if (pflag)
-			errx(1, "cannot use -p and -l");
-		if (zflag)
-			errx(1, "cannot use -z and -l");
-	} else if (argv[0] && !argv[1]) {
-		if (!lflag)
-			usage(1);
-		uport = &argv[0];
-		host = NULL;
-	} else if (argv[0] && argv[1]) {
+	if (argc == 0 && lflag) {
+		uport = &pflag;
+		host = sflag;
+	} else if (argc == 1 && !pflag && !sflag) {
+		if (family == AF_UNIX) {
+			host = argv[0];
+			uport = NULL;
+		} else if (lflag) {
+			host  = NULL;
+			uport = argv;
+		}
+	} else if (argc >= 2) {
+		if (lflag && (pflag || sflag || argc > 2))
+			usage(1); /* conflict */
 		host = argv[0];
 		uport = &argv[1];
 	} else
 		usage(1);
 
+	if (family == AF_UNIX) {
+# if defined(IPPROTO_DCCP) && defined(SOCK_DCCP)
+		if (dccpflag)
+			errx(1, "cannot use -Z and -U");
+# endif
+		if (uport && *uport)
+			errx(1, "cannot use port with -U");
+		if (!host)
+			errx(1, "missing socket pathname");
+	} else if (!uport || !*uport)
+		errx(1, "missing port number");
+
+	if (lflag && zflag)
+		errx(1, "cannot use -z and -l");
+
 # if defined(TLS)
 	if (usetls) {
 		if (Cflag && unveil(Cflag, "r") == -1)

debug log:

solving e301f4c580 ...
found e301f4c580 in https://yhetil.org/guix-patches/3dfac477-b081-49f4-86b3-2c142bb39f6b@www.fastmail.com/

applying [1/1] https://yhetil.org/guix-patches/3dfac477-b081-49f4-86b3-2c142bb39f6b@www.fastmail.com/
diff --git a/gnu/packages/patches/netcat-openbsd-use-flags-to-specify-listen-address.patch b/gnu/packages/patches/netcat-openbsd-use-flags-to-specify-listen-address.patch
new file mode 100644
index 0000000000..e301f4c580

1:54: trailing whitespace.
 
1:55: space before tab in indent.
 	/* Cruft to make sure options are clean, and used properly. */
1:90: space before tab in indent.
 		host = argv[0];
1:91: space before tab in indent.
 		uport = &argv[1];
1:92: space before tab in indent.
 	} else
Checking patch gnu/packages/patches/netcat-openbsd-use-flags-to-specify-listen-address.patch...
Applied patch gnu/packages/patches/netcat-openbsd-use-flags-to-specify-listen-address.patch cleanly.
warning: squelched 4 whitespace errors
warning: 9 lines add whitespace errors.

index at:
100644 e301f4c5807612eae9878dd014706117c3478f48	gnu/packages/patches/netcat-openbsd-use-flags-to-specify-listen-address.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).