From d888ac6b277e2ff5feb8610bbdc8ae775cef56e5 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Thu, 9 Dec 2010 13:47:03 +0000 Subject: [PATCH] Fixed override of KRB5CCNAME when attaching. Because KRB5CCNAME was set in update-environment, when attaching to a running session the saved KRB5CCNAME would be replaced with that from the attaching user. This conflicts with the cache used by ktmux_helper. Instead, use set-environment to put KRB5CCNAME in the session environment and kinit with it before running tmux. --- .tmux.conf | 3 --- opt/bin/ktmux | 9 ++++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 2701393..f46cae1 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -9,9 +9,6 @@ set -g status-keys vi # Don't wait so long to parse escape sequences. set -s escape-time 100 -# Ensure KRB5CCNAME is preserved in the environment. -set -a -g update-environment ' KRB5CCNAME' - # Clock. setw -g clock-mode-colour white setw -g clock-mode-style 24 diff --git a/opt/bin/ktmux b/opt/bin/ktmux index d0c063c..eb590da 100755 --- a/opt/bin/ktmux +++ b/opt/bin/ktmux @@ -11,4 +11,11 @@ while getopts ":T:n:s:t:" opt; do done shift $((OPTIND-1)) -exec $tmux ${tmux_opts## } new-session ${session_opts## } -d ';' attach ';' run-shell ktmux_helper +if [ -z "$KRB5CCNAME" ]; then + krb5ccname="$KRB5CCNAME" + [ -z "$krb5ccname" ] && krb5ccname=FILE:${TMPDIR:-/tmp}/krb5cc_${UID}_ktmux_$$ + export KRB5CCNAME="$krb5ccname" +fi +klist -s || kinit + +exec $tmux ${tmux_opts## } new-session ${session_opts## } -d ';' set-environment KRB5CCNAME "$KRB5CCNAME" ';' attach ';' run-shell ktmux_helper -- 2.7.4