[138086] trunk/dports/security/gpg-agent

ionic at macports.org ionic at macports.org
Sat Jun 27 18:13:40 PDT 2015


Revision: 138086
          https://trac.macports.org/changeset/138086
Author:   ionic at macports.org
Date:     2015-06-27 18:13:40 -0700 (Sat, 27 Jun 2015)
Log Message:
-----------
gpg-agent: add ssh_agent variant. Only works on Darwin-based platforms. (Maybe) Fixes: #46113.

Enables the sections normally commented out in the launchd plist file.

Modified Paths:
--------------
    trunk/dports/security/gpg-agent/Portfile
    trunk/dports/security/gpg-agent/files/patch-agent_gpg-agent.c-launchd.diff

Modified: trunk/dports/security/gpg-agent/Portfile
===================================================================
--- trunk/dports/security/gpg-agent/Portfile	2015-06-28 01:13:34 UTC (rev 138085)
+++ trunk/dports/security/gpg-agent/Portfile	2015-06-28 01:13:40 UTC (rev 138086)
@@ -117,7 +117,14 @@
     reinplace -W "${worksrcpath}" "s|@LABEL@|${startupitem.uniquename}|g" gpg-agent.plist.default
 
     if {${os.platform} eq "darwin"} {
-        reinplace -W "${worksrcpath}" "s|@SSH_SUPPORT@||g" gpg-agent.plist.default
+        if {[variant_isset ssh_agent]} {
+            # Remove lines with @SSH_SUPPORT@ in them.
+            # Uncomments sections.
+            reinplace -W "${worksrcpath}" "/@SSH_SUPPORT@/d" gpg-agent.plist.default
+        } else {
+            # Simply remove all @SSH_SUPPORT@ strings to comment out these sections.
+            reinplace -W "${worksrcpath}" "s|@SSH_SUPPORT@||g" gpg-agent.plist.default
+        }
     }
 }
 
@@ -171,6 +178,19 @@
     configure.args-append   --with-pinentry-pgm=${applications_dir}/pinentry-mac.app/Contents/MacOS/pinentry-mac
 }
 
+variant ssh_agent description {Enables SSH agent support.} {
+    notes-append "
+                   You have enabled the optional SSH agent feature.
+
+                   This only has an effect on Darwin-based platforms.
+
+                   It is your responsiblity to disable any other SSH agent
+                   so that this feature has a chance to actually work.
+
+                   Please note that this feature is untested.
+                 "
+}
+
 livecheck.type      regex
 livecheck.url       ftp://ftp.gnupg.org/gcrypt/gnupg/
 livecheck.regex     gnupg-(2\\.0\\.\\d+)

Modified: trunk/dports/security/gpg-agent/files/patch-agent_gpg-agent.c-launchd.diff
===================================================================
--- trunk/dports/security/gpg-agent/files/patch-agent_gpg-agent.c-launchd.diff	2015-06-28 01:13:34 UTC (rev 138085)
+++ trunk/dports/security/gpg-agent/files/patch-agent_gpg-agent.c-launchd.diff	2015-06-28 01:13:40 UTC (rev 138086)
@@ -1,5 +1,5 @@
---- agent/gpg-agent.c.old	2015-06-27 23:15:37.000000000 +0200
-+++ agent/gpg-agent.c	2015-06-28 00:02:13.000000000 +0200
+--- agent/gpg-agent.c.old	2015-06-28 01:50:38.000000000 +0200
++++ agent/gpg-agent.c	2015-06-28 01:55:16.000000000 +0200
 @@ -47,6 +47,79 @@
  #include <unistd.h>
  #include <signal.h>
@@ -172,7 +172,7 @@
      {
        log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX);
        check_for_running_agent (0, 0);
-@@ -1054,6 +1169,217 @@
+@@ -1054,6 +1169,209 @@
        agent_deinit_default_ctrl (ctrl);
        xfree (ctrl);
      }
@@ -198,18 +198,6 @@
 +      /* Must leave SSH support enabled - #46113. */
 +      /* opt.ssh_support = 0; */
 +
-+      /* Quick-check to see if SSH support was requested but another application is
-+       * providing an SSH auth socket via launchd. */
-+      if (opt.ssh_support) {
-+        REMOVE_ENV_VAR_FROM_LAUNCHD (GPG_ENV_SOCKET_SSH);
-+
-+        if (getenv (GPG_ENV_SOCKET_SSH) != NULL) {
-+          log_error ("Another program is already providing SSH agent support via launchd. "
-+                     "Disabling SSH agent support in gpg-agent.\n");
-+          opt.ssh_support = 0;
-+        }
-+      }
-+
 +      /* Fetch socket from launchd. */
 +      launch_data_t checkin_request, checkin_response;
 +
@@ -276,21 +264,25 @@
 +          log_error ("No file descriptor returned for the agent socket.\n");
 +          exit (1);
 +        }
-+        else {
++        /* This scope is merely here to easily get rid of "cur". */
++        {
 +          launch_data_t cur = launch_data_array_get_index (data_array_agent, 0);
 +          fd = launch_data_get_fd (cur);
 +        }
 +
-+        if (opt.ssh_support && ((fd_count_ssh = launch_data_array_get_count (data_array_ssh)) > 1))
-+          log_info ("launchd returned more than one file descriptor for the SSH socket - ignoring extraneous ones.\n");
-+        else if (opt.ssh_support && (fd_count_ssh == 0)) {
-+          log_error ("No file descriptor returned for the SSH socket.\n");
-+          exit (1);
++        if (opt.ssh_support) {
++          if ((fd_count_ssh = launch_data_array_get_count (data_array_ssh)) > 1)
++            log_info ("launchd returned more than one file descriptor for the SSH socket - ignoring extraneous ones.\n");
++          else if (fd_count_ssh == 0) {
++            log_error ("No file descriptor returned for the SSH socket.\n");
++            exit (1);
++          }
++          /* This scope is merely here to easily get rid of "cur". */
++          {
++            launch_data_t cur = launch_data_array_get_index (data_array_ssh, 0);
++            fd_ssh = launch_data_get_fd (cur);
++          }
 +        }
-+        else if (opt.ssh_support) {
-+          launch_data_t cur = launch_data_array_get_index (data_array_ssh, 0);
-+          fd_ssh = launch_data_get_fd (cur);
-+        }
 +      }
 +
 +      char *gpg_socket = getenv (GPG_ENV_SOCKET_AGENT);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150627/8ac37e80/attachment.html>


More information about the macports-changes mailing list