From e1c8351efdc0f7ee893e3858af9b02c643115806 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 22 Feb 2009 14:21:38 +0100 Subject: fixed wired behaviour if ssh-agent is running and publishing but its not forwarded over ssh fixed error to create a symlink on itself if ssh-agent was not forwarded over ssh try to not overwrite the correct ssh-agent enviroment variables with a unvalid value --- bashrc/common/ssh-agent-forwarding.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'bashrc') diff --git a/bashrc/common/ssh-agent-forwarding.sh b/bashrc/common/ssh-agent-forwarding.sh index 14a880f..fb17146 100644 --- a/bashrc/common/ssh-agent-forwarding.sh +++ b/bashrc/common/ssh-agent-forwarding.sh @@ -3,12 +3,12 @@ wipe_removed_sockets() { # cleanup old agent-sockets if [ -r "${HOME}/.ssh-agent-forwarding" ]; then - cut -d" " -f2 "${HOME}/.ssh-agent-forwarding" | \ - xargs ls -a 2>/dev/null | \ - grep -f - "${HOME}/.ssh-agent-forwarding" | \ - sort -n > "${TMPFILE}" + cut -d" " -f2 "${HOME}/.ssh-agent-forwarding" | \ + xargs ls -a 2>/dev/null | \ + grep -f - "${HOME}/.ssh-agent-forwarding" | \ + sort -n > "${TMPFILE}" - mv "${TMPFILE}" "${HOME}/.ssh-agent-forwarding" + mv "${TMPFILE}" "${HOME}/.ssh-agent-forwarding" fi } @@ -47,5 +47,10 @@ if [ -n "$SSH_AUTH_SOCK" -a -n "$SSH_CLIENT" ]; then fi fi -SSH_AUTH_SOCK="${HOME}/.ssh-agent-forwarded-sock" +# if ssh auth sock not exists and the symlink exists +# change $SSH_AUTH_SOCK to the symlink +if [ ! -e "$SSH_AUTH_SOCK" -a -e "${HOME}/.ssh-agent-forwarded-sock" ]; then + SSH_AUTH_SOCK="${HOME}/.ssh-agent-forwarded-sock" +fi + export SSH_AUTH_SOCK -- cgit v1.2.3