Your message dated Mon, 12 Dec 2016 15:18:53 +0000
with message-id <[email protected]>
and subject line Bug#711784: fixed in netcat-openbsd 1.130-1
has caused the Debian Bug report #711784,
regarding The crlf option of netcat doesn't replace all LF when the input is
not a terminal
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
711784: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711784
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: netcat-openbsd
Version: 1.105-7
The -C option of netcat is only replacing with CRLF the last LF of a read()
This happens to work quite well when the input is a terminal, as the file
descriptor is in line-mode, and catching all of them, but fails as soon as
you start piping to netcat.
A simple test is
( echo foo ; echo bar ) | nc.openbsd -C <destination> <port>
nc sends "foo\nbar\r\n" instead of the expected "foo\r\nbar\r\n"
I attach an alternative to the debian/patches/0005-send-crlf.patch file,
which fixes the issue.
From: Aron Xu <[email protected]>
Date: Mon, 13 Feb 2012 14:57:45 +0800
Subject: send crlf
---
nc.1 | 6 ++++--
netcat.c | 21 +++++++++++++++++----
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/nc.1 b/nc.1
index b7014a2..af44976 100644
--- a/nc.1
+++ b/nc.1
@@ -34,7 +34,7 @@
.Sh SYNOPSIS
.Nm nc
.Bk -words
-.Op Fl 46DdhklnrStUuvz
+.Op Fl 46CDdhklnrStUuvz
.Op Fl I Ar length
.Op Fl i Ar interval
.Op Fl O Ar length
@@ -98,6 +98,8 @@ to use IPv4 addresses only.
Forces
.Nm
to use IPv6 addresses only.
+.It Fl C
+Send CRLF as line-ending.
.It Fl D
Enable debugging on the socket.
.It Fl d
@@ -355,7 +357,7 @@ More complicated examples can be built up when the user knows the format
of requests required by the server.
As another example, an email may be submitted to an SMTP server using:
.Bd -literal -offset indent
-$ nc localhost 25 \*(Lt\*(Lt EOF
+$ nc [\-C] localhost 25 \*(Lt\*(Lt EOF
HELO host.example.com
MAIL FROM:\*([email protected]\*(Gt
RCPT TO:\*([email protected]\*(Gt
diff --git a/netcat.c b/netcat.c
index fdaca44..4f4d2bf 100644
--- a/netcat.c
+++ b/netcat.c
@@ -111,6 +111,7 @@
#define CONNECTION_TIMEOUT 2
/* Command Line Options */
+int Cflag = 0; /* CRLF line-ending */
int dflag; /* detached, no stdin */
unsigned int iflag; /* Interval Flag */
int jflag; /* use jumbo frames if we can */
@@ -180,7 +181,7 @@ main(int argc, char *argv[])
sv = NULL;
while ((ch = getopt(argc, argv,
- "46DdhI:i:jklnO:P:p:rSs:tT:UuV:vw:X:x:z")) != -1) {
+ "46CDdhI:i:jklnO:P:p:rSs:tT:UuV:vw:X:x:z")) != -1) {
switch (ch) {
case '4':
family = AF_INET;
@@ -309,6 +310,9 @@ main(int argc, char *argv[])
if (Tflag < 0 || Tflag > 255 || errstr || errno)
errx(1, "illegal tos value %s", optarg);
break;
+ case 'C':
+ Cflag = 1;
+ break;
default:
usage(1);
}
@@ -906,8 +910,25 @@ readwrite(int nfd)
else if (n == 0) {
goto shutdown_wr;
} else {
- if (atomicio(vwrite, nfd, buf, n) != n)
- return;
+ if (Cflag) {
+ int i, start = 0;
+ for (i = 0; i < n; i++) {
+ if (buf[i] == '\n') {
+ buf[i] = '\r';
+ if (atomicio(vwrite, nfd, buf + start, i - start + 1) != (i - start + 1))
+ return;
+ start = i;
+ buf[i] = '\n';
+ }
+ }
+
+ if (atomicio(vwrite, nfd, buf + start, i - start) != (i - start))
+ return;
+ }
+ else {
+ if (atomicio(vwrite, nfd, buf, n) != n)
+ return;
+ }
}
}
else if (pfd[1].revents & POLLHUP) {
@@ -1139,6 +1160,7 @@
fprintf(stderr, "\tCommand Summary:\n\
\t-4 Use IPv4\n\
\t-6 Use IPv6\n\
+ \t-C Send CRLF as line-ending\n\
\t-D Enable the debug socket option\n\
\t-d Detach from stdin\n\
\t-h This help text\n\
@@ -1172,7 +1194,7 @@
usage(int ret)
{
fprintf(stderr,
- "usage: nc [-46DdhjklnrStUuvz] [-I length] [-i interval] [-O length]\n"
+ "usage: nc [-46CDdhjklnrStUuvz] [-I length] [-i interval] [-O length]\n"
"\t [-P proxy_username] [-p source_port] [-s source] [-T toskeyword]\n"
"\t [-V rtable] [-w timeout] [-X proxy_protocol]\n"
"\t [-x proxy_address[:port]] [destination] [port]\n");
--
--- End Message ---
--- Begin Message ---
Source: netcat-openbsd
Source-Version: 1.130-1
We believe that the bug you reported is fixed in the latest version of
netcat-openbsd, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Guilhem Moulin <[email protected]> (supplier of updated netcat-openbsd
package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Fri, 11 Nov 2016 02:28:22 +0100
Source: netcat-openbsd
Binary: netcat-openbsd
Architecture: source amd64
Version: 1.130-1
Distribution: unstable
Urgency: low
Maintainer: Aron Xu <[email protected]>
Changed-By: Guilhem Moulin <[email protected]>
Description:
netcat-openbsd - TCP/IP swiss army knife
Closes: 682444 694844 702204 705223 711784 751105 752931 792454 817050
Changes:
netcat-openbsd (1.130-1) unstable; urgency=low
.
[ Aron Xu ]
* Fix cross build, thanks Colin Watson. (Closes: #694844)
.
[ Guilhem Moulin ]
* Add self to Uploaders.
* New upstream release. (Closes: #682444, #751105, #752931, #817050)
* Ensure each line ends with CRLF when -C is set, not just the last line
from the read buffer. (Closes: #705223, #711784)
* Pause after each line when -i is set, not just after the last line from
the read buffer.
* debian/control:
+ Bump Standards-Version to 3.9.8 (no changes necessary).
+ Upgrade Vcs-Git URI from git:// to https://.
+ Upgrade Vcs-Browser URI from http:// to https:// and switch to the
canonical cgit URI.
* debian/compat: Bump debhelper compatibility version to 9.
* debian/rules: Set DEB_BUILD_MAINT_OPTIONS to compile and link ELF
executables with hardening options enabled.
* debian/copyright:
+ Add missing entries for nc.1 and Makefile.
+ Replace the format URI http://dep.debian.net/deps/dep5/ by a versioned
one https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ .
* debian/patches/0001-port-to-linux-with-libsd.patch: Don't truncate to
"Proxy-Authorization" header to 7 bytes. Thanks to Petros Angelatos for
the patch. (Closes: #792454)
* debian/patches/0010-misc-failures-and-features.patch: fix broadcast
support (SO_BROADCAST is a socket-level option not a TCP socket option).
Thanks to Jakob Wrigley for the patch. (Closes: #702204)
Checksums-Sha1:
0cfc0fbfce09ab12c2f3124d4ab9049651cffe54 1575 netcat-openbsd_1.130-1.dsc
df1db0e9765228cefa651225abfca1bbefe64a72 16857 netcat-openbsd_1.130.orig.tar.gz
8f636a80e7ae5b64d843b8c2a8b90fbe03231de9 28480
netcat-openbsd_1.130-1.debian.tar.xz
6bd5969d3a5a1269d750c0507b7a947288562a97 27256
netcat-openbsd-dbgsym_1.130-1_amd64.deb
8533d0052ea2ff4771aa4ca41b9c5a18533144dd 4784
netcat-openbsd_1.130-1_amd64.buildinfo
a0529246518639149ea0c8dc9bc15fe8b8fb7ddf 37908 netcat-openbsd_1.130-1_amd64.deb
Checksums-Sha256:
d14092ed373e872b006cb4989e66b5460c16d7747156b0a61f6f9a1480b97ab5 1575
netcat-openbsd_1.130-1.dsc
fd7205065d0b47898851f31f33e614de5d47a5b9dc81fd50d2ff51b63d091e5b 16857
netcat-openbsd_1.130.orig.tar.gz
f35f72984df2c5a8d9e9e1b23e72875a0f9aa78ef9eb97f92f191b7390dbffda 28480
netcat-openbsd_1.130-1.debian.tar.xz
64d2fe78ebc348d8b6d3817e79559311e17b95e29d7d8c4dd99b1ca33eb1892d 27256
netcat-openbsd-dbgsym_1.130-1_amd64.deb
4e27f713ade2be587ad2b9dcd5d6495dd9a48058835d0a45ecf13e871e219fea 4784
netcat-openbsd_1.130-1_amd64.buildinfo
4c6950c18f50ee914e1a8b15fb825b169b369d60449ef7d7c5e81e96c3d00cd7 37908
netcat-openbsd_1.130-1_amd64.deb
Files:
f91de44e9996cfb815720e7573b7c92f 1575 net important netcat-openbsd_1.130-1.dsc
a8ffa0780252ce246b30e55d851d2d96 16857 net important
netcat-openbsd_1.130.orig.tar.gz
e828dac523fe5a223c51e2c3d26d1eaa 28480 net important
netcat-openbsd_1.130-1.debian.tar.xz
0367391f4877d45d032ca3d836a4b25a 27256 debug extra
netcat-openbsd-dbgsym_1.130-1_amd64.deb
44351d0e1e9d0d0384d71fbea4420033 4784 net important
netcat-openbsd_1.130-1_amd64.buildinfo
2d3d4438c0e50a72ac3893ae902ec4f7 37908 net important
netcat-openbsd_1.130-1_amd64.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBCAAGBQJYTrtXAAoJEPbsVcVkKA0ei20H/jt6UhnIB/WzsL+1zFv8wi4d
ZR+AgCeC1I5E5MhxveklK4gBvJGo0ir1KxEnX/TphErfKQ/ulCiSNBOAkwn4/jzZ
7HxKtAcY6mso6KXEyLsgpj05MPfdF9G0mtP4CzDDnOBvOiU69e9RJtNESVwNl/Mk
icmtsWvXO9UgkxdI+2Dg5Nq4DoNzOVIuPPwgQPAqefLLLpZKqr8jGbtD8AtJZBRp
xqSsp2bSfTPOBbDMVnrOmRqoxF7JxduR5drChuQHmNf8uMgB0FPbgBFR6dLf8U2q
LKNLf5tvE4MtLYa0C3uqn7BXlQkfJH9ql4rivTd4tAEvZlXmsquGM/u7hB8lLiM=
=XrU0
-----END PGP SIGNATURE-----
--- End Message ---