Package: release.debian.org Severity: normal User: release.debian.org@packages.debian.org Usertags: unblock Please unblock package netcat-openbsd Since 1.110 nc(1) no longer shutdown network sockets when stdin closes. This is a deliberate upstream decision, which can be reverted with the new ‘-N’ flag [0]. For better compatibility with GNU netcat we've added a quit timer (defaulting to -q0 since 1.89-4) to quit immediately after EOF. However our patch wasn't modified properly, and the upstream's new behavior with respect to shutdown(2) lead to a regression in 1.130-1 and 1.130-2. I'd like to upload 1.130-3 to Stretch as the regression affects libvirt and QEMU users which use nc(1) to talk to remote hypervisor sockets, cf. #854292. Since 1.130-3 nc(1) defaults to ‘-q-1’ (matching upstream's behavior), and ‘-q0’ is a mere alias for ‘-N’ (it was a no-op before). Furthermore the new patch is also simpler, so we're reducing our delta with upstream :-). Debdiff enclosed. unblock netcat-openbsd/1.130-3 -- Guilhem. [0] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/netcat.c?rev=1.111&content-type=text/x-cvsweb-markup [1] https://anonscm.debian.org/cgit/collab-maint/netcat-openbsd.git/tree/debian/patches/0005-quit-timer.patch
diff -Nru netcat-openbsd-1.130/debian/changelog netcat-openbsd-1.130/debian/changelog
--- netcat-openbsd-1.130/debian/changelog 2017-01-26 09:51:13.000000000 +0100
+++ netcat-openbsd-1.130/debian/changelog 2017-03-06 09:48:36.000000000 +0100
@@ -1,3 +1,12 @@
+netcat-openbsd (1.130-3) unstable; urgency=medium
+
+ * Change defaults from "-q0" to "-q-1" to match upstream defaults since the
+ introduction of flag "-N" in version 1.110. Passing a non-negative value
+ to "-q" now implies "-N"; in particular, "-q0" is now a mere alias for
+ "-N". (Closes: #854292)
+
+ -- Guilhem Moulin <guilhem@guilhem.org> Fri, 03 Mar 2017 20:32:55 +0100
+
netcat-openbsd (1.130-2) unstable; urgency=medium
* Fix handling of delayed exit option (Closes: #849192, LP: #1656785)
diff -Nru netcat-openbsd-1.130/debian/patches/0005-quit-timer.patch netcat-openbsd-1.130/debian/patches/0005-quit-timer.patch
--- netcat-openbsd-1.130/debian/patches/0005-quit-timer.patch 2017-01-26 09:51:13.000000000 +0100
+++ netcat-openbsd-1.130/debian/patches/0005-quit-timer.patch 2017-03-06 09:45:02.000000000 +0100
@@ -19,14 +19,19 @@
.Op Fl s Ar source
.Op Fl T Ar toskeyword
.Op Fl V Ar rtable
-@@ -171,6 +172,10 @@ Proxy authentication is only supported for HTTP CONNECT proxies at present.
+@@ -171,6 +172,15 @@ Proxy authentication is only supported for HTTP CONNECT proxies at present.
Specifies the source port
.Nm
should use, subject to privilege restrictions and availability.
+.It Fl q Ar seconds
-+after EOF on stdin, wait the specified number of seconds and then quit. If
++after EOF on stdin, wait the specified number of
+.Ar seconds
-+is negative, wait forever.
++and then quit. If
++.Ar seconds
++is negative, wait forever (default). Specifying a non-negative
++.Ar seconds
++implies
++.Fl N .
.It Fl r
Specifies that source and/or destination ports should be chosen randomly
instead of sequentially within a range or in the order that the system
@@ -38,21 +43,20 @@
int nflag; /* Don't do name look up */
char *Pflag; /* Proxy username */
char *pflag; /* Localport flag */
-+int qflag = 0; /* Quit after some secs */
++int qflag = -1; /* Quit after some secs */
int rflag; /* Random ports flag */
char *sflag; /* Source Address */
int tflag; /* Telnet Emulation */
-@@ -171,6 +172,9 @@ ssize_t fillbuf(int, unsigned char *, size_t *);
+@@ -171,6 +172,8 @@ ssize_t fillbuf(int, unsigned char *, size_t *);
static int connect_with_timeout(int fd, const struct sockaddr *sa,
socklen_t salen, int ctimeout);
-+int quit_fd = -1;
+static void quit();
+
int
main(int argc, char *argv[])
{
-@@ -195,7 +199,7 @@ main(int argc, char *argv[])
+@@ -195,7 +198,7 @@ main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN);
while ((ch = getopt(argc, argv,
@@ -61,7 +65,7 @@
switch (ch) {
case '4':
family = AF_INET;
-@@ -248,6 +252,11 @@ main(int argc, char *argv[])
+@@ -248,6 +251,13 @@ main(int argc, char *argv[])
case 'p':
pflag = optarg;
break;
@@ -69,49 +73,43 @@
+ qflag = strtonum(optarg, INT_MIN, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "quit timer %s: %s", errstr, optarg);
++ if (qflag >= 0)
++ Nflag = 1;
+ break;
case 'r':
rflag = 1;
break;
-@@ -917,19 +926,31 @@ readwrite(int net_fd)
- /* both inputs are gone, buffers are empty, we are done */
+@@ -918,18 +928,26 @@ readwrite(int net_fd)
if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1
&& stdinbufpos == 0 && netinbufpos == 0) {
-- close(net_fd);
+ close(net_fd);
- return;
-+ if (qflag == 0) {
-+ close(net_fd);
++ if (qflag <= 0)
+ return;
-+ }
+ goto delay_exit;
}
/* both outputs are gone, we can't continue */
if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) {
-- close(net_fd);
+ close(net_fd);
- return;
-+ if (qflag == 0) {
-+ close(net_fd);
++ if (qflag <= 0)
+ return;
-+ }
+ goto delay_exit;
}
/* listen and net in gone, queues empty, done */
if (lflag && pfd[POLL_NETIN].fd == -1
&& stdinbufpos == 0 && netinbufpos == 0) {
-- close(net_fd);
+ close(net_fd);
- return;
-+ if (qflag == 0) {
-+ close(net_fd);
++ if (qflag <= 0)
+ return;
-+ }
+delay_exit:
-+ quit_fd = net_fd;
+ signal(SIGALRM, quit);
+ alarm(qflag);
}
/* poll */
-@@ -1436,6 +1457,7 @@ help(void)
+@@ -1436,6 +1454,7 @@ help(void)
\t-O length TCP send buffer length\n\
\t-P proxyuser\tUsername for proxy authentication\n\
\t-p port\t Specify local port for remote connects\n\
@@ -119,7 +117,7 @@
\t-r Randomize remote ports\n\
\t-S Enable the TCP MD5 signature option\n\
\t-s addr\t Local source address\n\
-@@ -1458,9 +1480,21 @@ usage(int ret)
+@@ -1458,9 +1477,18 @@ usage(int ret)
{
fprintf(stderr,
"usage: nc [-46CDdFhklNnrStUuvz] [-I length] [-i interval] [-O length]\n"
@@ -138,8 +136,5 @@
+ */
+static void quit()
+{
-+ if (quit_fd >= 0)
-+ close(quit_fd);
-+
-+ exit(0);
++ exit(0);
+}
Attachment:
signature.asc
Description: PGP signature