--- /bin/keychain 2003-11-22 10:40:13.001000000 -0800 +++ ./keychain 2003-11-27 18:12:07.043715000 -0800 @@ -212,16 +212,17 @@ # .ssh-agent file with csh-compatible syntax. lockf is the lockfile, used # to serialize the execution of multiple ssh-agent processes started # simultaneously (only works if lockfile from the procmail package is # available. hostname=`uname -n` pidf="${keydir}/${hostname}-sh" cshpidf="${keydir}/${hostname}-csh" +cmdpidf="${keydir}/${hostname}.cmd" lockf="${keydir}/${hostname}-lock" if [ -f ${keydir} ] then echo "$0: ${keydir} is a file (it should be a directory;) please fix." exit 1 #Solaris 9 doesn't have -e; using -d.... elif [ ! -d ${keydir} ] @@ -245,17 +246,17 @@ echo $E "${GREEN}KeyChain ${version}; ${BLUE}http://www.gentoo.org/projects/keychain${OFF}" echo $E " Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL" fi me=`whoami` if [ "$cygwin" = "yes" ] then #for cygwin - psopts="-e -u $me -f" + psopts="-u $me -f" grepopts="-i" elif [ "$hpux" = "yes" ] then #for hp-ux psopts="-u $me -f" else psopts="FAIL" #-x option needed on MacOS X, but just in case it doesn't work on other arches we have a "-u $me -f" @@ -285,17 +286,17 @@ set $mypids mypids=$2 fi if [ "$myaction" = "stop" ] then # --stop tells keychain to kill the existing ssh-agent(s), then exit kill $mypids > /dev/null 2>&1 - rm -f "${pidf}" "${cshpidf}" "$lockf" 2> /dev/null + rm -f "${pidf}" "${cshpidf}" "${cmdpidf}" "$lockf" 2> /dev/null #`whoami` (rather than the $LOGNAME var) gives us the euid rather than the uid (what we want) if [ -z "$quietopt" ] then echo $E " ${GREEN}*${OFF} All ssh-agent(s) started by" `whoami` "are now stopped." echo fi exit 0 fi @@ -340,25 +341,29 @@ fi if [ -z "$quietopt" ] then echo $E " ${GREEN}*${OFF} All previously running ssh-agent(s) have been stopped." echo $E " ${GREEN}*${OFF} Initializing ${pidf} file..." fi # "> pidf" doesn't work ash. But it should work with any sh-compatible shell - > "$pidf" || { echo "$0: Cannot create ${pidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$lockf" 2> /dev/null; exit 1; } + > "$pidf" || { echo "$0: Cannot create ${pidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$cmdpidf" "$lockf" 2> /dev/null; exit 1; } [ -z "$quietopt" ] && echo $E " ${GREEN}*${OFF} Initializing ${cshpidf} file..." - > "$cshpidf" || { echo "$0: Cannot create ${cshpidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$lockf" 2> /dev/null; exit 1; } - chmod 0600 "$pidf" "$cshpidf" + > "$cshpidf" || { echo "$0: Cannot create ${cshpidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$cmdpidf" "$lockf" 2> /dev/null; exit 1; } + [ -z "$quietopt" ] && echo $E " ${GREEN}*${OFF} Initializing ${cmdpidf} file..." + > "$cmdpidf" || { echo "$0: Cannot create ${cshpidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$cmdpidf" "$lockf" 2> /dev/null; exit 1; } + chmod 0600 "$pidf" "$cshpidf" "$cmdpidf" [ -z "$quietopt" ] && echo $E " ${GREEN}*${OFF} Starting new ssh-agent" nohup ssh-agent -s | grep -v 'Agent pid' > "$pidf" . "$pidf" echo "setenv $SSH_AUTH_SOCK_NAME $SSH_AUTH_SOCK;" > "$cshpidf" echo "setenv $SSH_AGENT_PID_NAME $SSH_AGENT_PID;" >> "$cshpidf" + echo "@set $SSH_AUTH_SOCK_NAME=$SSH_AUTH_SOCK" > "$cmdpidf" + echo "@set $SSH_AGENT_PID_NAME=$SSH_AGENT_PID" >> "$cmdpidf" fi if [ -n "$clearopt" ] then echo $E " ${GREEN}*${OFF} \c" ssh-add -D fi