upstream commit

protocol handlers all get struct ssh passed; ok djm@

Upstream-ID: 0ca9ea2a5d01a6d2ded94c5024456a930c5bfb5d
diff --git a/channels.c b/channels.c
index e7de370..d118d8f 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.362 2017/05/30 08:49:58 markus Exp $ */
+/* $OpenBSD: channels.c,v 1.363 2017/05/30 14:23:52 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2394,9 +2394,8 @@
  * replaces local (proxy) channel ID with downstream channel ID.
  */
 int
-channel_proxy_upstream(Channel *c, int type, u_int32_t seq, void *ctxt)
+channel_proxy_upstream(Channel *c, int type, u_int32_t seq, struct ssh *ssh)
 {
-	struct ssh *ssh = active_state;
 	struct sshbuf *b = NULL;
 	Channel *downstream;
 	const u_char *cp = NULL;
@@ -2476,7 +2475,7 @@
 
 /* ARGSUSED */
 int
-channel_input_data(int type, u_int32_t seq, void *ctxt)
+channel_input_data(int type, u_int32_t seq, struct ssh *ssh)
 {
 	int id;
 	const u_char *data;
@@ -2488,7 +2487,7 @@
 	c = channel_lookup(id);
 	if (c == NULL)
 		packet_disconnect("Received data for nonexistent channel %d.", id);
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 
 	/* Ignore any data for non-open channels (might happen on close) */
@@ -2536,7 +2535,7 @@
 
 /* ARGSUSED */
 int
-channel_input_extended_data(int type, u_int32_t seq, void *ctxt)
+channel_input_extended_data(int type, u_int32_t seq, struct ssh *ssh)
 {
 	int id;
 	char *data;
@@ -2549,7 +2548,7 @@
 
 	if (c == NULL)
 		packet_disconnect("Received extended_data for bad channel %d.", id);
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 	if (c->type != SSH_CHANNEL_OPEN) {
 		logit("channel %d: ext data for non open", id);
@@ -2586,7 +2585,7 @@
 
 /* ARGSUSED */
 int
-channel_input_ieof(int type, u_int32_t seq, void *ctxt)
+channel_input_ieof(int type, u_int32_t seq, struct ssh *ssh)
 {
 	int id;
 	Channel *c;
@@ -2596,7 +2595,7 @@
 	c = channel_lookup(id);
 	if (c == NULL)
 		packet_disconnect("Received ieof for nonexistent channel %d.", id);
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 	chan_rcvd_ieof(c);
 
@@ -2612,14 +2611,14 @@
 
 /* ARGSUSED */
 int
-channel_input_oclose(int type, u_int32_t seq, void *ctxt)
+channel_input_oclose(int type, u_int32_t seq, struct ssh *ssh)
 {
 	int id = packet_get_int();
 	Channel *c = channel_lookup(id);
 
 	if (c == NULL)
 		packet_disconnect("Received oclose for nonexistent channel %d.", id);
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 	packet_check_eom();
 	chan_rcvd_oclose(c);
@@ -2628,7 +2627,7 @@
 
 /* ARGSUSED */
 int
-channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt)
+channel_input_open_confirmation(int type, u_int32_t seq, struct ssh *ssh)
 {
 	int id, remote_id;
 	Channel *c;
@@ -2639,7 +2638,7 @@
 	if (c==NULL)
 		packet_disconnect("Received open confirmation for "
 		    "unknown channel %d.", id);
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 	if (c->type != SSH_CHANNEL_OPENING)
 		packet_disconnect("Received open confirmation for "
@@ -2680,7 +2679,7 @@
 
 /* ARGSUSED */
 int
-channel_input_open_failure(int type, u_int32_t seq, void *ctxt)
+channel_input_open_failure(int type, u_int32_t seq, struct ssh *ssh)
 {
 	int id, reason;
 	char *msg = NULL, *lang = NULL;
@@ -2692,7 +2691,7 @@
 	if (c==NULL)
 		packet_disconnect("Received open failure for "
 		    "unknown channel %d.", id);
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 	if (c->type != SSH_CHANNEL_OPENING)
 		packet_disconnect("Received open failure for "
@@ -2719,7 +2718,7 @@
 
 /* ARGSUSED */
 int
-channel_input_window_adjust(int type, u_int32_t seq, void *ctxt)
+channel_input_window_adjust(int type, u_int32_t seq, struct ssh *ssh)
 {
 	Channel *c;
 	int id;
@@ -2733,7 +2732,7 @@
 		logit("Received window adjust for non-open channel %d.", id);
 		return 0;
 	}
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 	adjust = packet_get_int();
 	packet_check_eom();
@@ -2747,7 +2746,7 @@
 
 /* ARGSUSED */
 int
-channel_input_status_confirm(int type, u_int32_t seq, void *ctxt)
+channel_input_status_confirm(int type, u_int32_t seq, struct ssh *ssh)
 {
 	Channel *c;
 	struct channel_confirm *cc;
@@ -2763,7 +2762,7 @@
 		logit("channel_input_status_confirm: %d: unknown", id);
 		return 0;
 	}	
-	if (channel_proxy_upstream(c, type, seq, ctxt))
+	if (channel_proxy_upstream(c, type, seq, ssh))
 		return 0;
 	packet_check_eom();
 	if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL)