1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Polish up passphrase prompts for key decryption.

Now Windows Pageant has two clearly distinct dialog boxes for
requesting a key passphrase: one to use synchronously when the user
has just used the 'Add Key' GUI action, and one to use asynchronously
in response to an agent client's attempt to use a key that was loaded
encrypted.

Also fixed the wording in the asynchronous box: there were two copies
of the 'enter passphrase' instruction, one from the dialog definition
in pageant.rc file and one from the cross-platform pageant.c. Now
pageant.c doesn't format a whole user-facing message any more: it
leaves that to the platform front end to do it the way it wants.

I've also added a call to SetForegroundWindow, to try to get the
passphrase prompt into the foreground. In my experience this doesn't
actually get it the keyboard focus, which I think is deliberate on
Windows's part and there's nothing I can do about it. But at least the
user should _see_ that the prompt is there, so they can focus it
themself.
This commit is contained in:
Simon Tatham
2021-04-02 10:49:18 +01:00
parent ceb645b042
commit efc31ee30d
5 changed files with 83 additions and 23 deletions

View File

@ -34,7 +34,7 @@ struct PageantClientVtable {
void (*got_response)(PageantClient *pc, PageantClientRequestId *reqid,
ptrlen response);
bool (*ask_passphrase)(PageantClient *pc, PageantClientDialogId *dlgid,
const char *msg);
const char *key_comment);
};
static inline void pageant_client_log_v(
@ -58,8 +58,8 @@ static inline void pageant_client_got_response(
PageantClient *pc, PageantClientRequestId *reqid, ptrlen response)
{ pc->vt->got_response(pc, reqid, response); }
static inline bool pageant_client_ask_passphrase(
PageantClient *pc, PageantClientDialogId *dlgid, const char *msg)
{ return pc->vt->ask_passphrase(pc, dlgid, msg); }
PageantClient *pc, PageantClientDialogId *dlgid, const char *comment)
{ return pc->vt->ask_passphrase(pc, dlgid, comment); }
/* PageantClientRequestId is used to match up responses to the agent
* requests they refer to. A client may allocate one of these for each
@ -159,7 +159,8 @@ struct PageantListenerClient {
struct PageantListenerClientVtable {
void (*log)(PageantListenerClient *, const char *fmt, va_list ap);
bool (*ask_passphrase)(PageantListenerClient *pc,
PageantClientDialogId *dlgid, const char *msg);
PageantClientDialogId *dlgid,
const char *key_comment);
};
static inline void pageant_listener_client_log_v(
@ -179,8 +180,9 @@ static inline PRINTF_LIKE(2, 3) void pageant_listener_client_log(
}
}
static inline bool pageant_listener_client_ask_passphrase(
PageantListenerClient *plc, PageantClientDialogId *dlgid, const char *msg)
{ return plc->vt->ask_passphrase(plc, dlgid, msg); }
PageantListenerClient *plc, PageantClientDialogId *dlgid,
const char *comment)
{ return plc->vt->ask_passphrase(plc, dlgid, comment); }
struct pageant_listen_state;
struct pageant_listen_state *pageant_listener_new(