From 436f2060721e997479a9dd5be8dfc73627dd49c9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 7 May 2015 15:42:00 +0200 Subject: agent: Minor change for 56b5c9f. * agent/call-pinentry.c (agent_askpin): Move option setting to ... (start_pinentry): here. Fix error code check. Signed-off-by: Werner Koch --- agent/call-pinentry.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 77b173934..0a0f95be8 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -407,6 +407,20 @@ start_pinentry (ctrl_t ctrl) return unlock_pinentry (rc); } + + /* Indicate to the pinentry that it may read from an external cache. + + It is essential that the pinentry respect this. If the cached + password is not up to date and retry == 1, then, using a version + of GPG Agent that doesn't support this, won't issue another pin + request and the user won't get a chance to correct the + password. */ + rc = assuan_transact (entry_ctx, "OPTION allow-external-password-cache", + NULL, NULL, NULL, NULL, NULL, NULL); + if (rc && gpg_err_code (rc) != GPG_ERR_UNKNOWN_OPTION) + return unlock_pinentry (rc); + + { /* Provide a few default strings for use by the pinentries. This may help a pinentry to avoid implementing localization code. */ @@ -814,18 +828,6 @@ agent_askpin (ctrl_t ctrl, if (rc) return rc; - /* Indicate to the pinentry that it may read from an external cache. - - It is essential that the pinentry respect this. If the cached - password is not up to date and retry == 1, then, using a version - of GPG Agent that doesn't support this, won't issue another pin - request and the user won't get a chance to correct the - password. */ - rc = assuan_transact (entry_ctx, "OPTION allow-external-password-cache", - NULL, NULL, NULL, NULL, NULL, NULL); - if (rc && gpg_err_code (rc) != GPG_ERR_ASS_UNKNOWN_CMD) - return unlock_pinentry (rc); - /* If we have a KEYINFO string and are normal, user, or ssh cache mode, we tell that the Pinentry so it may use it for own caching purposes. Most pinentries won't have this implemented and thus -- cgit v1.2.3