summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-04-23 21:09:44 +1000
committerDamien Miller <djm@mindrot.org>2002-04-23 21:09:44 +1000
commit2797f7f03a6aecfaaf2dadb1284b4b51869339d6 (patch)
tree3abe68f5830195c04c3db25ad2adf0eee8254529
parentd7de14b6ada79812cf3a1ceb8f921d92d4d180be (diff)
- markus@cvs.openbsd.org 2002/04/22 21:04:52
[channels.c clientloop.c clientloop.h ssh.c] request reply (success/failure) for -R style fwd in protocol v2, depends on ordered replies. fixes http://bugzilla.mindrot.org/show_bug.cgi?id=215; ok provos@
-rw-r--r--ChangeLog7
-rw-r--r--channels.c4
-rw-r--r--clientloop.c7
-rw-r--r--clientloop.h3
-rw-r--r--ssh.c26
5 files changed, 41 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 62e88bc3..82632dbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,11 @@
- markus@cvs.openbsd.org 2002/04/22 16:16:53
[servconf.c sshd.8 sshd_config]
do not auto-enable KerberosAuthentication; ok djm@, provos@, deraadt@
+ - markus@cvs.openbsd.org 2002/04/22 21:04:52
+ [channels.c clientloop.c clientloop.h ssh.c]
+ request reply (success/failure) for -R style fwd in protocol v2,
+ depends on ordered replies.
+ fixes http://bugzilla.mindrot.org/show_bug.cgi?id=215; ok provos@
20020421
- (tim) [entropy.c.] Portability fix for SCO Unix 3.2v4.x (SCO OSR 3.0).
@@ -8290,4 +8295,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.2069 2002/04/23 11:04:51 djm Exp $
+$Id: ChangeLog,v 1.2070 2002/04/23 11:09:44 djm Exp $
diff --git a/channels.c b/channels.c
index 95817624..520bff82 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.172 2002/03/25 21:13:51 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.173 2002/04/22 21:04:52 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -2130,7 +2130,7 @@ channel_request_remote_forwarding(u_short listen_port,
const char *address_to_bind = "0.0.0.0";
packet_start(SSH2_MSG_GLOBAL_REQUEST);
packet_put_cstring("tcpip-forward");
- packet_put_char(0); /* boolean: want reply */
+ packet_put_char(1); /* boolean: want reply */
packet_put_cstring(address_to_bind);
packet_put_int(listen_port);
packet_send();
diff --git a/clientloop.c b/clientloop.c
index 7644ff39..15945a80 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.99 2002/03/21 23:07:37 markus Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.100 2002/04/22 21:04:52 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -1314,6 +1314,7 @@ static void
client_init_dispatch_20(void)
{
dispatch_init(&dispatch_protocol_error);
+
dispatch_set(SSH2_MSG_CHANNEL_CLOSE, &channel_input_oclose);
dispatch_set(SSH2_MSG_CHANNEL_DATA, &channel_input_data);
dispatch_set(SSH2_MSG_CHANNEL_EOF, &channel_input_ieof);
@@ -1327,6 +1328,10 @@ client_init_dispatch_20(void)
/* rekeying */
dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit);
+
+ /* global request reply messages */
+ dispatch_set(SSH2_MSG_REQUEST_FAILURE, &client_global_request_reply);
+ dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &client_global_request_reply);
}
static void
client_init_dispatch_13(void)
diff --git a/clientloop.h b/clientloop.h
index 1bc9a952..8056a40c 100644
--- a/clientloop.h
+++ b/clientloop.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.h,v 1.6 2001/06/26 17:27:23 markus Exp $ */
+/* $OpenBSD: clientloop.h,v 1.7 2002/04/22 21:04:52 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -37,3 +37,4 @@
/* Client side main loop for the interactive session. */
int client_loop(int, int, int);
+void client_global_request_reply(int type, u_int32_t seq, void *ctxt);
diff --git a/ssh.c b/ssh.c
index c89b4135..afaf20be 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.169 2002/03/26 11:37:05 markus Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.170 2002/04/22 21:04:52 markus Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -146,6 +146,9 @@ Buffer command;
/* Should we execute a command or invoke a subsystem? */
int subsystem_flag = 0;
+/* # of replies received for global requests */
+static int client_global_request_id = 0;
+
/* Prints a help message to the user. This function never returns. */
static void
@@ -1041,6 +1044,27 @@ client_subsystem_reply(int type, u_int32_t seq, void *ctxt)
len, (u_char *)buffer_ptr(&command), id);
}
+void
+client_global_request_reply(int type, u_int32_t seq, void *ctxt)
+{
+ int i;
+
+ i = client_global_request_id++;
+ if (i >= options.num_remote_forwards) {
+ debug("client_global_request_reply: too many replies %d > %d",
+ i, options.num_remote_forwards);
+ return;
+ }
+ debug("remote forward %s for: listen %d, connect %s:%d",
+ type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure",
+ options.remote_forwards[i].port,
+ options.remote_forwards[i].host,
+ options.remote_forwards[i].host_port);
+ if (type == SSH2_MSG_REQUEST_FAILURE)
+ log("Warning: remote port forwarding failed for listen port %d",
+ options.remote_forwards[i].port);
+}
+
/* request pty/x11/agent/tcpfwd/shell for channel */
static void
ssh_session2_setup(int id, void *arg)