diff options
Diffstat (limited to 'agent')
-rw-r--r-- | agent/agent.h | 5 | ||||
-rw-r--r-- | agent/call-pinentry.c | 12 | ||||
-rw-r--r-- | agent/gpg-agent.c | 6 |
3 files changed, 23 insertions, 0 deletions
diff --git a/agent/agent.h b/agent/agent.h index 6e24df4b4..c7e14332c 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -94,6 +94,11 @@ struct custom invisible character. */ char *pinentry_invisible_char; + /* The timeout value for the Pinentry in seconds. This is passed to + the pinentry if it is not 0. It is up to the pinentry to act + upon this timeout value. */ + unsigned long pinentry_timeout; + /* The default and maximum TTL of cache entries. */ unsigned long def_cache_ttl; /* Default. */ unsigned long def_cache_ttl_ssh; /* for SSH. */ diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 33e3ec3c6..0f240866e 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -491,6 +491,18 @@ start_pinentry (ctrl_t ctrl) } } + if (opt.pinentry_timeout) + { + char *optstr; + if ((optstr = xtryasprintf ("SETTIMEOUT %lu", opt.pinentry_timeout))) + { + assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL, + NULL); + /* We ignore errors because this is just a fancy thing. */ + xfree (optstr); + } + } + /* Tell the pinentry the name of a file it shall touch after having messed with the tty. This is optional and only supported by newer pinentries and thus we do no error checking. */ diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index b60287d31..3095531a5 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -93,6 +93,7 @@ enum cmd_and_opt_values oPinentryProgram, oPinentryTouchFile, oPinentryInvisibleChar, + oPinentryTimeout, oDisplay, oTTYname, oTTYtype, @@ -168,6 +169,7 @@ static ARGPARSE_OPTS opts[] = { /* */ N_("|PGM|use PGM as the PIN-Entry program")), ARGPARSE_s_s (oPinentryTouchFile, "pinentry-touch-file", "@"), ARGPARSE_s_s (oPinentryInvisibleChar, "pinentry-invisible-char", "@"), + ARGPARSE_s_u (oPinentryTimeout, "pinentry-timeout", "@"), ARGPARSE_s_s (oScdaemonProgram, "scdaemon-program", /* */ N_("|PGM|use PGM as the SCdaemon program") ), ARGPARSE_s_n (oDisableScdaemon, "disable-scdaemon", @@ -580,6 +582,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread) opt.pinentry_touch_file = NULL; xfree (opt.pinentry_invisible_char); opt.pinentry_invisible_char = NULL; + opt.pinentry_timeout = 0; opt.scdaemon_program = NULL; opt.def_cache_ttl = DEFAULT_CACHE_TTL; opt.def_cache_ttl_ssh = DEFAULT_CACHE_TTL_SSH; @@ -632,6 +635,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread) xfree (opt.pinentry_invisible_char); opt.pinentry_invisible_char = xtrystrdup (pargs->r.ret_str); break; break; + case oPinentryTimeout: opt.pinentry_timeout = pargs->r.ret_ulong; break; case oScdaemonProgram: opt.scdaemon_program = pargs->r.ret_str; break; case oDisableScdaemon: opt.disable_scdaemon = 1; break; case oDisableCheckOwnSocket: disable_check_own_socket = 1; break; @@ -1124,6 +1128,8 @@ main (int argc, char **argv ) GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME); es_printf ("allow-emacs-pinentry:%lu:\n", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME); + es_printf ("pinentry-timeout:%lu:0:\n", + GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME); agent_exit (0); } |