Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Originating-IP: [68.107.52.110] From: "Karl M" To: cygwin AT cygwin DOT com Subject: keychain patch Date: Sat, 15 Mar 2003 11:56:23 -0800 Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_ecd_470_1920" Message-ID: X-OriginalArrivalTime: 15 Mar 2003 19:56:23.0816 (UTC) FILETIME=[F4D01080:01C2EB2C] ------=_NextPart_000_ecd_470_1920 Content-Type: text/plain; format=flowed Hi All... I made a small patch to keychain, so that it creates an additional pid file named ~/ssh-agent.bat This allows non-cygwin ssh-aware programs (such as unison) to take advantage of the keychain functionality. The new file can be used from a windows command script by call C:\Cygwin\home\kmoerder\ssh-agent.bat or better yet if exist C:\Cygwin\home\kmoerder\ssh-agent.bat call ... Thanks, ...Karl _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus ------=_NextPart_000_ecd_470_1920 Content-Type: text/plain; name="keychainmods"; format=flowed Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="keychainmods" --- /bin/keychain 2002-07-09 14:10:32.000000000 -0700 +++ /bin/mykeychain 2003-03-15 11:23:33.000000000 -0800 @@ -17,20 +17,22 @@ # simultaneously (only works if lockfile from the procmail package is # available. hostname=`uname -n` if [ -z "`echo ${@} | grep '\-\-local'`" ] then pidf="${HOME}/.ssh-agent-${hostname}" cshpidf="${HOME}/.ssh-agent-csh-${hostname}" + batpidf="${HOME}/ssh-agent${hostname}.bat" lockf="${HOME}/.keychain-lock-${hostname}" else pidf="${HOME}/.ssh-agent" cshpidf="${HOME}/.ssh-agent-csh" + batpidf="${HOME}/ssh-agent.bat" lockf="${HOME}/.keychain-lock" fi # perform lock if we have lockfile available if type lockfile >/dev/null 2>&1; then lockfile -1 -r 30 -l 35 -s 2 "$lockf" if [ $? != 0 ]; then echo "Error: Couldn't get lock" >&2 @@ -83,17 +85,17 @@ #End special cygwin version mypids=`ps $psopts 2>/dev/null | grep "[s]sh-agent" | awk '{print $2}'` > /dev/null 2>&1 if [ -n "`echo $* | grep '\-\-stop'`" ] || [ -n "`echo $* | grep '\-k'`" ] 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}" "${batpidf}" "$lockf" 2> /dev/null #`whoami` (rather than the $LOGNAME var) gives us the euid rather than the uid (what we want) if [ "$quiet_mode" = "no" ] then echo $E " ${GREEN}*${OFF} All ssh-agent(s) started by" `whoami` "are now stopped." echo fi exit 0 fi @@ -219,25 +221,29 @@ kill $mypids > /dev/null 2>&1 fi if [ "$quiet_mode" = "no" ] 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" "$batpidf" "$lockf" 2> /dev/null; exit 1; } [ "$quiet_mode" = "no" ] && 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" "$batpidf" "$lockf" 2> /dev/null; exit 1; } + [ "$quiet_mode" = "no" ] && echo $E " ${GREEN}*${OFF} Initializing ${batpidf} file..." + > "$batpidf" || { echo "$0: Cannot create ${batpidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$batpidf" "$lockf" 2> /dev/null; exit 1; } + chmod 0600 "$pidf" "$cshpidf" "$batpidf" [ "$quiet_mode" = "no" ] && echo $E " ${GREEN}*${OFF} Starting new ssh-agent" nohup ssh-agent -s | grep -v 'Agent pid' > "$pidf" . "$pidf" echo "setenv SSH_AUTH_SOCK $SSH_AUTH_SOCK;" > "$cshpidf" echo "setenv SSH_AGENT_PID $SSH_AGENT_PID;" >> "$cshpidf" + echo "@set SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > "$batpidf" + echo "@set SSH_AGENT_PID=$SSH_AGENT_PID" >> "$batpidf" fi if [ -n "`echo $* | grep '\-\-clear'`" ] then echo $E " ${GREEN}*${OFF} \c" ssh-add -D fi ------=_NextPart_000_ecd_470_1920 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_ecd_470_1920--