summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/mux.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2016-01-19 18:55:44 +0000
committerdes <des@FreeBSD.org>2016-01-19 18:55:44 +0000
commitb856a4573162fbc9ddf1c38fd82b6c728c310d1b (patch)
treeb2a4ad7a06e845ba72a87d2beedfbbcbb7aeb5bb /crypto/openssh/mux.c
parent76107b08804f309434efce7480edc2bbd15e1bf7 (diff)
parentf8195792ec11c7b20879183ea72e1495f0870617 (diff)
downloadFreeBSD-src-b856a4573162fbc9ddf1c38fd82b6c728c310d1b.zip
FreeBSD-src-b856a4573162fbc9ddf1c38fd82b6c728c310d1b.tar.gz
Upgrade to OpenSSH 6.9p1.
Diffstat (limited to 'crypto/openssh/mux.c')
-rw-r--r--crypto/openssh/mux.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/crypto/openssh/mux.c b/crypto/openssh/mux.c
index 52641cb..8ae9cdf 100644
--- a/crypto/openssh/mux.c
+++ b/crypto/openssh/mux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mux.c,v 1.50 2015/01/20 23:14:00 deraadt Exp $ */
+/* $OpenBSD: mux.c,v 1.53 2015/05/01 04:03:20 djm Exp $ */
/*
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
*
@@ -351,7 +351,7 @@ process_mux_new_session(u_int rid, Channel *c, Buffer *m, Buffer *r)
free(cp);
continue;
}
- cctx->env = xrealloc(cctx->env, env_len + 2,
+ cctx->env = xreallocarray(cctx->env, env_len + 2,
sizeof(*cctx->env));
cctx->env[env_len++] = cp;
cctx->env[env_len] = NULL;
@@ -594,7 +594,9 @@ mux_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
return;
}
buffer_init(&out);
- if (fctx->fid >= options.num_remote_forwards) {
+ if (fctx->fid >= options.num_remote_forwards ||
+ (options.remote_forwards[fctx->fid].connect_path == NULL &&
+ options.remote_forwards[fctx->fid].connect_host == NULL)) {
xasprintf(&failmsg, "unknown forwarding id %d", fctx->fid);
goto fail;
}
@@ -606,7 +608,7 @@ mux_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
if (type == SSH2_MSG_REQUEST_SUCCESS) {
if (rfwd->listen_port == 0) {
rfwd->allocated_port = packet_get_int();
- logit("Allocated port %u for mux remote forward"
+ debug("Allocated port %u for mux remote forward"
" to %s:%d", rfwd->allocated_port,
rfwd->connect_host, rfwd->connect_port);
buffer_put_int(&out, MUX_S_REMOTE_PORT);
@@ -628,6 +630,17 @@ mux_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
else
xasprintf(&failmsg, "remote port forwarding failed for "
"listen port %d", rfwd->listen_port);
+
+ debug2("%s: clearing registered forwarding for listen %d, "
+ "connect %s:%d", __func__, rfwd->listen_port,
+ rfwd->connect_path ? rfwd->connect_path :
+ rfwd->connect_host, rfwd->connect_port);
+
+ free(rfwd->listen_host);
+ free(rfwd->listen_path);
+ free(rfwd->connect_host);
+ free(rfwd->connect_path);
+ memset(rfwd, 0, sizeof(*rfwd));
}
fail:
error("%s: %s", __func__, failmsg);
@@ -1723,7 +1736,7 @@ mux_client_forward(int fd, int cancel_flag, u_int ftype, struct Forward *fwd)
if (cancel_flag)
fatal("%s: got MUX_S_REMOTE_PORT for cancel", __func__);
fwd->allocated_port = buffer_get_int(&m);
- logit("Allocated port %u for remote forward to %s:%d",
+ verbose("Allocated port %u for remote forward to %s:%d",
fwd->allocated_port,
fwd->connect_host ? fwd->connect_host : "",
fwd->connect_port);
OpenPOWER on IntegriCloud