summaryrefslogtreecommitdiffstats
path: root/bashrc/common
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2009-02-22 14:21:38 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2009-02-22 14:21:38 +0100
commite1c8351efdc0f7ee893e3858af9b02c643115806 (patch)
tree6dfdb00aadf4053853917e51e4e2f1a22bea4ba8 /bashrc/common
parent6b798eb0d7eab1e7ceb587d942a8b3cd5e9dbc8c (diff)
downloaddotfiles-e1c8351efdc0f7ee893e3858af9b02c643115806.tar.gz
dotfiles-e1c8351efdc0f7ee893e3858af9b02c643115806.tar.xz
dotfiles-e1c8351efdc0f7ee893e3858af9b02c643115806.zip
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
Diffstat (limited to 'bashrc/common')
-rw-r--r--bashrc/common/ssh-agent-forwarding.sh17
1 files changed, 11 insertions, 6 deletions
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