[git] Pinentry - branch, master, updated. pinentry-0.9.7-48-g2e17565
by Daniel Kahn Gillmor
cvs at cvs.gnupg.org
Sat Nov 5 22:25:50 CET 2016
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 standard pinentry collection".
The branch, master has been updated
via 2e17565fd9cb94afe840050780d28db75e5c4053 (commit)
from b945576fe906ffcd5bcc50b4322ef2f34d8fb89f (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 2e17565fd9cb94afe840050780d28db75e5c4053
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Thu Nov 3 12:31:40 2016 -0400
gnome3: Test if Gcr System Prompter is available at startup.
* gnome3/pinentry-gnome3.c (gcr_system_prompt_available): New. Tests
whether it is possible to create a GcrSystemPrompt.
(main): Use gcr_system_prompt_available() to decide whether to fall
back to curses or not.
--
Debian-bug-id: 842015
Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c
index afa95b7..ba6ab46 100644
--- a/gnome3/pinentry-gnome3.c
+++ b/gnome3/pinentry-gnome3.c
@@ -390,6 +390,41 @@ pe_gcr_timeout_done (gpointer user_data)
pinentry_cmd_handler_t pinentry_cmd_handler = gnome3_cmd_handler;
+
+/* Test whether we can create a system prompt or not. This briefly
+ * does create a system prompt, which blocks other tools from making
+ * the same request concurrently, so we just create it to test if it is
+ * available, and quickly close it. */
+static int
+pe_gcr_system_prompt_available (void)
+{
+ GcrSystemPrompt *prompt;
+ GError *error = NULL;
+ int ret = 0;
+
+ prompt = GCR_SYSTEM_PROMPT (gcr_system_prompt_open (0, NULL, &error));
+ if (prompt)
+ {
+ ret = 1;
+ if (!gcr_system_prompt_close (prompt, NULL, &error))
+ fprintf (stderr, "failed to close test Gcr System Prompt (%d): %s\n",
+ error ? error->code : -1,
+ error ? error->message : "<no GError>");
+ g_clear_object (&prompt);
+ }
+ else if (error && error->code == GCR_SYSTEM_PROMPT_IN_PROGRESS)
+ {
+ /* This one particular failure is OK; we're clearly capable of
+ * making a system prompt, even though someone else has the
+ * system prompter right now: */
+ ret = 1;
+ }
+
+ if (error)
+ g_error_free (error);
+ return ret;
+}
+
int
main (int argc, char *argv[])
{
@@ -402,6 +437,12 @@ main (int argc, char *argv[])
" falling back to curses\n");
pinentry_cmd_handler = curses_cmd_handler;
}
+ else if (!pe_gcr_system_prompt_available ())
+ {
+ fprintf (stderr, "No Gcr System Prompter available,"
+ " falling back to curses\n");
+ pinentry_cmd_handler = curses_cmd_handler;
+ }
#endif
pinentry_parse_opts (argc, argv);
-----------------------------------------------------------------------
Summary of changes:
gnome3/pinentry-gnome3.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
hooks/post-receive
--
The standard pinentry collection
http://git.gnupg.org
More information about the Gnupg-commits
mailing list