From f3e5f400bfadf19b9c67033bb6fb59bddcee46b1 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Thu, 23 Apr 2009 19:46:42 -0400 Subject: [PATCH] Added configuration parameter "pinentry_path". --- doc/config.example | 5 ++++- doc/pwmd.1.in | 4 ++++ src/pinentry.c | 7 +++++-- src/pwmd.c | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/config.example b/doc/config.example index a6c7d40f..5e770c92 100644 --- a/doc/config.example +++ b/doc/config.example @@ -64,7 +64,10 @@ # Set to false to disable use of pinentry to retrieve keys. #enable_pinentry=true -# + +# The full path to the pinentry binary. The default is specified at compile +# time. +#pinentry_path=/usr/bin/pinentry # Seconds until the pinentry dialog times out. Set to 0 to wait for input # forever. diff --git a/doc/pwmd.1.in b/doc/pwmd.1.in index 39daea86..8cac46ef 100644 --- a/doc/pwmd.1.in +++ b/doc/pwmd.1.in @@ -161,6 +161,10 @@ When disabled and a file requires a passphrase, the passphrase must be included in the command (see COMMANDS included in the archive). The default is \fItrue\fP. Also see \fBPINENTRY\fP below. .TP +.I "pinentry_path=" +The full path of the pinentry binary. The default is specified at compile +time. +.TP .I "pinentry_timeout=" The number of seconds before the pinentry dialog will terminate while waiting for a passphrase. The default is \fB20\fP. Set to \fI0\fP to wait forever. diff --git a/src/pinentry.c b/src/pinentry.c index 4f882e10..ee01386b 100644 --- a/src/pinentry.c +++ b/src/pinentry.c @@ -193,6 +193,7 @@ static gpg_error_t launch_pinentry(struct pinentry_s *pin) gint child_list[] = {-1}; const gchar *argv[8]; const gchar **p = argv; + gchar *tmp; *p++ = "pinentry"; @@ -212,8 +213,10 @@ static gpg_error_t launch_pinentry(struct pinentry_s *pin) } *p = NULL; - rc = assuan_pipe_connect(&ctx, pin->path ? pin->path : PINENTRY_PATH, - argv, child_list); + tmp = get_key_file_string("global", "pinentry_path"); + rc = assuan_pipe_connect(&ctx, pin->path ? pin->path : tmp, argv, + child_list); + g_free(tmp); if (rc) return rc; diff --git a/src/pwmd.c b/src/pwmd.c index 2591c9ef..5f12e59e 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -718,6 +718,9 @@ static void set_rcfile_defaults(GKeyFile *kf) if (g_key_file_has_key(kf, "global", "pinentry_timeout", NULL) == FALSE) g_key_file_set_integer(kf, "global", "pinentry_timeout", DEFAULT_PIN_TIMEOUT); + + if (g_key_file_has_key(kf, "global", "pinentry_path", NULL) == FALSE) + g_key_file_set_string(kf, "global", "pinentry_path", PINENTRY_PATH); #endif if (g_key_file_has_key(kf, "global", "xfer_progress", NULL) == FALSE) -- 2.11.4.GIT