g_lock: Fix uninitalized variable reads
[Samba.git] / testprogs / blackbox / test_pkinit_pac_heimdal.sh
blob5f6947422ab79757341dab40e81ea7a352c96309
1 #!/bin/sh
2 # Blackbox tests for pkinit and pac verification
3 # Copyright (C) 2006-2008 Stefan Metzmacher
5 if [ $# -lt 5 ]; then
6 cat <<EOF
7 Usage: test_pkinit_pac_heimdal.sh SERVER USERNAME PASSWORD REALM DOMAIN PREFIX ENCTYPE
8 EOF
9 exit 1;
12 SERVER=$1
13 USERNAME=$2
14 PASSWORD=$3
15 REALM=$4
16 DOMAIN=$5
17 PREFIX=$6
18 ENCTYPE=$7
19 shift 7
20 failed=0
22 samba4bindir="$BINDIR"
23 samba4srcdir="$SRCDIR/source4"
24 samba4kinit=kinit
25 if test -x $BINDIR/samba4kinit; then
26 samba4kinit=$BINDIR/samba4kinit
29 smbtorture4="$samba4bindir/smbtorture"
31 . `dirname $0`/subunit.sh
32 . `dirname $0`/common_test_fns.inc
34 enctype="-e $ENCTYPE"
35 unc="//$SERVER/tmp"
37 KRB5CCNAME_PATH="$PREFIX/tmpccache"
38 KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
39 export KRB5CCNAME
40 rm -f $KRB5CCNAME_PATH
41 PASSFILE_PATH="$PREFIX/tmppassfile"
42 rm -f $PASSFILE_PATH
43 echo $PASSWORD > $PASSFILE_PATH
45 USER_PRINCIPAL_NAME=`echo "${USERNAME}@${REALM}" | tr A-Z a-z`
46 PKUSER="--pk-user=FILE:$PREFIX/pkinit/USER-${USER_PRINCIPAL_NAME}-cert.pem,$PREFIX/pkinit/USER-${USER_PRINCIPAL_NAME}-private-key.pem"
48 testit "STEP1 kinit with pkinit (name specified) " $samba4kinit $enctype --request-pac --renewable $PKUSER $USERNAME@$REALM || failed=`expr $failed + 1`
49 testit "STEP1 remote.pac verification" $smbtorture4 ncacn_np:$SERVER rpc.pac --workgroup=$DOMAIN -U$USERNAME%$PASSWORD --krb5-ccache=$KRB5CCNAME --option=torture:pkinit_in_use=yes || failed=`expr $failed + 1`
51 rm -f $PASSFILE_PATH
52 rm -f $KRB5CCNAME_PATH
53 exit $failed