[git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.6-8-gbbb5bfa

by Werner Koch cvs at cvs.gnupg.org
Thu Apr 12 11:34:09 CEST 2018


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, STABLE-BRANCH-2-2 has been updated
       via  bbb5bfacc0d1f179cfec94fd32fee01a09df0f1d (commit)
      from  327fece0aed2c9974659c72304f9fd1f461d460c (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 bbb5bfacc0d1f179cfec94fd32fee01a09df0f1d
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Apr 12 11:24:54 2018 +0200

    agent,dirmngr: Add "getenv" to the getinfo command.
    
    * agent/command.c (cmd_getinfo): Add sub-command getenv.
    * dirmngr/server.c (cmd_getinfo): Ditto.
    --
    
    It is sometimes helpful to be able to inspect certain envvars in a
    running agent.  For example "http_proxy".
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/agent/command.c b/agent/command.c
index f2d0389..20abb28 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -2825,6 +2825,7 @@ static const char hlp_getinfo[] =
   "  std_env_names   - List the names of the standard environment.\n"
   "  std_session_env - List the standard session environment.\n"
   "  std_startup_env - List the standard startup environment.\n"
+  "  getenv NAME     - Return value of envvar NAME.\n"
   "  connections     - Return number of active connections.\n"
   "  jent_active     - Returns OK if Libgcrypt's JENT is active.\n"
   "  restricted      - Returns OK if the connection is in restricted mode.\n"
@@ -2961,6 +2962,23 @@ cmd_getinfo (assuan_context_t ctx, char *line)
             }
         }
     }
+  else if (!strncmp (line, "getenv", 6)
+           && (line[6] == ' ' || line[6] == '\t' || !line[6]))
+    {
+      line += 6;
+      while (*line == ' ' || *line == '\t')
+        line++;
+      if (!*line)
+        rc = gpg_error (GPG_ERR_MISSING_VALUE);
+      else
+        {
+          const char *s = getenv (line);
+          if (!s)
+            rc = set_error (GPG_ERR_NOT_FOUND, "No such envvar");
+          else
+            rc = assuan_send_data (ctx, s, strlen (s));
+        }
+    }
   else if (!strcmp (line, "connections"))
     {
       char numbuf[20];
diff --git a/dirmngr/server.c b/dirmngr/server.c
index 60d9802..4315c41 100644
--- a/dirmngr/server.c
+++ b/dirmngr/server.c
@@ -2489,7 +2489,8 @@ static const char hlp_getinfo[] =
   "dnsinfo     - Return info about the DNS resolver\n"
   "socket_name - Return the name of the socket.\n"
   "session_id  - Return the current session_id.\n"
-  "workqueue   - Inspect the work queue\n";
+  "workqueue   - Inspect the work queue\n"
+  "getenv NAME - Return value of envvar NAME\n";
 static gpg_error_t
 cmd_getinfo (assuan_context_t ctx, char *line)
 {
@@ -2557,6 +2558,23 @@ cmd_getinfo (assuan_context_t ctx, char *line)
       workqueue_dump_queue (ctrl);
       err = 0;
     }
+  else if (!strncmp (line, "getenv", 6)
+           && (line[6] == ' ' || line[6] == '\t' || !line[6]))
+    {
+      line += 6;
+      while (*line == ' ' || *line == '\t')
+        line++;
+      if (!*line)
+        err = gpg_error (GPG_ERR_MISSING_VALUE);
+      else
+        {
+          const char *s = getenv (line);
+          if (!s)
+            err = set_error (GPG_ERR_NOT_FOUND, "No such envvar");
+          else
+            err = assuan_send_data (ctx, s, strlen (s));
+        }
+    }
   else
     err = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
 

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

Summary of changes:
 agent/command.c  | 18 ++++++++++++++++++
 dirmngr/server.c | 20 +++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list