summaryrefslogtreecommitdiff
path: root/mux.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-05-01 04:03:20 +0000
committerDamien Miller <djm@mindrot.org>2015-05-10 11:54:25 +1000
commitca430d4d9cc0f62eca3b1fb1e2928395b7ce80f7 (patch)
treede10ec4d3bba6058019b1e09ee483b32489f83bb /mux.c
parent8312cfb8ad88657517b3e23ac8c56c8e38eb9792 (diff)
upstream commit
remove failed remote forwards established by muliplexing from the list of active forwards; bz#2363, patch mostly by Yoann Ricordel; ok dtucker@
Diffstat (limited to 'mux.c')
-rw-r--r--mux.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/mux.c b/mux.c
index e8d753d00..cdc01bd4f 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.52 2015/05/01 04:01:58 djm Exp $ */ 1/* $OpenBSD: mux.c,v 1.53 2015/05/01 04:03:20 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -593,7 +593,9 @@ mux_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
593 return; 593 return;
594 } 594 }
595 buffer_init(&out); 595 buffer_init(&out);
596 if (fctx->fid >= options.num_remote_forwards) { 596 if (fctx->fid >= options.num_remote_forwards ||
597 (options.remote_forwards[fctx->fid].connect_path == NULL &&
598 options.remote_forwards[fctx->fid].connect_host == NULL)) {
597 xasprintf(&failmsg, "unknown forwarding id %d", fctx->fid); 599 xasprintf(&failmsg, "unknown forwarding id %d", fctx->fid);
598 goto fail; 600 goto fail;
599 } 601 }
@@ -627,6 +629,17 @@ mux_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
627 else 629 else
628 xasprintf(&failmsg, "remote port forwarding failed for " 630 xasprintf(&failmsg, "remote port forwarding failed for "
629 "listen port %d", rfwd->listen_port); 631 "listen port %d", rfwd->listen_port);
632
633 debug2("%s: clearing registered forwarding for listen %d, "
634 "connect %s:%d", __func__, rfwd->listen_port,
635 rfwd->connect_path ? rfwd->connect_path :
636 rfwd->connect_host, rfwd->connect_port);
637
638 free(rfwd->listen_host);
639 free(rfwd->listen_path);
640 free(rfwd->connect_host);
641 free(rfwd->connect_path);
642 memset(rfwd, 0, sizeof(*rfwd));
630 } 643 }
631 fail: 644 fail:
632 error("%s: %s", __func__, failmsg); 645 error("%s: %s", __func__, failmsg);