1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Pageant client: tolerate failure to list keys.

This enables Pageant to act as a client for OpenSSH's agent, which
nowadays refuses to respond to SSH1_AGENTC_REQUEST_RSA_IDENTITIES, or
any other SSH1_AGENTC_* message. It now treats SSH_AGENT_FAILURE in
response to either 'list identities' request the same as successfully
receiving an empty list.
This commit is contained in:
Simon Tatham 2020-03-03 21:44:19 +00:00
parent e85b159d87
commit cdffb995df

View File

@ -2082,25 +2082,18 @@ int pageant_enum_keys(pageant_key_enum_fn_t callback, void *callback_ctx,
int toret = PAGEANT_ACTION_FAILURE;
kl1 = pageant_get_keylist(1);
if (!kl1) {
*retstr = dupstr("Did not receive an SSH-1 key list from agent");
goto out;
}
if (kl1->broken) {
if (kl1 && kl1->broken) {
*retstr = dupstr("Received broken SSH-1 key list from agent");
goto out;
}
kl2 = pageant_get_keylist(2);
if (!kl2) {
*retstr = dupstr("Did not receive an SSH-2 key list from agent");
goto out;
}
if (kl2->broken) {
if (kl2 && kl2->broken) {
*retstr = dupstr("Received broken SSH-2 key list from agent");
goto out;
}
if (kl1) {
for (size_t i = 0; i < kl1->nkeys; i++) {
cbkey.blob = strbuf_new();
put_datapl(cbkey.blob, kl1->keys[i].blob);
@ -2115,7 +2108,8 @@ int pageant_enum_keys(pageant_key_enum_fn_t callback, void *callback_ctx,
BinarySource_BARE_INIT_PL(src, kl1->keys[i].blob);
get_rsa_ssh1_pub(src, &rkey, RSA_SSH1_EXPONENT_FIRST);
if (get_err(src)) {
*retstr = dupstr("Received an invalid SSH-1 key from agent");
*retstr = dupstr(
"Received an invalid SSH-1 key from agent");
goto out;
}
}
@ -2127,7 +2121,9 @@ int pageant_enum_keys(pageant_key_enum_fn_t callback, void *callback_ctx,
sfree(cbkey.comment);
sfree(fingerprint);
}
}
if (kl2) {
for (size_t i = 0; i < kl2->nkeys; i++) {
cbkey.blob = strbuf_new();
put_datapl(cbkey.blob, kl2->keys[i].blob);
@ -2141,6 +2137,7 @@ int pageant_enum_keys(pageant_key_enum_fn_t callback, void *callback_ctx,
sfree(cbkey.comment);
strbuf_free(cbkey.blob);
}
}
*retstr = NULL;
toret = PAGEANT_ACTION_OK;