diff options
author | Werner Koch <[email protected]> | 2015-07-28 10:52:26 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-07-28 11:52:12 +0000 |
commit | 18f1e627c697d75175b79fe095305fa775f20841 (patch) | |
tree | b09f21ffd0061f8694daa56c0606f6f55ab758b2 | |
parent | scd: Fix size_t/unsigned int mismatch. (diff) | |
download | gnupg-18f1e627c697d75175b79fe095305fa775f20841.tar.gz gnupg-18f1e627c697d75175b79fe095305fa775f20841.zip |
w32: Try more places to find an installed Pinentry.
* common/homedir.c (get_default_pinentry_name): Re-implement to
support several choices for Windows.
Signed-off-by: Werner Koch <[email protected]>
-rw-r--r-- | common/homedir.c | 41 | ||||
-rw-r--r-- | doc/gpg-agent.texi | 11 |
2 files changed, 44 insertions, 8 deletions
diff --git a/common/homedir.c b/common/homedir.c index 8c73e99e0..391869327 100644 --- a/common/homedir.c +++ b/common/homedir.c @@ -613,6 +613,26 @@ dirmngr_user_socket_name (void) static const char * get_default_pinentry_name (int reset) { + static struct { + const char *(*rfnc)(void); + const char *name; + } names[] = { + /* The first entry is what we return in case we found no + other pinentry. */ + { gnupg_bindir, DIRSEP_S "pinentry" EXEEXT_S }, +#ifdef HAVE_W32_SYSTEM + /* Try Gpg4win directory (with bin and without.) */ + { w32_rootdir, "\\..\\Gpg4win\\bin\\pinentry.exe" }, + { w32_rootdir, "\\..\\Gpg4win\\pinentry.exe" }, + /* Try old Gpgwin directory. */ + { w32_rootdir, "\\..\\GNU\\GnuPG\\pinentry.exe" }, + /* Try a Pinentry from the common GNU dir. */ + { w32_rootdir, "\\..\\GNU\\bin\\pinentry.exe" }, +#endif + /* Last chance is a pinentry-basic (which comes with the + GnuPG 2.1 Windows installer). */ + { gnupg_bindir, DIRSEP_S "pinentry-basic" EXEEXT_S } + }; static char *name; if (reset) @@ -623,22 +643,27 @@ get_default_pinentry_name (int reset) if (!name) { - name = xstrconcat (gnupg_bindir (), - DIRSEP_S "pinentry" EXEEXT_S, NULL); - if (access (name, F_OK) && errno == ENOENT) + int i; + + for (i=0; i < DIM(names); i++) { char *name2; - name2 = xstrconcat (gnupg_bindir (), - DIRSEP_S "pinentry-basic" EXEEXT_S, NULL); - if (access (name2, F_OK)) - xfree (name2); /* Does not exist. */ - else /* Switch to pinentry-basic. */ + + name2 = xstrconcat (names[i].rfnc (), names[i].name, NULL); + if (!access (name2, F_OK)) { + /* Use that pinentry. */ xfree (name); name = name2; + break; } + if (!i) /* Store the first as fallback return. */ + name = name2; + else + xfree (name2); } } + return name; } diff --git a/doc/gpg-agent.texi b/doc/gpg-agent.texi index 4c4707257..62d23bbf1 100644 --- a/doc/gpg-agent.texi +++ b/doc/gpg-agent.texi @@ -403,6 +403,17 @@ installation dependent. With the default configuration the name of the default pinentry is @file{pinentry}; if that file does not exist but a @file{pinentry-basic} exist the latter is used. +On a Windows platform the default is to use the first existing program +from this list: +@file{bin\pinentry.exe}, +@file{..\Gpg4win\bin\pinentry.exe}, +@file{..\Gpg4win\pinentry.exe}, +@file{..\GNU\GnuPG\pinentry.exe}, +@file{..\GNU\bin\pinentry.exe}, +@file{bin\pinentry-basic.exe} +where the file names are relative to the GnuPG installation directory. + + @item --pinentry-touch-file @var{filename} @opindex pinentry-touch-file By default the filename of the socket gpg-agent is listening for |