summaryrefslogtreecommitdiff
path: root/src/usr.bin/nc/netcat.c
diff options
context:
space:
mode:
authorbeck <>2019-10-23 13:49:24 +0000
committerbeck <>2019-10-23 13:49:24 +0000
commitd935e3abaf75a4cbc28e76d91ed597fcda5937fc (patch)
tree2a6b7eedf49ed2aa25960cc2ad760c992759491b /src/usr.bin/nc/netcat.c
parent5005c768b214178dfda133906da127d8d4c0a5bd (diff)
downloadopenbsd-d935e3abaf75a4cbc28e76d91ed597fcda5937fc.tar.gz
openbsd-d935e3abaf75a4cbc28e76d91ed597fcda5937fc.tar.bz2
openbsd-d935e3abaf75a4cbc28e76d91ed597fcda5937fc.zip
Revert previous, which works for -N case but causes regress failures
for tls, since the socket is shut down without calling tls_close(). Since nc appears to have a problem with this in other shutdown() cases I am simply going to bake a new diff for this. noticed by bluhm@.
Diffstat (limited to 'src/usr.bin/nc/netcat.c')
-rw-r--r--src/usr.bin/nc/netcat.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index 795592f0b7..711a49d247 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.207 2019/10/17 14:29:24 beck Exp $ */ 1/* $OpenBSD: netcat.c,v 1.208 2019/10/23 13:49:24 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * Copyright (c) 2015 Bob Beck. All rights reserved. 4 * Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -1259,23 +1259,6 @@ readwrite(int net_fd, struct tls *tls_ctx)
1259 if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) { 1259 if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) {
1260 pfd[POLL_STDOUT].fd = -1; 1260 pfd[POLL_STDOUT].fd = -1;
1261 } 1261 }
1262
1263 if (((usetls || Nflag) && (pfd[POLL_NETIN].fd == -1)) ||
1264 (usetls && pfd[POLL_NETOUT].fd == -1)) {
1265 /*
1266 * -N says: shutdown(2) the 'network socket'
1267 * after EOF on the input
1268 *
1269 * for TLS we need to die if either end is
1270 * toast, since both reading and writing to
1271 * the socket may be necessary for any higher
1272 * level tls operation
1273 */
1274 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR);
1275 shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
1276 pfd[POLL_NETOUT].fd = -1;
1277 pfd[POLL_NETIN].fd = -1;
1278 }
1279 } 1262 }
1280} 1263}
1281 1264