subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1150720 - /subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
Date Mon, 25 Jul 2011 14:28:55 GMT
Author: stsp
Date: Mon Jul 25 14:28:55 2011
New Revision: 1150720

URL: http://svn.apache.org/viewvc?rev=1150720&view=rev
Log:
On the gpg-agent-password-store branch, ensure that the gpg-agent socket
is always closed.

* subversion/libsvn_auth_gpg_agent/gpg_agent.c
  (password_get_gpg_agent): Close the socket SD in all error paths.

Modified:
    subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c

Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c?rev=1150720&r1=1150719&r2=1150720&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
(original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_auth_gpg_agent/gpg_agent.c
Mon Jul 25 14:28:55 2011
@@ -142,7 +142,10 @@ password_get_gpg_agent(const char **pass
     }
 
   if (strncmp(buffer, "OK", 2) != 0)
-    return FALSE;
+    {
+      close(sd);
+      return FALSE;
+    }
 
   /* Send TTY_NAME to the gpg-agent daemon. */
   tty_name = getenv("GPG_TTY");
@@ -157,10 +160,16 @@ password_get_gpg_agent(const char **pass
         }
 
       if (strncmp(buffer, "OK", 2) != 0)
-        return FALSE;
+        {
+          close(sd);
+          return FALSE;
+        }
     }
   else
-    return FALSE;
+    {
+      close(sd);
+      return FALSE;
+    }
 
   /* Send TTY_TYPE to the gpg-agent daemon. */
   tty_type = getenv("TERM");
@@ -175,10 +184,16 @@ password_get_gpg_agent(const char **pass
         }
 
       if (strncmp(buffer, "OK", 2) != 0)
-        return FALSE;
+        {
+          close(sd);
+          return FALSE;
+        }
     }
   else
-    return FALSE;
+    {
+      close(sd);
+      return FALSE;
+    }
 
   /* Create the CACHE_ID which will be generated based on REALMSTRING similar
      to other password caching mechanisms. */
@@ -203,6 +218,8 @@ password_get_gpg_agent(const char **pass
       return FALSE;
     }
 
+  close(sd);
+
   if (strncmp(buffer, "ERR", 3) == 0)
     return FALSE;
   
@@ -215,7 +232,6 @@ password_get_gpg_agent(const char **pass
 
   *password = p;
 
-  close(sd);
   return TRUE;
 }
 



Mime
View raw message