summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-05 12:23:32 +1100
committerDamien Miller <djm@mindrot.org>2002-02-05 12:23:32 +1100
commit68f45983b29ea1bb70cfe0affd8806c93e2a02e7 (patch)
tree9a3aa8d40d15e8b1f507f66f8371e49a661cf302
parent67f0bc043c2d3b4edd1d0cabb10cf3f10f544fb5 (diff)
- markus@cvs.openbsd.org 2002/02/03 17:59:23
[sshconnect2.c] more cross checking if announced vs. used key type; ok stevesk@
-rw-r--r--ChangeLog5
-rw-r--r--sshconnect2.c12
2 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e0388505..43b69475 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,9 @@
generic callbacks are not really used, remove and
add a callback for msg of type SSH2_MSG_CHANNEL_OPEN_CONFIRMATION
ok djm@
+ - markus@cvs.openbsd.org 2002/02/03 17:59:23
+ [sshconnect2.c]
+ more cross checking if announced vs. used key type; ok stevesk@
20020130
- (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
@@ -7471,4 +7474,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1817 2002/02/05 01:23:08 djm Exp $
+$Id: ChangeLog,v 1.1818 2002/02/05 01:23:32 djm Exp $
diff --git a/sshconnect2.c b/sshconnect2.c
index e4e20cad..ea8cfa6d 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect2.c,v 1.94 2002/01/25 21:00:24 markus Exp $");
+RCSID("$OpenBSD: sshconnect2.c,v 1.95 2002/02/03 17:59:23 markus Exp $");
#include "ssh.h"
#include "ssh2.h"
@@ -353,7 +353,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
Authctxt *authctxt = ctxt;
Key *key = NULL;
Buffer b;
- int alen, blen, sent = 0;
+ int pktype, alen, blen, sent = 0;
char *pkalg, *pkblob, *fp;
if (authctxt == NULL)
@@ -381,7 +381,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
debug("no last key or no sign cb");
break;
}
- if (key_type_from_name(pkalg) == KEY_UNSPEC) {
+ if ((pktype = key_type_from_name(pkalg)) == KEY_UNSPEC) {
debug("unknown pkalg %s", pkalg);
break;
}
@@ -389,6 +389,12 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
debug("no key from blob. pkalg %s", pkalg);
break;
}
+ if (key->type != pktype) {
+ error("input_userauth_pk_ok: type mismatch "
+ "for decoded key (received %d, expected %d)",
+ key->type, pktype);
+ break;
+ }
fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
debug2("input_userauth_pk_ok: fp %s", fp);
xfree(fp);