subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From james...@apache.org
Subject svn commit: r1766327 - /subversion/trunk/subversion/libsvn_subr/gpg_agent.c
Date Mon, 24 Oct 2016 03:05:51 GMT
Author: jamessan
Date: Mon Oct 24 03:05:51 2016
New Revision: 1766327

URL: http://svn.apache.org/viewvc?rev=1766327&view=rev
Log:
Improve discovery of gpg-agent sockets.

In r1600368, support was added for discovering sockets of running
gpg-agents.  However, this was only checking $GPG_AGENT_INFO or
$HOME/.gnupg/S.gpg-agent.  $GNUPGHOME may also be set in the environment
to use a location other than $HOME/.gnupg as gpg's home directory.

* subversion/libsvn_subr/gpg_agent.c
  (find_running_gpg_agent): Use $GNUPGHOME/S.gpg-agent as the first fallback
   when $GPG_AGENT_INFO is not present in the environment.  Clarify a comment
   about the meaning of "home directory" in terms of gpg.

Modified:
    subversion/trunk/subversion/libsvn_subr/gpg_agent.c

Modified: subversion/trunk/subversion/libsvn_subr/gpg_agent.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/gpg_agent.c?rev=1766327&r1=1766326&r2=1766327&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/gpg_agent.c (original)
+++ subversion/trunk/subversion/libsvn_subr/gpg_agent.c Mon Oct 24 03:05:51 2016
@@ -233,6 +233,7 @@ find_running_gpg_agent(int *new_sd, apr_
 {
   char *buffer;
   char *gpg_agent_info = NULL;
+  char *gnupghome = NULL;
   const char *socket_name = NULL;
   const char *request = NULL;
   const char *p = NULL;
@@ -243,10 +244,9 @@ find_running_gpg_agent(int *new_sd, apr_
 
   /* This implements the method of finding the socket as described in
    * the gpg-agent man page under the --use-standard-socket option.
-   * The manage page misleadingly says the standard socket is
-   * "named 'S.gpg-agent' located in the home directory."  The standard
-   * socket path is actually in the .gnupg directory in the home directory,
-   * i.e. ~/.gnupg/S.gpg-agent */
+   * The manage page says the standard socket is "named 'S.gpg-agent' located
+   * in the home directory."  GPG's home directory is either the directory
+   * specified by $GNUPGHOME or ~/.gnupg. */
   gpg_agent_info = getenv("GPG_AGENT_INFO");
   if (gpg_agent_info != NULL)
     {
@@ -259,6 +259,11 @@ find_running_gpg_agent(int *new_sd, apr_
                                          pool);
       socket_name = APR_ARRAY_IDX(socket_details, 0, const char *);
     }
+  else if ((gnupghome = getenv("GNUPGHOME")) != NULL)
+    {
+      const char *homedir = svn_dirent_canonicalize(gnupghome, pool);
+      socket_name = svn_dirent_join(homedir, "S.gpg-agent", pool);
+    }
   else
     {
       const char *homedir = svn_user_get_homedir(pool);



Mime
View raw message