|
Lines 79-85
userauth_pubkey(Authctxt *authctxt)
Link Here
|
| 79 |
{ |
79 |
{ |
| 80 |
Buffer b; |
80 |
Buffer b; |
| 81 |
Key *key = NULL; |
81 |
Key *key = NULL; |
| 82 |
char *pkalg, *userstyle, *fp = NULL; |
82 |
char *pkalg, *userstyle, *pubkey, *fp = NULL; |
| 83 |
u_char *pkblob, *sig; |
83 |
u_char *pkblob, *sig; |
| 84 |
u_int alen, blen, slen; |
84 |
u_int alen, blen, slen; |
| 85 |
int have_sig, pktype; |
85 |
int have_sig, pktype; |
|
Lines 171-177
userauth_pubkey(Authctxt *authctxt)
Link Here
|
| 171 |
#ifdef DEBUG_PK |
171 |
#ifdef DEBUG_PK |
| 172 |
buffer_dump(&b); |
172 |
buffer_dump(&b); |
| 173 |
#endif |
173 |
#endif |
| 174 |
pubkey_auth_info(authctxt, key, NULL); |
174 |
pubkey = sshkey_format_oneline(key, options.fingerprint_hash); |
|
|
175 |
auth_info(authctxt, "%s", pubkey); |
| 175 |
|
176 |
|
| 176 |
/* test for correct signature */ |
177 |
/* test for correct signature */ |
| 177 |
authenticated = 0; |
178 |
authenticated = 0; |
|
Lines 179-187
userauth_pubkey(Authctxt *authctxt)
Link Here
|
| 179 |
PRIVSEP(key_verify(key, sig, slen, buffer_ptr(&b), |
180 |
PRIVSEP(key_verify(key, sig, slen, buffer_ptr(&b), |
| 180 |
buffer_len(&b))) == 1) { |
181 |
buffer_len(&b))) == 1) { |
| 181 |
authenticated = 1; |
182 |
authenticated = 1; |
|
|
183 |
authctxt->last_details = pubkey; |
| 182 |
/* Record the successful key to prevent reuse */ |
184 |
/* Record the successful key to prevent reuse */ |
| 183 |
auth2_record_userkey(authctxt, key); |
185 |
auth2_record_userkey(authctxt, key); |
| 184 |
key = NULL; /* Don't free below */ |
186 |
key = NULL; /* Don't free below */ |
|
|
187 |
} else { |
| 188 |
free(pubkey); |
| 185 |
} |
189 |
} |
| 186 |
buffer_free(&b); |
190 |
buffer_free(&b); |
| 187 |
free(sig); |
191 |
free(sig); |
|
Lines 222-228
done:
Link Here
|
| 222 |
void |
226 |
void |
| 223 |
pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...) |
227 |
pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...) |
| 224 |
{ |
228 |
{ |
| 225 |
char *fp, *extra; |
229 |
char *extra, *pubkey; |
| 226 |
va_list ap; |
230 |
va_list ap; |
| 227 |
int i; |
231 |
int i; |
| 228 |
|
232 |
|
|
Lines 232-258
pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...)
Link Here
|
| 232 |
i = vasprintf(&extra, fmt, ap); |
236 |
i = vasprintf(&extra, fmt, ap); |
| 233 |
va_end(ap); |
237 |
va_end(ap); |
| 234 |
if (i < 0 || extra == NULL) |
238 |
if (i < 0 || extra == NULL) |
| 235 |
fatal("%s: vasprintf failed", __func__); |
239 |
fatal("%s: vasprintf failed", __func__); |
| 236 |
} |
240 |
} |
| 237 |
|
241 |
|
| 238 |
if (key_is_cert(key)) { |
242 |
pubkey = sshkey_format_oneline(key, options.fingerprint_hash); |
| 239 |
fp = sshkey_fingerprint(key->cert->signature_key, |
243 |
auth_info(authctxt, "%s%s%s", pubkey, extra == NULL ? "" : ", ", |
| 240 |
options.fingerprint_hash, SSH_FP_DEFAULT); |
244 |
extra == NULL ? "" : extra); |
| 241 |
auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s%s%s", |
245 |
free(pubkey); |
| 242 |
key_type(key), key->cert->key_id, |
|
|
| 243 |
(unsigned long long)key->cert->serial, |
| 244 |
key_type(key->cert->signature_key), |
| 245 |
fp == NULL ? "(null)" : fp, |
| 246 |
extra == NULL ? "" : ", ", extra == NULL ? "" : extra); |
| 247 |
free(fp); |
| 248 |
} else { |
| 249 |
fp = sshkey_fingerprint(key, options.fingerprint_hash, |
| 250 |
SSH_FP_DEFAULT); |
| 251 |
auth_info(authctxt, "%s %s%s%s", key_type(key), |
| 252 |
fp == NULL ? "(null)" : fp, |
| 253 |
extra == NULL ? "" : ", ", extra == NULL ? "" : extra); |
| 254 |
free(fp); |
| 255 |
} |
| 256 |
free(extra); |
246 |
free(extra); |
| 257 |
} |
247 |
} |
| 258 |
|
248 |
|