s4 unittests: add blackblox test for ktpass
[samba.git] / testprogs / blackbox / test_ktpass.sh
1 #!/bin/sh
2
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: blackbox_newuser.sh PREFIX
6 EOF
7 exit 1;
8 fi
9
10 PREFIX="$1"
11 shift 1
12
13 . `dirname $0`/subunit.sh
14
15
16 net="$BUILDDIR/bin/net"
17 samba4bindir="$BUILDDIR/bin"
18 samba4kinit="$samba4bindir/samba4kinit$EXEEXT"
19 CONFIG="--configfile=$PREFIX/dc/etc/smb.conf"
20
21 #two test for creating new user
22 #newuser  account is created with cn=Given Name Initials. Surname
23 #newuser1 account is created using cn=username
24 testit "newuser" $net newuser $CONFIG --given-name="User" --surname="Tester" --initials="T" --profile-path="\\\\myserver\\my\\profile" --script-path="\\\\myserver\\my\\script" --home-directory="\\\\myserver\\my\\homedir" --job-title="Tester" --department="Testing" --company="Samba.org" --description="Description" --mail-address="tester@samba.org" --internet-address="http://samba.org" --telephone-number="001122334455" --physical-delivery-office="101" --home-drive="H:" testuser testp@ssw0Rd|| failed=`expr $failed + 1`
25
26 KRB5CCNAME="$PREFIX/tmpccache"
27 export KRB5CCNAME
28 echo "testp@ssw0Rd" >$PREFIX/tmppassfile
29 testit "kinit with passwd" $samba4kinit -e arcfour-hmac-md5 --password-file=$PREFIX/tmppassfile   testuser@SAMBA.EXAMPLE.COM   || failed=`expr $failed + 1`
30 testit "ktpass" $BUILDDIR/scripting/bin/ktpass.sh --host LOCALDC --out $PREFIX/testuser.kt --princ testuser --pass "testp@ssw0Rd" --path-to-ldbsearch=$BUILDDIR/bin|| failed=`expr $failed + 1`
31
32 rm -f $KRB5CCNAME
33
34 testit "kinit with keytab" $samba4kinit -e arcfour-hmac-md5 --use-keytab -t $PREFIX/testuser.kt testuser@SAMBA.EXAMPLE.COM   || failed=`expr $failed + 1`
35
36 rm -f $PREFIX/tmpccache $PREFIX/testuser.kt
37 exit $failed