diff options
author | Damien Miller <djm@mindrot.org> | 2013-07-18 16:10:09 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-07-18 16:10:09 +1000 |
commit | 20bdcd72365e8b3d51261993928cc47c5f0d7c8a (patch) | |
tree | db4f44ba0f86b271a9493ce0d866941f0ac5a953 /auth2-pubkey.c | |
parent | 3071070b39e6d1722151c754cdc2b26640eaf45e (diff) |
- djm@cvs.openbsd.org 2013/06/21 00:34:49
[auth-rsa.c auth.h auth2-hostbased.c auth2-pubkey.c monitor.c]
for hostbased authentication, print the client host and user on
the auth success/failure line; bz#2064, ok dtucker@
Diffstat (limited to 'auth2-pubkey.c')
-rw-r--r-- | auth2-pubkey.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/auth2-pubkey.c b/auth2-pubkey.c index 45306f839..2b3ecb104 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-pubkey.c,v 1.37 2013/05/19 02:38:28 djm Exp $ */ | 1 | /* $OpenBSD: auth2-pubkey.c,v 1.38 2013/06/21 00:34:49 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -147,7 +147,7 @@ userauth_pubkey(Authctxt *authctxt) | |||
147 | #ifdef DEBUG_PK | 147 | #ifdef DEBUG_PK |
148 | buffer_dump(&b); | 148 | buffer_dump(&b); |
149 | #endif | 149 | #endif |
150 | pubkey_auth_info(authctxt, key); | 150 | pubkey_auth_info(authctxt, key, NULL); |
151 | 151 | ||
152 | /* test for correct signature */ | 152 | /* test for correct signature */ |
153 | authenticated = 0; | 153 | authenticated = 0; |
@@ -190,23 +190,37 @@ done: | |||
190 | } | 190 | } |
191 | 191 | ||
192 | void | 192 | void |
193 | pubkey_auth_info(Authctxt *authctxt, const Key *key) | 193 | pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...) |
194 | { | 194 | { |
195 | char *fp; | 195 | char *fp, *extra; |
196 | va_list ap; | ||
197 | int i; | ||
198 | |||
199 | extra = NULL; | ||
200 | if (fmt != NULL) { | ||
201 | va_start(ap, fmt); | ||
202 | i = vasprintf(&extra, fmt, ap); | ||
203 | va_end(ap); | ||
204 | if (i < 0 || extra == NULL) | ||
205 | fatal("%s: vasprintf failed", __func__); | ||
206 | } | ||
196 | 207 | ||
197 | if (key_is_cert(key)) { | 208 | if (key_is_cert(key)) { |
198 | fp = key_fingerprint(key->cert->signature_key, | 209 | fp = key_fingerprint(key->cert->signature_key, |
199 | SSH_FP_MD5, SSH_FP_HEX); | 210 | SSH_FP_MD5, SSH_FP_HEX); |
200 | auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s", | 211 | auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s%s%s", |
201 | key_type(key), key->cert->key_id, | 212 | key_type(key), key->cert->key_id, |
202 | (unsigned long long)key->cert->serial, | 213 | (unsigned long long)key->cert->serial, |
203 | key_type(key->cert->signature_key), fp); | 214 | key_type(key->cert->signature_key), fp, |
215 | extra == NULL ? "" : ", ", extra == NULL ? "" : extra); | ||
204 | free(fp); | 216 | free(fp); |
205 | } else { | 217 | } else { |
206 | fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); | 218 | fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); |
207 | auth_info(authctxt, "%s %s", key_type(key), fp); | 219 | auth_info(authctxt, "%s %s%s%s", key_type(key), fp, |
220 | extra == NULL ? "" : ", ", extra == NULL ? "" : extra); | ||
208 | free(fp); | 221 | free(fp); |
209 | } | 222 | } |
223 | free(extra); | ||
210 | } | 224 | } |
211 | 225 | ||
212 | static int | 226 | static int |