diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2000-06-19 00:50:12 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2000-06-19 00:50:12 +0000 |
commit | 0955a530f45285c33894b242e5ea3972187bfaa2 (patch) | |
tree | be1b6f50c8c132006c3b1106de486bac8d646819 /usr.bin/ssh/sshconnect2.c | |
parent | c6db3aea09f76d82c044f4d46747bedc65dd0ba9 (diff) |
make userauth+pubkey interop with ssh.com-2.2.0
Diffstat (limited to 'usr.bin/ssh/sshconnect2.c')
-rw-r--r-- | usr.bin/ssh/sshconnect2.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c index 77b8652ea7f..6b4747cc589 100644 --- a/usr.bin/ssh/sshconnect2.c +++ b/usr.bin/ssh/sshconnect2.c @@ -28,7 +28,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect2.c,v 1.13 2000/06/02 02:00:19 todd Exp $"); +RCSID("$OpenBSD: sshconnect2.c,v 1.14 2000/06/19 00:50:11 markus Exp $"); #include <openssl/bn.h> #include <openssl/rsa.h> @@ -295,6 +295,7 @@ ssh2_try_pubkey(char *filename, unsigned char *blob, *signature; int bloblen, slen; struct stat st; + int skip = 0; if (stat(filename, &st) != 0) { debug("key does not exist: %s", filename); @@ -321,7 +322,13 @@ ssh2_try_pubkey(char *filename, /* data to be signed */ buffer_init(&b); - buffer_append(&b, session_id2, session_id2_len); + if (datafellows & SSH_COMPAT_SESSIONID_ENCODING) { + buffer_put_string(&b, session_id2, session_id2_len); + skip = buffer_len(&b); + } else { + buffer_append(&b, session_id2, session_id2_len); + skip = session_id2_len; + } buffer_put_char(&b, SSH2_MSG_USERAUTH_REQUEST); buffer_put_cstring(&b, server_user); buffer_put_cstring(&b, @@ -357,9 +364,9 @@ ssh2_try_pubkey(char *filename, xfree(signature); /* skip session id and packet type */ - if (buffer_len(&b) < session_id2_len + 1) + if (buffer_len(&b) < skip + 1) fatal("ssh2_try_pubkey: internal error"); - buffer_consume(&b, session_id2_len + 1); + buffer_consume(&b, skip + 1); /* put remaining data from buffer into packet */ packet_start(SSH2_MSG_USERAUTH_REQUEST); |