X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fkrb5_login.sh;h=da09190ad1a934442a26ea1b9172e792900c02e8;hp=b2a42055fe8c04d3a029458101f94393fa044b13;hb=8fbef5ee761920faa3c84f142f56934d6266a409;hpb=3192e52a89946f12fd36d28a686c169d01d36e64 diff --git a/lustre/tests/krb5_login.sh b/lustre/tests/krb5_login.sh index b2a4205..da09190 100755 --- a/lustre/tests/krb5_login.sh +++ b/lustre/tests/krb5_login.sh @@ -1,18 +1,26 @@ -#!/bin/sh +#!/bin/bash +# +# krb5_login.sh - obtain and cache Kerberos ticket-granting ticket +# +############################################################################### # # nothing need for root # -if [ $UID -eq 0 ]; then - exit 0 -fi +[ $UID -eq 0 ] && exit 0 -klist -5 -s -invalid=$? +# +# list Kerberos 5 credentials silently +# exit status: +# 0 - klist finds a credentials cache +# 1 - klist does not find a credentials cache or the tickets are expired +# +klist -5 -s && exit 0 -if [ $invalid -eq 0 ]; then - exit 0 -fi +# get the user name for uid $UID +GSS_USER=$(getent passwd $UID | cut -d: -f1) + +GSS_PASS=${GSS_PASS:-"$GSS_USER"} echo "***** refresh Kerberos V5 TGT for uid $UID *****" if [ -z "$GSS_PASS" ]; then