aboutsummaryrefslogtreecommitdiffstats
path: root/agent/call-pinentry.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-02-04 09:09:28 +0000
committerWerner Koch <[email protected]>2015-02-04 09:28:38 +0000
commit0de5c6a9a783ed9dc69cecbf34eadcaace4be243 (patch)
tree62db1cc6a50ba5448a0dbe352e6b721efbca0d76 /agent/call-pinentry.c
parentw32: Add manifest to gpg. (diff)
downloadgnupg-0de5c6a9a783ed9dc69cecbf34eadcaace4be243.tar.gz
gnupg-0de5c6a9a783ed9dc69cecbf34eadcaace4be243.zip
gpg-agent: Use "pinentry-basic" as fallback.
* common/homedir.c (get_default_pinentry_name): New. (gnupg_module_name): Use that for the default pinentry. (gnupg_module_name_flush_some): New. * agent/gpg-agent.c (agent_sighup_action): Flush some module names. * agent/call-pinentry.c (start_pinentry): Do not modify opt.pinentry_program. -- The idea with this change is that under Windows we can install a simple native Windows pinentry as "pinentry-basic" and a full GUI version may then later install pinentry-gtk etc which would then automatically be used. Unfortunately installing another pinentry from a different package would clobber the GnuPG core directory which is not nice. To fix that we would need to agree on standard installation directories for GUIs to also look there. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/call-pinentry.c')
-rw-r--r--agent/call-pinentry.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index e5977ad6a..a96406fa3 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -205,6 +205,7 @@ static int
start_pinentry (ctrl_t ctrl)
{
int rc = 0;
+ const char *full_pgmname;
const char *pgmname;
assuan_context_t ctx;
const char *argv[5];
@@ -257,11 +258,11 @@ start_pinentry (ctrl_t ctrl)
#endif
}
- if (!opt.pinentry_program || !*opt.pinentry_program)
- opt.pinentry_program = gnupg_module_name (GNUPG_MODULE_NAME_PINENTRY);
- pgmname = opt.pinentry_program;
- if ( !(pgmname = strrchr (opt.pinentry_program, '/')))
- pgmname = opt.pinentry_program;
+ full_pgmname = opt.pinentry_program;
+ if (!full_pgmname || !*full_pgmname)
+ full_pgmname = gnupg_module_name (GNUPG_MODULE_NAME_PINENTRY);
+ if ( !(pgmname = strrchr (full_pgmname, '/')))
+ pgmname = full_pgmname;
else
pgmname++;
@@ -269,7 +270,7 @@ start_pinentry (ctrl_t ctrl)
the resource bundle. For other systems we stick to the usual
convention of supplying only the name of the program. */
#ifdef __APPLE__
- argv[0] = opt.pinentry_program;
+ argv[0] = full_pgmname;
#else /*!__APPLE__*/
argv[0] = pgmname;
#endif /*__APPLE__*/
@@ -310,13 +311,13 @@ start_pinentry (ctrl_t ctrl)
that atfork is used to change the environment for pinentry. We
start the server in detached mode to suppress the console window
under Windows. */
- rc = assuan_pipe_connect (ctx, opt.pinentry_program, argv,
+ rc = assuan_pipe_connect (ctx, full_pgmname, argv,
no_close_list, atfork_cb, ctrl,
ASSUAN_PIPE_CONNECT_DETACHED);
if (rc)
{
log_error ("can't connect to the PIN entry module '%s': %s\n",
- opt.pinentry_program, gpg_strerror (rc));
+ full_pgmname, gpg_strerror (rc));
assuan_release (ctx);
return unlock_pinentry (gpg_error (GPG_ERR_NO_PIN_ENTRY));
}