[git] Pinentry - branch, master, updated. pinentry-1.0.0-12-gc0d60e1

by Werner Koch cvs at cvs.gnupg.org
Fri Feb 3 17:19:05 CET 2017


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  c0d60e130b9bbd21801c8e71e80ab7c36f4ad6bd (commit)
       via  61cde37b3e6a41bd24476d3c285288c12da0ed60 (commit)
      from  ce745a292192b01203ba5f557205a6f000bff953 (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 c0d60e130b9bbd21801c8e71e80ab7c36f4ad6bd
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Feb 3 17:16:43 2017 +0100

    gtk: Unless SETTITLE is used show the pid in the titlebar.
    
    * gtk+-2/pinentry-gtk-2.c (create_window): Display the pid as title.
    --
    
    This information could also be used to lookup the command line of the
    process and show that in the titlebar.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index e37601f..79cecda 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -631,6 +631,17 @@ create_window (pinentry_t ctx)
       msg = pinentry_utf8_validate (pinentry->title);
       gtk_window_set_title (GTK_WINDOW(win), msg);
     }
+  else if (pinentry->owner_pid)
+    {
+      char buf[100];
+      snprintf (buf, sizeof buf, "%s [%lu]",
+                pinentry->owner_host? pinentry->owner_host:"",
+                pinentry->owner_pid);
+      buf[sizeof buf - 1] = 0;
+      gtk_window_set_title (GTK_WINDOW(win), buf);
+    }
+
+
   if (pinentry->description)
     {
       msg = pinentry_utf8_validate (pinentry->description);

commit 61cde37b3e6a41bd24476d3c285288c12da0ed60
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Feb 3 17:15:24 2017 +0100

    core: New Assuan option "owner".
    
    * pinentry/pinentry.h (struct pinentry): Add fields 'owner_pid' and
    'owner_host'.
    * pinentry/pinentry.c (pinentry_reset): Take care of these fields.
    (option_handler): New option "owner".
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
index afda9ef..d33ebe9 100644
--- a/pinentry/pinentry.c
+++ b/pinentry/pinentry.c
@@ -98,6 +98,8 @@ pinentry_reset (int use_defaults)
   char *default_tt_visi = pinentry.default_tt_visi;
   char *default_tt_hide = pinentry.default_tt_hide;
   char *touch_file = pinentry.touch_file;
+  unsigned long owner_pid = pinentry.owner_pid;
+  char *owner_host = pinentry.owner_host;
 
   /* These options are set from the command line.  Don't reset
      them.  */
@@ -131,6 +133,7 @@ pinentry_reset (int use_defaults)
       free (pinentry.default_tt_visi);
       free (pinentry.default_tt_hide);
       free (pinentry.touch_file);
+      free (pinentry.owner_host);
       free (pinentry.display);
     }
 
@@ -171,8 +174,7 @@ pinentry_reset (int use_defaults)
       pinentry.color_so = PINENTRY_COLOR_DEFAULT;
       pinentry.color_so_bright = 0;
     }
-  else
-    /* Restore the options.  */
+  else /* Restore the options.  */
     {
       pinentry.grab = grab;
       pinentry.ttyname = ttyname;
@@ -188,6 +190,8 @@ pinentry_reset (int use_defaults)
       pinentry.default_tt_visi = default_tt_visi;
       pinentry.default_tt_hide = default_tt_hide;
       pinentry.touch_file = touch_file;
+      pinentry.owner_pid = owner_pid;
+      pinentry.owner_host = owner_host;
 
       pinentry.debug = debug;
       pinentry.display = display;
@@ -917,6 +921,35 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
       if (!pinentry.lc_messages)
 	return gpg_error_from_syserror ();
     }
+  else if (!strcmp (key, "owner"))
+    {
+      long along;
+      char *endp;
+
+      free (pinentry.owner_host);
+      pinentry.owner_host = NULL;
+
+      errno = 0;
+      along = strtol (value, &endp, 10);
+      if (along < 0 || errno)
+        pinentry.owner_pid = 0;
+      else
+        {
+          pinentry.owner_pid = (unsigned long)along;
+          while (endp && *endp == ' ')
+            endp++;
+          if (*endp)
+            {
+              pinentry.owner_host = strdup (endp);
+              if (pinentry.owner_host)
+                {
+                  for (endp=pinentry.owner_host; *endp && *endp != ' '; endp++)
+                    ;
+                  *endp = 0;
+                }
+            }
+        }
+    }
   else if (!strcmp (key, "parent-wid"))
     {
       pinentry.parent_wid = atoi (value);
diff --git a/pinentry/pinentry.h b/pinentry/pinentry.h
index 45d35ad..1e891b7 100644
--- a/pinentry/pinentry.h
+++ b/pinentry/pinentry.h
@@ -91,6 +91,14 @@ struct pinentry
   /* True if caller should grab the keyboard.  (Assuan: "OPTION grab"
      or "OPTION no-grab".)  */
   int grab;
+
+  /* The PID of the owner or 0 if not known.  The owner is the process
+   * which actually triggered the the pinentry.  For example gpg.  */
+  unsigned long owner_pid;
+
+  /* The malloced hostname of the owener or NULL.  */
+  char *owner_host;
+
   /* The window ID of the parent window over which the pinentry window
      should be displayed.  (Assuan: "OPTION parent-wid WID".)  */
   int parent_wid;

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

Summary of changes:
 gtk+-2/pinentry-gtk-2.c | 11 +++++++++++
 pinentry/pinentry.c     | 37 +++++++++++++++++++++++++++++++++++--
 pinentry/pinentry.h     |  8 ++++++++
 3 files changed, 54 insertions(+), 2 deletions(-)


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




More information about the Gnupg-commits mailing list