pidl:Wireshark Fix the type of array of pointerse to hf_ values
[Samba.git] / testprogs / blackbox / test_trust_user_account.sh
blob94a3aa3e9ba55fa35738623b028eda007941633b
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: test_trust_user_account.sh PREFIX OUR_REALM OUR_FLAT REMOTE_REALM REMOTE_FLAT
6 EOF
7 exit 1
8 fi
10 PREFIX="$1"
11 OUR_REALM="$2"
12 OUR_FLAT="$3"
13 REMOTE_REALM="$4"
14 REMOTE_FLAT="$5"
15 shift 5
17 . $(dirname $0)/subunit.sh
19 samba_tool="$BINDIR/samba-tool"
20 samba4bindir="$BINDIR"
21 samba4srcdir="$SRCDIR/source4"
22 samba4kinit_binary="kinit -k"
23 if test -x $BINDIR/samba4kinit; then
24 samba4kinit_binary="$BINDIR/samba4kinit --use-keytab"
27 KEYTAB="$PREFIX/tmptda.keytab"
29 KRB5_TRACE=/dev/stderr
30 export KRB5_TRACE
32 testit "retrieve keytab for TDA of $REMOTE_REALM" $PYTHON $samba_tool domain exportkeytab $KEYTAB $CONFIGURATION --principal "$REMOTE_FLAT\$@$OUR_REALM" || failed=$(expr $failed + 1)
34 KRB5CCNAME="$PREFIX/tmptda.ccache"
35 samba4kinit="$samba4kinit_binary -c $KRB5CCNAME"
36 export KRB5CCNAME
38 rm -f $KRB5CCNAME
40 EXPECTED_SALT="${OUR_REALM}krbtgt${REMOTE_FLAT}"
42 # Note the \$ is for the end of line in grep
44 # There must be no trailing '$' in the SALT string itself,
45 # it's removed from the sAMAccountName value (which includes the trailing '$')
46 # before construting the salt!
48 # Otherwise this would be:
49 # "^virtualKerberosSalt: ${EXPECTED_SALT}\\\$\$"
51 EXPECTED_GREP="^virtualKerberosSalt: ${EXPECTED_SALT}\$"
52 testit_grep "get virtualKerberosSalt for TDA of $REMOTE_FLAT\$" "$EXPECTED_GREP" $PYTHON $samba_tool user getpassword "$REMOTE_FLAT\$" $CONFIGURATION --attributes=virtualKerberosSalt || failed=$(expr $failed + 1)
54 testit "kinit with keytab for TDA of $REMOTE_REALM" $samba4kinit -t $KEYTAB "$REMOTE_FLAT\$@$OUR_REALM" || failed=$(expr $failed + 1)
56 rm -f $KRB5CCNAME $KEYTAB
58 exit $failed