Really fix KRB5CCNAME.
authorIain Patterson <me@iain.cx>
Tue, 1 Nov 2011 10:56:53 +0000 (10:56 +0000)
committerIain Patterson <me@iain.cx>
Tue, 1 Nov 2011 10:58:50 +0000 (10:58 +0000)
Pass KRB5CCNAME through to the failsafe kinit only if -c wasn't used.

.profile.d/krb5.bashrc

index 2ca4337..034dadd 100644 (file)
@@ -87,6 +87,11 @@ fi
 
 unset cache ccname default ng
 function kinit() {
-  [ -n "$KRB5CCNAME" ] && krb5ccname="env KRB5CCNAME=$KRB5CCNAME"
-  ( builtin cd /; exec -c $krb5ccname kinit ${1+"$@"} )
+  local args=
+  local krb5ccname=
+  if [ -n "$KRB5CCNAME" ]; then
+    args="$@"
+    [ "${args/-c /}" = "$args" ] && krb5ccname="-c $KRB5CCNAME"
+  fi
+  ( builtin cd /; exec -c kinit $krb5ccname ${1+"$@"} )
 }