From 68318a450aa8c4010873811feeb3aa359ad5b2cf Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: Wed, 13 Aug 2008 06:44:15 +0000
Subject: [PATCH] Branch HEAD b=16650 i=eric.mei i=grev

1) add sanity-gss.sh into acceptance-small.sh
2) improve krb5_login.sh to support automatic authentication
---
 lustre/tests/acceptance-small.sh | 10 +++++++++-
 lustre/tests/krb5_login.sh       | 28 +++++++++++++++++++---------
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh
index 8d445de8e3..7214e22db9 100755
--- a/lustre/tests/acceptance-small.sh
+++ b/lustre/tests/acceptance-small.sh
@@ -23,7 +23,7 @@ fi
 [ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\""
 [ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484"
 
-export TESTSUITE_LIST="RUNTESTS SANITY DBENCH BONNIE IOZONE FSX SANITYN LFSCK LIBLUSTRE REPLAY_SINGLE CONF_SANITY RECOVERY_SMALL REPLAY_OST_SINGLE REPLAY_DUAL INSANITY SANITY_QUOTA SANITY_SEC"
+export TESTSUITE_LIST="RUNTESTS SANITY DBENCH BONNIE IOZONE FSX SANITYN LFSCK LIBLUSTRE REPLAY_SINGLE CONF_SANITY RECOVERY_SMALL REPLAY_OST_SINGLE REPLAY_DUAL INSANITY SANITY_QUOTA SANITY_SEC SANITY_GSS"
 
 if [ "$ACC_SM_ONLY" ]; then
     for O in $TESTSUITE_LIST; do
@@ -47,7 +47,9 @@ LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 
+export SANITY_GSS="no"
 if $GSS; then
+    export SANITY_GSS="yes"
     # liblustre doesn't support GSS
     export LIBLUSTRE=no
 fi
@@ -368,6 +370,12 @@ if [ "$SANITY_SEC" != "no" ]; then
         SANITY_SEC="done"
 fi
 
+if [ "$SANITY_GSS" != "no" ]; then
+        title sanity-gss
+        bash sanity-gss.sh
+        SANITY_GSS="done"
+fi
+
 RC=$?
 title FINISHED
 echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
diff --git a/lustre/tests/krb5_login.sh b/lustre/tests/krb5_login.sh
index b2a42055fe..31ad933d18 100755
--- a/lustre/tests/krb5_login.sh
+++ b/lustre/tests/krb5_login.sh
@@ -1,18 +1,28 @@
-#!/bin/sh
+#!/bin/bash
+# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
+
+#
+# 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
-- 
GitLab