[git] GnuPG - branch, master, updated. gnupg-2.1.1-62-g0de5c6a
by Werner Koch
cvs at cvs.gnupg.org
Wed Feb 4 10:31:09 CET 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, master has been updated
via 0de5c6a9a783ed9dc69cecbf34eadcaace4be243 (commit)
via 05428d12561bc7eb872a81444918dfe706477a41 (commit)
from 3f67426a89bf4b37e1d2662fddc3eb4fa474c4ad (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0de5c6a9a783ed9dc69cecbf34eadcaace4be243
Author: Werner Koch <wk at gnupg.org>
Date: Wed Feb 4 10:09:28 2015 +0100
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 <wk at gnupg.org>
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index e5977ad..a96406f 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));
}
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index a874e76..6e1c76e 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1827,9 +1827,14 @@ agent_sighup_action (void)
{
log_info ("SIGHUP received - "
"re-reading configuration and flushing cache\n");
+
agent_flush_cache ();
reread_configuration ();
agent_reload_trustlist ();
+ /* We flush the module name cache so that after installing a
+ "pinentry" binary that one can be used in case the
+ "pinentry-basic" fallback was in use. */
+ gnupg_module_name_flush_some ();
}
diff --git a/common/homedir.c b/common/homedir.c
index 27141eb..e3efcee 100644
--- a/common/homedir.c
+++ b/common/homedir.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
+#include <unistd.h>
#ifdef HAVE_W32_SYSTEM
#include <winsock2.h> /* Due to the stupid mingw64 requirement to
@@ -607,6 +608,41 @@ dirmngr_user_socket_name (void)
}
+/* Return the default pinentry name. If RESET is true the internal
+ cache is first flushed. */
+static const char *
+get_default_pinentry_name (int reset)
+{
+ static char *name;
+
+ if (reset)
+ {
+ xfree (name);
+ name = NULL;
+ }
+
+ if (!name)
+ {
+ name = xstrconcat (gnupg_bindir (),
+ DIRSEP_S "pinentry" EXEEXT_S, NULL);
+ if (access (name, F_OK) && errno == ENOENT)
+ {
+ 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. */
+ {
+ xfree (name);
+ name = name2;
+ }
+ }
+ }
+ return name;
+}
+
+
/* Return the file name of a helper tool. WHICH is one of the
GNUPG_MODULE_NAME_foo constants. */
const char *
@@ -630,9 +666,9 @@ gnupg_module_name (int which)
case GNUPG_MODULE_NAME_PINENTRY:
#ifdef GNUPG_DEFAULT_PINENTRY
- return GNUPG_DEFAULT_PINENTRY;
+ return GNUPG_DEFAULT_PINENTRY; /* (Set by a configure option) */
#else
- X(bindir, "pinentry");
+ return get_default_pinentry_name (0);
#endif
case GNUPG_MODULE_NAME_SCDAEMON:
@@ -683,3 +719,12 @@ gnupg_module_name (int which)
}
#undef X
}
+
+
+/* Flush some of the cached module names. This is for example used by
+ gpg-agent to allow configuring a different pinentry. */
+void
+gnupg_module_name_flush_some (void)
+{
+ (void)get_default_pinentry_name (1);
+}
diff --git a/common/util.h b/common/util.h
index 24107f5..9103e09 100644
--- a/common/util.h
+++ b/common/util.h
@@ -254,6 +254,7 @@ const char *dirmngr_user_socket_name (void);
#define GNUPG_MODULE_NAME_GPGCONF 10
#define GNUPG_MODULE_NAME_DIRMNGR_LDAP 11
const char *gnupg_module_name (int which);
+void gnupg_module_name_flush_some (void);
diff --git a/doc/gpg-agent.texi b/doc/gpg-agent.texi
index 9326498..84a7d60 100644
--- a/doc/gpg-agent.texi
+++ b/doc/gpg-agent.texi
@@ -445,8 +445,10 @@ This option does nothing yet.
@item --pinentry-program @var{filename}
@opindex pinentry-program
-Use program @var{filename} as the PIN entry. The default is installation
-dependent.
+Use program @var{filename} as the PIN entry. The default is
+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.
@item --pinentry-touch-file @var{filename}
@opindex pinentry-touch-file
commit 05428d12561bc7eb872a81444918dfe706477a41
Author: Werner Koch <wk at gnupg.org>
Date: Tue Feb 3 19:11:44 2015 +0100
w32: Add manifest to gpg.
* g10/gpg.w32-manifest.in: New.
* g10/gpg-w32info.rc: Add manifest.
* g10/Makefile.am (EXTRA_DIST): Add manifest.
(gpg-w32info.o): Depend on manifest.
* configure.ac (BUILD_VERSION): New.
(AC_CONFIG_FILES): Add manifest.
--
There are no dependencies yet defined - we need to do this for the
libs first.
Signed-off-by: Werner Koch <wk at gnupg.org>
diff --git a/configure.ac b/configure.ac
index c61ecdc..ef04588 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1653,9 +1653,11 @@ AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
[GIT commit id revision used to build this package])
changequote(,)dnl
-BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
+BUILD_VERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./'`
changequote([,])dnl
-BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
+BUILD_VERSION="${BUILD_VERSION}mym4_revision_dec"
+BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
+AC_SUBST(BUILD_VERSION)
AC_SUBST(BUILD_FILEVERSION)
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
@@ -1774,6 +1776,7 @@ doc/Makefile
tests/Makefile
tests/openpgp/Makefile
tests/pkits/Makefile
+g10/gpg.w32-manifest
])
diff --git a/g10/Makefile.am b/g10/Makefile.am
index b47b2eb..0a02119 100644
--- a/g10/Makefile.am
+++ b/g10/Makefile.am
@@ -18,7 +18,8 @@
## Process this file with automake to produce Makefile.in
-EXTRA_DIST = options.skel distsigkey.gpg ChangeLog-2011 gpg-w32info.rc
+EXTRA_DIST = options.skel distsigkey.gpg ChangeLog-2011 gpg-w32info.rc \
+ gpg.w32-manifest.in
AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common \
-I$(top_srcdir)/include -I$(top_srcdir)/intl
@@ -57,6 +58,9 @@ endif
if HAVE_W32_SYSTEM
resource_objs += gpg-w32info.o
+
+gpg-w32info.o : gpg.w32-manifest
+
endif
common_source = \
diff --git a/g10/gpg-w32info.rc b/g10/gpg-w32info.rc
index 8caf221..cc34c30 100644
--- a/g10/gpg-w32info.rc
+++ b/g10/gpg-w32info.rc
@@ -48,3 +48,5 @@
VALUE "Translation", 0x409, 0x4b0
END
END
+
+1 RT_MANIFEST "gpg.w32-manifest"
diff --git a/g10/gpg.w32-manifest.in b/g10/gpg.w32-manifest.in
new file mode 100644
index 0000000..8c98dc5
--- /dev/null
+++ b/g10/gpg.w32-manifest.in
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<description>GNU Privacy Guard (OpenPGP tool)</description>
+<assemblyIdentity
+ type="win32"
+ name="GnuPG.gpg"
+ version="@BUILD_VERSION@"
+ />
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/><!-- Vista -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/><!-- 7 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><!-- 8 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><!-- 8.1 -->
+ </application>
+</compatibility>
+</assembly>
-----------------------------------------------------------------------
Summary of changes:
agent/call-pinentry.c | 17 +++++++++--------
agent/gpg-agent.c | 5 +++++
common/homedir.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
common/util.h | 1 +
configure.ac | 7 +++++--
doc/gpg-agent.texi | 6 ++++--
g10/Makefile.am | 6 +++++-
g10/gpg-w32info.rc | 2 ++
g10/gpg.w32-manifest.in | 17 +++++++++++++++++
9 files changed, 95 insertions(+), 15 deletions(-)
create mode 100644 g10/gpg.w32-manifest.in
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list