agent: Backport changes from 2.1 to support an external password manager.
authorNeal H. Walfield <neal@gnu.org>
Tue, 19 May 2015 11:53:43 +0000 (13:53 +0200)
committerNeal H. Walfield <neal@gnu.org>
Tue, 19 May 2015 13:32:54 +0000 (15:32 +0200)
commitdde8ddffd37c9ef96cae2e2b1317d1dee607fc0b
tree5fc9bd9c102d3719ae7e208dac935504218a3676
parent80b6d614b7b53058da11ae239e8f1c69f167a200
agent: Backport changes from 2.1 to support an external password manager.

* agent/agent.h (agent_askpin): Add arguments keyinfo and cache_mode.
Update callers.
(agent_get_passphrase): Likewise.
(agent_clear_passphrase): New function.
(opt): Add field allow_external_cache.
* agent/call-pinentry.c (start_pinentry): Send "OPTION
allow-external-password-cache" to the pinentry.
(PINENTRY_STATUS_PASSWORD_FROM_CACHE): New constant.
(pinentry_status_cb): New function.
(agent_askpin): Add arguments keyinfo and cache_mode.  If KEYINFO and
CACHE_MODE describe a cachable key, then send SETKEYINFO to the
pinentry.  Pass PINENTRY_STATUS_CB to the "GETPIN" invocation.  If the
passphrase was incorrect and PINENTRY_STATUS_PASSWORD_FROM_CACHE is
set, decrement PININFO->FAILED_TRIES.
(agent_get_passphrase): Add arguments keyinfo and cache_mode.  If
KEYINFO and CACHE_MODE describe a cachable key, then send SETKEYINFO
to the pinentry.
(agent_clear_passphrase): New function.
* agent/call-pinentry.c (start_pinentry): Act upon new var,
allow_external_cache.
* agent/command.c (cmd_clear_passphrase): Call agent_clear_passphrase.
* agent/gpg-agent.c (oNoAllowExternalCache): New.
(opts): Add option --no-allow-external-cache.
(parse_rereadable_options): Set this option.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Based on commits:

3a9305439b75ccd4446378d4fd87da087fd9c892
e201c20f25e7bed29088186c5f717d43047a0f4b
d7293cb317acc40cc9e5189cef33fe9d8b47e62a
56b5c9f94f2e55d096be585ed061ccf1c9ec0de6
d3b5cad2346bd5747789dc62d7804fa5c15f4f3b
2180845959839705200e3172dbafc94b70b9007f
agent/agent.h
agent/call-pinentry.c
agent/command-ssh.c
agent/command.c
agent/divert-scd.c
agent/findkey.c
agent/genkey.c
agent/gpg-agent.c
doc/gpg-agent.texi
tools/gpgconf-comp.c