Whamcloud - gitweb
b=15967
[fs/lustre-release.git] / lustre / tests / krb5_login.sh
1 #!/bin/sh
2
3 #
4 # nothing need for root
5 #
6 if [ $UID -eq 0 ]; then
7     exit 0
8 fi
9
10 klist -5 -s
11 invalid=$?
12
13 if [ $invalid -eq 0 ]; then
14     exit 0
15 fi
16
17 echo "***** refresh Kerberos V5 TGT for uid $UID *****"
18 if [ -z "$GSS_PASS" ]; then
19     kinit
20 else
21     expect <<EOF
22 set timeout 30 
23
24 log_user 1 
25
26 set spawnid [spawn /bin/bash]
27 send "export PS1=\"user@host $ \" \r"
28 expect {
29     timeout {puts "timeout" ;exit 1}
30     "user@host $ "
31 }
32
33 send "kinit\r"
34 expect {
35     timeout {puts "timeout" ;exit 1}
36     "Password for "
37 }
38
39 send "$GSS_PASS\r"
40 expect {
41     timeout {puts "timeout" ;exit 1}
42     "user@host $ "
43 }
44
45 exit 0
46 EOF
47 fi
48 ret=$?
49 exit $ret