summaryrefslogtreecommitdiff
path: root/auth2-pubkey.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-04-23 15:17:52 +1000
committerDamien Miller <djm@mindrot.org>2013-04-23 15:17:52 +1000
commit4ce189d9108c62090a0dd5dea973d175328440db (patch)
tree94f59288486756c522514572f4d9962e865790b2 /auth2-pubkey.c
parent5cbec4c25954b184e43bf3d3ac09e65eb474f5f9 (diff)
- djm@cvs.openbsd.org 2013/03/07 00:19:59
[auth2-pubkey.c monitor.c] reconstruct the original username that was sent by the client, which may have included a style (e.g. "root:skey") when checking public key signatures. Fixes public key and hostbased auth when the client specified a style; ok markus@
Diffstat (limited to 'auth2-pubkey.c')
-rw-r--r--auth2-pubkey.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/auth2-pubkey.c b/auth2-pubkey.c
index 3ff6faa8b..c28bef7a2 100644
--- a/auth2-pubkey.c
+++ b/auth2-pubkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-pubkey.c,v 1.34 2013/02/14 21:35:59 djm Exp $ */ 1/* $OpenBSD: auth2-pubkey.c,v 1.35 2013/03/07 00:19:59 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -75,7 +75,7 @@ userauth_pubkey(Authctxt *authctxt)
75{ 75{
76 Buffer b; 76 Buffer b;
77 Key *key = NULL; 77 Key *key = NULL;
78 char *pkalg; 78 char *pkalg, *userstyle;
79 u_char *pkblob, *sig; 79 u_char *pkblob, *sig;
80 u_int alen, blen, slen; 80 u_int alen, blen, slen;
81 int have_sig, pktype; 81 int have_sig, pktype;
@@ -127,7 +127,11 @@ userauth_pubkey(Authctxt *authctxt)
127 } 127 }
128 /* reconstruct packet */ 128 /* reconstruct packet */
129 buffer_put_char(&b, SSH2_MSG_USERAUTH_REQUEST); 129 buffer_put_char(&b, SSH2_MSG_USERAUTH_REQUEST);
130 buffer_put_cstring(&b, authctxt->user); 130 xasprintf(&userstyle, "%s%s%s", authctxt->user,
131 authctxt->style ? ":" : "",
132 authctxt->style ? authctxt->style : "");
133 buffer_put_cstring(&b, userstyle);
134 free(userstyle);
131 buffer_put_cstring(&b, 135 buffer_put_cstring(&b,
132 datafellows & SSH_BUG_PKSERVICE ? 136 datafellows & SSH_BUG_PKSERVICE ?
133 "ssh-userauth" : 137 "ssh-userauth" :