1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Unix Pageant: first draft of -l key list option.

It doesn't look very pretty at the moment, but it lists the keys and
gets the fingerprints right.
This commit is contained in:
Simon Tatham
2015-05-11 18:34:45 +01:00
parent af20ed5799
commit 511d967d25
3 changed files with 156 additions and 1 deletions

View File

@ -354,10 +354,16 @@ static int unix_add_keyfile(const char *filename_str)
return ret;
}
void key_list_callback(void *ctx, const char *fingerprint, const char *comment)
{
printf("%s %s\n", fingerprint, comment);
}
void run_client(void)
{
const struct cmdline_key_action *act;
int errors = FALSE;
char *retstr;
if (!agent_exists()) {
fprintf(stderr, "pageant: no agent running to talk to\n");
@ -370,9 +376,16 @@ void run_client(void)
if (!unix_add_keyfile(act->filename))
errors = TRUE;
break;
case KEYACT_CLIENT_LIST:
if (pageant_enum_keys(key_list_callback, NULL, &retstr) ==
PAGEANT_ACTION_FAILURE) {
fprintf(stderr, "pageant: listing keys: %s\n", retstr);
sfree(retstr);
errors = TRUE;
}
break;
case KEYACT_CLIENT_DEL:
case KEYACT_CLIENT_DEL_ALL:
case KEYACT_CLIENT_LIST:
case KEYACT_CLIENT_LIST_FULL:
fprintf(stderr, "NYI\n");
errors = TRUE;