Ticket #43584: gpg-agent_launchd-launchd_control.patch
File gpg-agent_launchd-launchd_control.patch, 30.7 KB (added by Ionic (Mihai Moldovan), 10 years ago) |
---|
-
security/gpg-agent/Portfile
old new 1 1 # $Id: Portfile 122844 2014-07-31 18:22:17Z devans@macports.org $ 2 2 3 PortSystem 1.03 PortSystem 1.0 4 4 5 5 # When updating gpg-agent, update gnupg2 also if applicable. 6 6 7 name gpg-agent 8 version 2.0.25 9 categories security mail 10 maintainers nomaintainer 11 license GPL-3+ 12 installs_libs no 7 name gpg-agent 8 version 2.0.25 9 revision 1 10 categories security mail 11 maintainers nomaintainer 12 license GPL-3+ 13 installs_libs no 13 14 14 description GPG key agent15 description GPG key agent 15 16 long_description gpg-agent is a key management agent similar \ 16 17 in function to ssh-agent. 17 homepage http://www.gnupg.org18 platforms darwin freebsd sunos19 distname gnupg-${version}20 dist_subdir gnupg221 master_sites gnupg:gnupg18 homepage http://www.gnupg.org 19 platforms darwin freebsd sunos 20 distname gnupg-${version} 21 dist_subdir gnupg2 22 master_sites gnupg:gnupg 22 23 23 use_bzip2 yes24 use_bzip2 yes 24 25 25 26 checksums rmd160 b1987258aa0e22a077a02242c0056bdf64e33bfd \ 26 27 sha256 b3abe97df096cf53d6a422ac922f3c48e688bc892b7ccf669b92f0b7fc6c5823 27 28 28 configure.args --enable-agent-only \ 29 --with-pinentry-pgm=${prefix}/bin/pinentry 29 startupitem.location \ 30 LaunchAgents 31 32 set launchd_dir ${prefix}/etc/${startupitem.location}/${startupitem.uniquename}/ 33 34 configure.args --enable-agent-only \ 35 --with-pinentry-pgm=${prefix}/bin/pinentry 30 36 31 37 # glib fails to find the right stdint.h It picks clang's internal one rather 32 38 # than the system header 33 configure.env gl_cv_absolute_stdint_h=/usr/include/stdint.h 39 configure.env gl_cv_absolute_stdint_h=/usr/include/stdint.h 40 41 depends_lib port:libiconv \ 42 port:gettext \ 43 port:zlib \ 44 port:bzip2 \ 45 port:bison \ 46 port:libassuan \ 47 port:libksba \ 48 port:libgcrypt \ 49 port:libgpg-error \ 50 port:pth \ 51 port:pinentry 52 53 patchfiles patch-po_Makevars.diff \ 54 patch-jnilib_mischelp_h-include-guard-typo-fix.diff 55 56 #configure.cflags-append -g3 -ggdb3 -gdwarf-2 -O0 57 58 platform darwin { 59 patchfiles-append patch-agent_gpg-agent.c-launchd.diff 60 configure.cflags-append -F/System/Library/Frameworks/CoreFoundation.framework \ 61 -D__APPLE_LAUNCHD__ 62 63 if { [tbool startupitem.install] } { 64 notes-append { 65 ############################################################################ 66 # A startup item has been installed that will aid in 67 # starting ${name} with launchd. It is disabled 68 # by default. Execute the following command to launch 69 # ${name} at user login: 70 # 71 # launchctl load -w /Library/${startupitem.location}/${startupitem.plist} 72 # 73 # To actually start ${name}, log out and back in. 74 ############################################################################ 75 } 76 } else { 77 notes-append { 78 ############################################################################ 79 # A startup item was not installed for ${name}. 80 # Some programs which depend on ${name} might not function properly, 81 # most notably eMail clients. 82 # Execute the following command to launch ${name} at user login: 83 # 84 # launchctl load -w ${launchd_dir}/${startupitem.plist} 85 # 86 # To actually start ${name}, log out and back in. 87 ############################################################################ 88 } 89 } 90 } 34 91 35 depends_lib port:libiconv \ 36 port:gettext \ 37 port:zlib \ 38 port:bzip2 \ 39 port:bison \ 40 port:libassuan \ 41 port:libksba \ 42 port:libgcrypt \ 43 port:libgpg-error \ 44 port:pth \ 45 port:pinentry 92 post-extract { 93 xinstall -m 644 -W ${filespath} gpg-agent.plist.default ${worksrcpath} 94 } 46 95 47 patchfiles patch-po_Makevars.diff 96 post-configure { 97 reinplace -W "${worksrcpath}" "s|@PREFIX@|${prefix}|g" gpg-agent.plist.default 98 reinplace -W "${worksrcpath}" "s|@LABEL@|${startupitem.uniquename}|g" gpg-agent.plist.default 99 100 if {${os.platform} eq "darwin"} { 101 reinplace -W "${worksrcpath}" "s|@SSH_SUPPORT@||g" gpg-agent.plist.default 102 } 103 } 48 104 49 105 post-destroot { 50 106 # Prevent conflict with gnupg2 port. 51 107 delete ${destroot}${prefix}/share/doc/gnupg/README 108 109 if {${os.platform} eq "darwin"} { 110 xinstall -m 755 -d \ 111 ${destroot}${launchd_dir} 112 xinstall -m 444 \ 113 ${worksrcpath}/gpg-agent.plist.default \ 114 ${destroot}${launchd_dir}${startupitem.plist}.default 115 } 116 } 117 118 post-activate { 119 if {${os.platform} eq "darwin"} { 120 xinstall -m 644 \ 121 ${launchd_dir}${startupitem.plist}.default \ 122 ${launchd_dir}${startupitem.plist} 123 124 # install the plist, if startupitem.install is set 125 if {[tbool startupitem.install]} { 126 ln -sf "${launchd_dir}${startupitem.plist}" "/Library/${startupitem.location}" 127 } 128 } 129 } 130 131 post-deactivate { 132 if {${os.platform} eq "darwin"} { 133 delete ${launchd_dir}${startupitem.plist} 134 135 if { [tbool startupitem.install] } { 136 delete "/Library/${startupitem.location}/${startupitem.plist}" 137 } 138 } 52 139 } 53 140 54 141 variant no_pinentry description {Do not use pinentry to handle user input} { -
new file security/gpg-agent/files/patch-agent_gpg-agent.c-launchd.diff
- + 1 --- agent/gpg-agent.c.old 2014-08-10 23:15:48.000000000 +0200 2 +++ agent/gpg-agent.c 2014-08-10 23:16:33.000000000 +0200 3 @@ -47,6 +47,78 @@ 4 #include <unistd.h> 5 #include <signal.h> 6 #include <pth.h> 7 +#ifdef __APPLE_LAUNCHD__ 8 +# include <launch.h> 9 + 10 +extern char **environ; 11 + 12 +# define GPG_ENV_SOCKET_AGENT "GPG_AGENT_INFO" 13 +# define GPG_ENV_SOCKET_SSH "SSH_AUTH_SOCK" 14 +# define GPG_SOCKET_NAME_AGENT "Listeners_agent" 15 +# define GPG_SOCKET_NAME_SSH "Listeners_ssh" 16 + 17 +# define PASS_ENV_VAR_TO_LAUNCHD(KEY, VALUE) \ 18 +do \ 19 + { \ 20 + launch_data_t resp, msg, tmp, tmp_value; \ 21 + msg = launch_data_alloc (LAUNCH_DATA_DICTIONARY); \ 22 + tmp = launch_data_alloc (LAUNCH_DATA_DICTIONARY); \ 23 + \ 24 + if (!VALUE || !KEY || (strlen (KEY) == 0)) { \ 25 + log_error ("invalid key or value given: `" #KEY "', `" #VALUE "'.\n"); \ 26 + exit (1); \ 27 + } \ 28 + \ 29 + char *value_start = strchr (VALUE, '='); \ 30 + if (!value_start) \ 31 + value_start = VALUE; \ 32 + else \ 33 + ++value_start; \ 34 + \ 35 + tmp_value = launch_data_new_string (value_start); /* Skip variable name \ 36 + * and equal sign */ \ 37 + launch_data_dict_insert (tmp, tmp_value, KEY); \ 38 + launch_data_dict_insert (msg, tmp, "SetUserEnvironment"); \ 39 + \ 40 + resp = launch_msg (msg); \ 41 + \ 42 + if (!resp) { \ 43 + log_error ("failed to pass environment variable `" KEY "' to launchd: %s\n", \ 44 + strerror (errno)); \ 45 + exit (1); \ 46 + } \ 47 + launch_data_free (resp); \ 48 + launch_data_free (msg); /* Do NOT launch_data_free() neither on tmp, nor tmp_value */ \ 49 + } \ 50 +while (0) 51 + 52 +# define REMOVE_ENV_VAR_FROM_LAUNCHD(ENV_VAR_NAME) \ 53 +do \ 54 + { \ 55 + launch_data_t resp, msg, tmp; \ 56 + msg = launch_data_alloc (LAUNCH_DATA_DICTIONARY); \ 57 + \ 58 + if (!ENV_VAR_NAME || (strlen (ENV_VAR_NAME) == 0)) { \ 59 + log_error ("invalid environment variable name given: `" #ENV_VAR_NAME "'.\n"); \ 60 + exit (1); \ 61 + } \ 62 + \ 63 + tmp = launch_data_new_string (ENV_VAR_NAME); \ 64 + launch_data_dict_insert (msg, tmp, "UnsetUserEnvironment"); \ 65 + \ 66 + resp = launch_msg (msg); \ 67 + \ 68 + if (!resp) { \ 69 + log_error ("failed to remove environment variable `" ENV_VAR_NAME "' from launchd: %s\n", \ 70 + strerror (errno)); \ 71 + } \ 72 + launch_data_free (resp); \ 73 + launch_data_free (msg); /* Do NOT launch_data_free() on tmp */ \ 74 + } \ 75 +while (0) 76 + 77 + 78 +#endif // __APPLE_LAUNCHD__ 79 80 #define JNLIB_NEED_LOG_LOGV 81 #define JNLIB_NEED_AFLOCAL 82 @@ -85,6 +157,9 @@ 83 oLogFile, 84 oServer, 85 oDaemon, 86 +#ifdef __APPLE_LAUNCHD__ 87 + oLaunchd, 88 +#endif 89 oBatch, 90 91 oPinentryProgram, 92 @@ -133,6 +208,9 @@ 93 { 301, NULL, 0, N_("@Options:\n ") }, 94 95 { oDaemon, "daemon", 0, N_("run in daemon mode (background)") }, 96 +#ifdef __APPLE_LAUNCHD__ 97 + { oLaunchd, "launchd", 0, N_("run controlled by launchd (foreground)") }, 98 +#endif 99 { oServer, "server", 0, N_("run in server mode (foreground)") }, 100 { oVerbose, "verbose", 0, N_("verbose") }, 101 { oQuiet, "quiet", 0, N_("be somewhat more quiet") }, 102 @@ -475,6 +553,19 @@ 103 { 104 remove_socket (socket_name); 105 remove_socket (socket_name_ssh); 106 + 107 +#ifdef __APPLE_LAUNCHD__ 108 + /* Remove environment variables from launchd. */ 109 + /* launchd handles this. */ 110 + /* 111 + REMOVE_ENV_VAR_FROM_LAUNCHD ("GPG_AGENT_INFO"); 112 + 113 + if (opt.ssh_support) { 114 + REMOVE_ENV_VAR_FROM_LAUNCHD ("SSH_AUTH_SOCK"); 115 + REMOVE_ENV_VAR_FROM_LAUNCHD ("SSH_AGENT_PID"); 116 + } 117 + */ 118 +#endif // __APPLE_LAUNCHD__ 119 } 120 121 122 @@ -596,6 +687,9 @@ 123 int nogreeting = 0; 124 int pipe_server = 0; 125 int is_daemon = 0; 126 +#ifdef __APPLE_LAUNCHD__ 127 + int launchd_child = 0; 128 +#endif 129 int nodetach = 0; 130 int csh_style = 0; 131 char *logfile = NULL; 132 @@ -816,6 +910,9 @@ 133 case oSh: csh_style = 0; break; 134 case oServer: pipe_server = 1; break; 135 case oDaemon: is_daemon = 1; break; 136 +#ifdef __APPLE_LAUNCHD__ 137 + case oLaunchd: launchd_child = 1; break; 138 +#endif 139 140 case oDisplay: default_display = xstrdup (pargs.r.ret_str); break; 141 case oTTYname: default_ttyname = xstrdup (pargs.r.ret_str); break; 142 @@ -858,6 +955,19 @@ 143 default : pargs.err = configfp? 1:2; break; 144 } 145 } 146 + 147 + /* When running under launchd control, only start for real users ie UID >= 500 148 + * 149 + * Do this check early to avoid filling logs */ 150 + 151 +#ifdef __APPLE_LAUNCHD__ 152 + if (launchd_child && geteuid() < 500) 153 + { 154 + log_error ("launchd only supported for real users - i.e., UID >= 500\n"); 155 + exit (1); 156 + } 157 +#endif 158 + 159 if (configfp) 160 { 161 fclose( configfp ); 162 @@ -983,7 +1093,11 @@ 163 /* If this has been called without any options, we merely check 164 whether an agent is already running. We do this here so that we 165 don't clobber a logfile but print it directly to stderr. */ 166 +#ifdef __APPLE_LAUNCHD__ 167 + if (!pipe_server && !is_daemon && !launchd_child) 168 +#else 169 if (!pipe_server && !is_daemon) 170 +#endif 171 { 172 log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX); 173 check_for_running_agent (0, 0); 174 @@ -1045,6 +1159,217 @@ 175 agent_deinit_default_ctrl (ctrl); 176 xfree (ctrl); 177 } 178 +#ifdef __APPLE_LAUNCHD__ 179 + else if (launchd_child) 180 + { /* launchd-compatible mode */ 181 + gnupg_fd_t fd, fd_ssh = GNUPG_INVALID_FD; 182 + pid_t pid; 183 + 184 + /* Remove the DISPLAY variable so that a pinentry does not 185 + * default to a specific display. There is still a default 186 + * display when gpg-agent was started using --display or a 187 + * client requested this using an OPTION command. Note, that we 188 + * don't do this when running in reverse daemon mode (i.e. when 189 + * exec the program given as arguments). */ 190 + 191 + if (!opt.keep_display && !argc) 192 + unsetenv ("DISPLAY"); 193 + 194 + fflush (NULL); 195 + pid = getpid (); 196 + 197 + /* Disable SSH support for good. */ 198 + opt.ssh_support = 0; 199 + 200 + /* Quick-check to see if SSH support was requested but another application is 201 + * providing an SSH auth socket via launchd. */ 202 + if (opt.ssh_support) { 203 + REMOVE_ENV_VAR_FROM_LAUNCHD ("SSH_AUTH_SOCK"); 204 + 205 + if (getenv ("SSH_AUTH_SOCK") != NULL) { 206 + log_error ("another program is already providing SSH agent support via launchd. " 207 + "disabling SSH agent support in gpg-agent.\n"); 208 + opt.ssh_support = 0; 209 + } 210 + } 211 + 212 + /* Fetch socket from launchd. */ 213 + launch_data_t checkin_request, checkin_response; 214 + 215 + /* EHLO launchd */ 216 + if ((checkin_request = launch_data_new_string (LAUNCH_KEY_CHECKIN)) == NULL) { 217 + log_error ("unable to create launchd checkin string.\n"); 218 + exit (1); 219 + } 220 + 221 + /* any answer */ 222 + if ((checkin_response = launch_msg (checkin_request)) == NULL) { 223 + log_error ("unable to obtain launchd checkin answer.\n"); 224 + exit (1); 225 + } 226 + 227 + /* not 250 :( */ 228 + if (LAUNCH_DATA_ERRNO == launch_data_get_type (checkin_response)) { 229 + int cur_errno = errno; 230 + log_error ("launchd checkin failed: %s\n", strerror (cur_errno)); 231 + exit (1); 232 + } 233 + 234 + /* 250 */ 235 + launch_data_t socket_dict = launch_data_dict_lookup (checkin_response, LAUNCH_JOBKEY_SOCKETS); 236 + if (socket_dict == NULL) { 237 + log_error ("no sockets returned by launchd.\n"); 238 + exit (1); 239 + } 240 + 241 + { 242 + size_t need_sockets = 1; 243 + 244 + if (opt.ssh_support) 245 + ++need_sockets; 246 + 247 + size_t got_sockets = launch_data_dict_get_count (socket_dict); 248 + 249 + if (got_sockets < need_sockets) { 250 + log_error ("launchd returned less seconds than necessary. " 251 + "needed: %zu, given: %zu.\n", need_sockets, got_sockets); 252 + exit (1); 253 + } 254 + 255 + if (got_sockets > need_sockets) 256 + log_info ("launchd returned more sockets than needed - ignoring extraneous ones.\n"); 257 + 258 + /* Fetch FD array. */ 259 + launch_data_t data_array_agent, data_array_ssh; 260 + if ((data_array_agent = launch_data_dict_lookup (socket_dict, GPG_SOCKET_NAME_AGENT)) == NULL) { 261 + log_error ("no agent socket defined in launchd plist file.\n"); 262 + exit (1); 263 + } 264 + 265 + if (opt.ssh_support && 266 + ((data_array_ssh = launch_data_dict_lookup (socket_dict, GPG_SOCKET_NAME_SSH)) == NULL)) { 267 + log_error ("no ssh socket defined in launchd plist file.\n"); 268 + exit (1); 269 + } 270 + 271 + size_t fd_count_agent, fd_count_ssh; 272 + if ((fd_count_agent = launch_data_array_get_count (data_array_agent)) > 1) 273 + log_info ("launchd returned more than one file descriptor for the agent socket - ignoring extraneous ones.\n"); 274 + else if (fd_count_agent == 0) { 275 + log_error ("no file descriptor returned for the agent socket.\n"); 276 + exit (1); 277 + } 278 + else { 279 + launch_data_t cur = launch_data_array_get_index (data_array_agent, 0); 280 + fd = launch_data_get_fd (cur); 281 + } 282 + 283 + if (opt.ssh_support && ((fd_count_ssh = launch_data_array_get_count (data_array_ssh)) > 1)) 284 + log_info ("launchd returned more than one file descriptor for the ssh socket - ignoring extraneous ones.\n"); 285 + else if (opt.ssh_support && (fd_count_ssh == 0)) { 286 + log_error ("no file descriptor returned for the ssh socket.\n"); 287 + exit (1); 288 + } 289 + else if (opt.ssh_support) { 290 + launch_data_t cur = launch_data_array_get_index (data_array_ssh, 0); 291 + fd_ssh = launch_data_get_fd (cur); 292 + } 293 + } 294 + 295 + char *gpg_socket = getenv (GPG_ENV_SOCKET_AGENT); 296 + if (!gpg_socket) { 297 + log_error ("no agent socket environment variable defined by launchd.\n"); 298 + exit (1); 299 + } 300 + 301 + char *ssh_socket = getenv (GPG_ENV_SOCKET_SSH); 302 + if (opt.ssh_support && !ssh_socket) { 303 + log_error ("no ssh socket environment variable defined by launchd.\n"); 304 + exit (1); 305 + } 306 + 307 + socket_name = strndup (gpg_socket, strlen (gpg_socket)); 308 + if (opt.ssh_support) 309 + socket_name_ssh = strndup (ssh_socket, strlen (ssh_socket)); 310 + 311 + /* Remove internal environment variables from launchd. */ 312 + /* launchd handles this. */ 313 + /* 314 + REMOVE_ENV_VAR_FROM_LAUNCHD (GPG_ENV_SOCKET_AGENT); 315 + if (opt.ssh_support) 316 + REMOVE_ENV_VAR_FROM_LAUNCHD (GPG_ENV_SOCKET_SSH); 317 + */ 318 + 319 + launch_data_free (checkin_response); 320 + launch_data_free (checkin_request); 321 + 322 + char *infostr, *infostr_ssh_sock, *infostr_ssh_pid; 323 + 324 + /* Create the info string: <name>:<pid>:<protocol_version> */ 325 + if (asprintf (&infostr, "GPG_AGENT_INFO=%s:%lu:1", 326 + socket_name, (ulong)pid ) < 0) { 327 + log_error ("out of core\n"); 328 + kill (pid, SIGTERM); 329 + exit (1); 330 + } 331 + 332 + if (opt.ssh_support) { 333 + if (asprintf (&infostr_ssh_sock, "SSH_AUTH_SOCK=%s", 334 + socket_name_ssh) < 0) { 335 + log_error ("out of core\n"); 336 + exit (1); 337 + } 338 + if (asprintf (&infostr_ssh_pid, "SSH_AGENT_PID=%u", 339 + pid) < 0) { 340 + log_error ("out of core\n"); 341 + exit (1); 342 + } 343 + } 344 + 345 + if (env_file_name) { 346 + FILE *fp; 347 + 348 + fp = fopen (env_file_name, "w"); 349 + if (!fp) 350 + log_error (_("error creating `%s': %s\n"), 351 + env_file_name, strerror (errno)); 352 + else { 353 + fputs (infostr, fp); 354 + putc ('\n', fp); 355 + 356 + if (opt.ssh_support) { 357 + fputs (infostr_ssh_sock, fp); 358 + putc ('\n', fp); 359 + fputs (infostr_ssh_pid, fp); 360 + putc ('\n', fp); 361 + } 362 + 363 + fclose (fp); 364 + } 365 + } 366 + 367 + /* Pass environment variables back to launchd. */ 368 + /* launchd handles this. */ 369 + /* PASS_ENV_VAR_TO_LAUNCHD ("GPG_AGENT_INFO", infostr); 370 + 371 + if (opt.ssh_support) { 372 + PASS_ENV_VAR_TO_LAUNCHD ("SSH_AUTH_SOCK", infostr_ssh_sock); 373 + PASS_ENV_VAR_TO_LAUNCHD ("SSH_AGENT_PID", infostr_ssh_pid); 374 + } 375 + */ 376 + 377 + { 378 + struct sigaction sa; 379 + 380 + sa.sa_handler = SIG_IGN; 381 + sigemptyset (&sa.sa_mask); 382 + sa.sa_flags = 0; 383 + sigaction (SIGPIPE, &sa, NULL); 384 + } 385 + 386 + handle_connections (fd, fd_ssh); 387 + } 388 +#endif // __APPLE_LAUNCHD__ 389 else if (!is_daemon) 390 ; /* NOTREACHED */ 391 else -
new file security/gpg-agent/files/patch-jnilib_mischelp_h-include-guard-typo-fix.diff
- + 1 commit d6275bb553fc2f09825a2e06a10824fc69e0f362 2 Author: Mihai Moldovan <ionic@ionic.de> 3 Date: Tue Jul 8 15:55:59 2014 +0200 4 5 jnlib: fix typo'd include guard. 6 7 diff --git jnlib/mischelp.h.old jnlib/mischelp.h 8 index e478354..dc17384 100644 9 --- jnlib/mischelp.h.old 10 +++ jnlib/mischelp.h 11 @@ -19,7 +19,7 @@ 12 */ 13 14 #ifndef LIBJNLIB_MISCHELP_H 15 -#define LIBJNLIB_MISCHHELP_H 16 +#define LIBJNLIB_MISCHELP_H 17 18 19 /* Check whether the files NAME1 and NAME2 are identical. This is for -
new file security/gpg-agent/files/gpg-agent.plist.default
- + 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 <plist version="1.0"> 4 <dict> 5 <key>Label</key> 6 <string>@LABEL@</string> 7 8 <!-- Please uncomment on 10.4; OnDemand doesn't work properly there. --> 9 <!-- 10 <key>OnDemand</key> 11 <false /> 12 --> 13 14 <key>ProgramArguments</key> 15 <array> 16 <string>@PREFIX@/bin/gpg-agent</string> 17 <string>--write-env-file</string> 18 <string>--no-use-standard-socket</string> 19 <string>--launchd</string> 20 <!--@SSH_SUPPORT@ 21 <string>--enable-ssh-support</string> 22 @SSH_SUPPORT@--> 23 </array> 24 25 <key>RunAtLoad</key> 26 <true/> 27 28 <!-- Restart the job, should it crash. --> 29 <key>KeepAlive</key> 30 <dict> 31 <key>SuccessfulExit</key> 32 <false /> 33 </dict> 34 35 <key>ServiceIPC</key> 36 <true/> 37 38 <key>Sockets</key> 39 <dict> 40 <key>Listeners_agent</key> 41 <dict> 42 <key>SecureSocketWithKey</key> 43 <string>GPG_AGENT_INFO</string> 44 </dict> 45 46 <!--@SSH_SUPPORT@ 47 <key>Listeners_ssh</key> 48 <dict> 49 <key>SecureSocketWithKey</key> 50 <string>SSH_AUTH_SOCK</string> 51 </dict> 52 @SSH_SUPPORT@--> 53 </dict> 54 </dict> 55 </plist> -
mail/gnupg2/Portfile
old new 7 7 8 8 name gnupg2 9 9 version 2.0.25 10 revision 110 revision 2 11 11 categories mail security 12 12 maintainers nomaintainer 13 13 license GPL-3+ … … 59 59 60 60 patchfiles patch-common-homedir.c.diff \ 61 61 patch-configure.diff \ 62 patch-tests__openpgp__Makefile.in.diff 62 patch-tests__openpgp__Makefile.in.diff \ 63 patch-jnilib_mischelp_h-include-guard-typo-fix.diff 64 65 platform darwin { 66 patchfiles-append patch-gpg-agent_launchd.patch 67 } 63 68 64 69 post-patch { 65 70 reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/common/homedir.c -
new file mail/gnupg2/files/patch-gpg-agent_launchd.patch
- + 1 --- agent/gpg-agent.c.old 2014-08-10 22:50:59.000000000 +0200 2 +++ agent/gpg-agent.c 2014-08-10 22:51:26.000000000 +0200 3 @@ -2494,6 +2494,7 @@ 4 } 5 6 infostr = xstrdup (infostr); 7 +#ifndef __APPLE__ 8 if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr) 9 { 10 xfree (infostr); 11 @@ -2519,6 +2520,10 @@ 12 return 0; /* Okay, its running on the standard socket. */ 13 return -1; 14 } 15 +#else 16 + pid = 0; 17 + prot = 1; 18 +#endif 19 } 20 else /* MODE != 0 */ 21 { 22 --- common/asshelp.c.old 2014-08-10 22:50:59.000000000 +0200 23 +++ common/asshelp.c 2014-08-10 22:51:26.000000000 +0200 24 @@ -398,6 +398,7 @@ 25 int pid; 26 27 infostr = xstrdup (infostr); 28 +#ifndef __APPLE__ 29 if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr) 30 { 31 log_error (_("malformed GPG_AGENT_INFO environment variable\n")); 32 @@ -418,6 +419,10 @@ 33 force_pipe_server = 1; 34 goto restart; 35 } 36 +#else 37 + pid = 0; 38 + prot = 1; 39 +#endif 40 41 err = assuan_socket_connect (ctx, infostr, pid, 0); 42 xfree (infostr); 43 --- common/simple-pwquery.c.old 2014-08-10 22:50:59.000000000 +0200 44 +++ common/simple-pwquery.c 2014-08-10 22:51:26.000000000 +0200 45 @@ -345,6 +345,7 @@ 46 strcpy (p, infostr); 47 infostr = p; 48 49 +#ifndef __APPLE__ 50 if ( !(p = strchr ( infostr, PATHSEP_C)) || p == infostr 51 || (p-infostr)+1 >= sizeof client_addr.sun_path ) 52 { 53 @@ -358,6 +359,9 @@ 54 while (*p && *p != PATHSEP_C) 55 p++; 56 prot = *p? atoi (p+1) : 0; 57 +#else 58 + prot = 1; 59 +#endif 60 if ( prot != 1) 61 { 62 #ifdef SPWQ_USE_LOGGING 63 --- tools/gpg-connect-agent.c.old 2014-08-10 22:50:59.000000000 +0200 64 +++ tools/gpg-connect-agent.c 2014-08-10 22:51:26.000000000 +0200 65 @@ -2163,6 +2163,7 @@ 66 int pid; 67 68 infostr = xstrdup (infostr); 69 +#ifndef __APPLE__ 70 if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr) 71 { 72 log_error (_("malformed GPG_AGENT_INFO environment variable\n")); 73 @@ -2174,6 +2175,11 @@ 74 while (*p && *p != PATHSEP_C) 75 p++; 76 prot = *p? atoi (p+1) : 0; 77 +#else 78 + // Currently unused by assuan. 79 + pid = 0; 80 + prot = 1; 81 +#endif 82 if (prot != 1) 83 { 84 log_error (_("gpg-agent protocol version %d is not supported\n"), 85 --- tools/gpgconf.c.old 2014-08-10 22:50:59.000000000 +0200 86 +++ tools/gpgconf.c 2014-08-10 22:51:26.000000000 +0200 87 @@ -317,6 +317,7 @@ 88 char *tmp; 89 90 infostr = xstrdup (infostr); 91 +#ifndef __APPLE__ 92 tmp = strchr (infostr, PATHSEP_C); 93 if (!tmp || tmp == infostr) 94 { 95 @@ -325,6 +326,7 @@ 96 } 97 else 98 *tmp = 0; 99 +#endif 100 } 101 fprintf (outfp, "agent-socket:%s\n", 102 infostr? gc_percent_escape (infostr) : ""); -
new file mail/gnupg2/files/patch-jnilib_mischelp_h-include-guard-typo-fix.diff
- + 1 commit d6275bb553fc2f09825a2e06a10824fc69e0f362 2 Author: Mihai Moldovan <ionic@ionic.de> 3 Date: Tue Jul 8 15:55:59 2014 +0200 4 5 jnlib: fix typo'd include guard. 6 7 diff --git jnlib/mischelp.h.old jnlib/mischelp.h 8 index e478354..dc17384 100644 9 --- jnlib/mischelp.h.old 10 +++ jnlib/mischelp.h 11 @@ -19,7 +19,7 @@ 12 */ 13 14 #ifndef LIBJNLIB_MISCHELP_H 15 -#define LIBJNLIB_MISCHHELP_H 16 +#define LIBJNLIB_MISCHELP_H 17 18 19 /* Check whether the files NAME1 and NAME2 are identical. This is for -
mail/gnupg/Portfile
old new 5 5 6 6 name gnupg 7 7 version 1.4.18 8 revision 1 8 9 categories mail security 9 10 license GPL-3+ 10 11 installs_libs no … … 53 54 } 54 55 55 56 variant idea description {Add support for the patented IDEA algorithm} { 56 patch_sites-append http://www.gnupg.dk/contrib-dk 57 patchfiles idea.c.gz 57 depends_extract-append bin:gunzip:gzip 58 master_sites-append http://www.gnupg.dk/contrib-dk:ideasource 59 distfiles-append idea.c.gz:ideasource 58 60 checksums-append \ 59 61 idea.c.gz md5 9dc3bc086824a8c7a331f35e09a3e57f \ 60 62 sha1 82fded4ec31b97b3b2dd22741880b67cfee40f84 \ 61 63 rmd160 e35be5a031d10d52341ac5f029d28f811edd908d 62 patch.dir ${worksrcpath}/cipher 63 patch.cmd cat 64 patch.pre_args > idea.c 64 extract.only ${distname}${extract.suffix} 65 } 66 67 post-extract { 68 if {[variant_isset idea]} { 69 copy ${distpath}/idea.c.gz ${worksrcpath}/cipher 70 move ${worksrcpath}/cipher/idea.c ${worksrcpath}/cipher/idea.c.orig 71 system -W "${worksrcpath}/cipher" "gunzip -d idea.c.gz" 72 } 73 } 74 75 platform darwin { 76 patchfiles-append patch-gpg-agent_launchd.patch 65 77 } 66 78 67 79 platform sunos { -
new file mail/gnupg/files/patch-gpg-agent_launchd.patch
- + 1 --- g10/passphrase.c.old 2014-07-08 05:19:44.000000000 +0200 2 +++ g10/passphrase.c 2014-07-08 05:26:05.000000000 +0200 3 @@ -315,6 +315,7 @@ 4 infostr = xstrdup ( infostr ); 5 } 6 7 +#ifndef __APPLE__ 8 if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr) 9 { 10 if (!try) 11 @@ -334,6 +335,10 @@ 12 while (*p && *p != PATHSEP_C) 13 p++; 14 prot = *p? atoi (p+1) : 0; 15 +#else 16 + pid = 0; 17 + prot = 1; 18 +#endif 19 if (prot != 1) 20 { 21 if (!try)