[git] Pinentry - branch, master, updated. pinentry-0.9.7-36-g553af04

by Werner Koch cvs at cvs.gnupg.org
Sat Nov 5 10:58:13 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  553af04cf9c103c2e2cd5085b0d5fb647a608d51 (commit)
      from  7b0a822460eb6f4bf28f85f38c64a86bb8f80d3d (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 553af04cf9c103c2e2cd5085b0d5fb647a608d51
Author: Werner Koch <wk at gnupg.org>
Date:   Sat Nov 5 10:55:46 2016 +0100

    core: Add command getinfo/flavor.
    
    * pinentry/pinentry.c: Inlcude pinentry-curses.h.
    (cmd_getinfo): Add sub-command "flavor"
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
index 4a0f859..d2f4229 100644
--- a/pinentry/pinentry.c
+++ b/pinentry/pinentry.c
@@ -52,7 +52,10 @@
 #include "password-cache.h"
 
 #ifdef INSIDE_EMACS
-#include "pinentry-emacs.h"
+# include "pinentry-emacs.h"
+#endif
+#ifdef FALLBACK_CURSES
+# include "pinentry-curses.h"
 #endif
 
 #ifdef HAVE_W32CE_SYSTEM
@@ -1414,23 +1417,50 @@ cmd_message (assuan_context_t ctx, char *line)
 
      version     - Return the version of the program.
      pid         - Return the process id of the server.
+     flavor      - Return information about the used pinentry flavor
  */
 static gpg_error_t
 cmd_getinfo (assuan_context_t ctx, char *line)
 {
   int rc;
+  const char *s;
+  char buffer[100];
 
   if (!strcmp (line, "version"))
     {
-      const char *s = VERSION;
+      s = VERSION;
       rc = assuan_send_data (ctx, s, strlen (s));
     }
   else if (!strcmp (line, "pid"))
     {
-      char numbuf[50];
 
-      snprintf (numbuf, sizeof numbuf, "%lu", (unsigned long)getpid ());
-      rc = assuan_send_data (ctx, numbuf, strlen (numbuf));
+      snprintf (buffer, sizeof buffer, "%lu", (unsigned long)getpid ());
+      rc = assuan_send_data (ctx, buffer, strlen (buffer));
+    }
+  else if (!strcmp (line, "flavor"))
+    {
+      const char *flags;
+
+      if (!strncmp (this_pgmname, "pinentry-", 9) && this_pgmname[9])
+        s = this_pgmname + 9;
+      else
+        s = this_pgmname;
+
+      if (0)
+        ;
+#ifdef INSIDE_EMACS
+      else if (pinentry_cmd_handler == emacs_cmd_handler)
+        flags = ":emacs";
+#endif
+#ifdef FALLBACK_CURSES
+      else if (pinentry_cmd_handler == curses_cmd_handler)
+        flags = ":curses";
+#endif
+      else
+        flags = "";
+
+      snprintf (buffer, sizeof buffer, "%s%s", s, flags);
+      rc = assuan_send_data (ctx, buffer, strlen (buffer));
     }
   else
     rc = gpg_error (GPG_ERR_ASS_PARAMETER);

-----------------------------------------------------------------------

Summary of changes:
 pinentry/pinentry.c | 40 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The standard pinentry collection
http://git.gnupg.org




More information about the Gnupg-commits mailing list