Ignore:
Timestamp:
Jun 28, 2015, 1:13:40 AM (4 years ago)
Author:
ionic@…
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.

Location:
trunk/dports/security/gpg-agent
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/security/gpg-agent/Portfile

    r138083 r138086  
    118118
    119119    if {${os.platform} eq "darwin"} {
    120         reinplace -W "${worksrcpath}" "s|@SSH_SUPPORT@||g" gpg-agent.plist.default
     120        if {[variant_isset ssh_agent]} {
     121            # Remove lines with @SSH_SUPPORT@ in them.
     122            # Uncomments sections.
     123            reinplace -W "${worksrcpath}" "/@SSH_SUPPORT@/d" gpg-agent.plist.default
     124        } else {
     125            # Simply remove all @SSH_SUPPORT@ strings to comment out these sections.
     126            reinplace -W "${worksrcpath}" "s|@SSH_SUPPORT@||g" gpg-agent.plist.default
     127        }
    121128    }
    122129}
     
    172179}
    173180
     181variant ssh_agent description {Enables SSH agent support.} {
     182    notes-append "
     183                   You have enabled the optional SSH agent feature.
     184
     185                   This only has an effect on Darwin-based platforms.
     186
     187                   It is your responsiblity to disable any other SSH agent
     188                   so that this feature has a chance to actually work.
     189
     190                   Please note that this feature is untested.
     191                 "
     192}
     193
    174194livecheck.type      regex
    175195livecheck.url       ftp://ftp.gnupg.org/gcrypt/gnupg/
  • trunk/dports/security/gpg-agent/files/patch-agent_gpg-agent.c-launchd.diff

    r138083 r138086  
    1 --- agent/gpg-agent.c.old       2015-06-27 23:15:37.000000000 +0200
    2 +++ agent/gpg-agent.c   2015-06-28 00:02:13.000000000 +0200
     1--- agent/gpg-agent.c.old       2015-06-28 01:50:38.000000000 +0200
     2+++ agent/gpg-agent.c   2015-06-28 01:55:16.000000000 +0200
    33@@ -47,6 +47,79 @@
    44 #include <unistd.h>
     
    173173       log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX);
    174174       check_for_running_agent (0, 0);
    175 @@ -1054,6 +1169,217 @@
     175@@ -1054,6 +1169,209 @@
    176176       agent_deinit_default_ctrl (ctrl);
    177177       xfree (ctrl);
     
    199199+      /* opt.ssh_support = 0; */
    200200+
    201 +      /* Quick-check to see if SSH support was requested but another application is
    202 +       * providing an SSH auth socket via launchd. */
    203 +      if (opt.ssh_support) {
    204 +        REMOVE_ENV_VAR_FROM_LAUNCHD (GPG_ENV_SOCKET_SSH);
    205 +
    206 +        if (getenv (GPG_ENV_SOCKET_SSH) != NULL) {
    207 +          log_error ("Another program is already providing SSH agent support via launchd. "
    208 +                     "Disabling SSH agent support in gpg-agent.\n");
    209 +          opt.ssh_support = 0;
    210 +        }
    211 +      }
    212 +
    213201+      /* Fetch socket from launchd. */
    214202+      launch_data_t checkin_request, checkin_response;
     
    277265+          exit (1);
    278266+        }
    279 +        else {
     267+        /* This scope is merely here to easily get rid of "cur". */
     268+        {
    280269+          launch_data_t cur = launch_data_array_get_index (data_array_agent, 0);
    281270+          fd = launch_data_get_fd (cur);
    282271+        }
    283272+
    284 +        if (opt.ssh_support && ((fd_count_ssh = launch_data_array_get_count (data_array_ssh)) > 1))
    285 +          log_info ("launchd returned more than one file descriptor for the SSH socket - ignoring extraneous ones.\n");
    286 +        else if (opt.ssh_support && (fd_count_ssh == 0)) {
    287 +          log_error ("No file descriptor returned for the SSH socket.\n");
    288 +          exit (1);
    289 +        }
    290 +        else if (opt.ssh_support) {
    291 +          launch_data_t cur = launch_data_array_get_index (data_array_ssh, 0);
    292 +          fd_ssh = launch_data_get_fd (cur);
     273+        if (opt.ssh_support) {
     274+          if ((fd_count_ssh = launch_data_array_get_count (data_array_ssh)) > 1)
     275+            log_info ("launchd returned more than one file descriptor for the SSH socket - ignoring extraneous ones.\n");
     276+          else if (fd_count_ssh == 0) {
     277+            log_error ("No file descriptor returned for the SSH socket.\n");
     278+            exit (1);
     279+          }
     280+          /* This scope is merely here to easily get rid of "cur". */
     281+          {
     282+            launch_data_t cur = launch_data_array_get_index (data_array_ssh, 0);
     283+            fd_ssh = launch_data_get_fd (cur);
     284+          }
    293285+        }
    294286+      }
Note: See TracChangeset for help on using the changeset viewer.