summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-01-31 19:26:20 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-01-31 19:26:20 +0000
commit10b60e1a48da698f3d212a31ed580df32b711fe7 (patch)
treea647523391b85fdee4b74211db1a18a2f861bb48
parent4a918ed330409e3ba82f86b8036342df94b7e0bb (diff)
ssh.com-2.0.1x does not send additional info in CHANNEL_OPEN_FAILURE messages; bug report from edmundo@rano.org
-rw-r--r--usr.bin/ssh/channels.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index af8e66b780b..ec196e9c304 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.85 2001/01/29 19:42:35 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.86 2001/01/31 19:26:19 markus Exp $");
#include <openssl/rsa.h>
#include <openssl/dsa.h>
@@ -1317,7 +1317,8 @@ channel_input_open_confirmation(int type, int plen, void *ctxt)
void
channel_input_open_failure(int type, int plen, void *ctxt)
{
- int id;
+ int id, reason;
+ char *msg = NULL, *lang = NULL;
Channel *c;
if (!compat20)
@@ -1330,13 +1331,18 @@ channel_input_open_failure(int type, int plen, void *ctxt)
packet_disconnect("Received open failure for "
"non-opening channel %d.", id);
if (compat20) {
- int reason = packet_get_int();
- char *msg = packet_get_string(NULL);
- char *lang = packet_get_string(NULL);
- log("channel_open_failure: %d: reason %d: %s", id, reason, msg);
+ reason = packet_get_int();
+ if (packet_remaining() > 0) {
+ msg = packet_get_string(NULL);
+ lang = packet_get_string(NULL);
+ }
packet_done();
- xfree(msg);
- xfree(lang);
+ log("channel_open_failure: %d: reason %d %s", id,
+ reason, msg ? msg : "<no additional info>");
+ if (msg != NULL)
+ xfree(msg);
+ if (lang != NULL)
+ xfree(lang);
}
/* Free the channel. This will also close the socket. */
channel_free(id);