Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

pudge
  (email not shown publicly)
http://pudge.net/
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Tuesday March 18, 2003
08:03 PM

SSHAgentStartup

[ #11102 ]

SSHAgentStartup is a cool utility that properly starts up an ssh-agent and sets the environment variables for it in your ~/.MacOSX/environment.plist. It worked under Mac OS X 10.1, but broke under Jaguar, and I wrote my own pseudo-replacement, but was rewritten and now works again.

It doesn't set your shell environment, though; so I modified this to output to a file calles .bash_ssh_env, which I then source from .bash_profile.

--- SSHAgentStartupHelper.c.orig        Wed Sep  4 05:49:33 2002
+++ SSHAgentStartupHelper.c     Fri Mar 14 08:55:08 2003
@@ -135,9 +135,12 @@
        }
  }
 
-void startSSHAgent(CFMutableDictionaryRef plist) {
+void startSSHAgent(char* macosxdir, CFMutableDictionaryRef plist) {
        // -s specifies bourne shell output
-       FILE* output = popen("/usr/bin/ssh-agent -s", "r");
+       char cmd[PATH_MAX + 64];
+       snprintf(cmd, PATH_MAX + 64, "/usr/bin/ssh-agent -s | grep -v echo | tee %s/../.bash_ssh_env", macosxdir);
+
+       FILE* output = popen(cmd, "r");
        if (output && plist) {
                int i;
                char* line;
@@ -193,7 +196,7 @@
                }
        }
        if (plist) {
-               startSSHAgent(plist);
+               startSSHAgent(macosxdir, plist);
                writeEnvironmentPlist(aConfigFile, plist);
        }
        return 0;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.