2 # Blackbox tests for kinit and kerberos integration with smbclient etc
3 # Copyright (C) 2006-2007 Jelmer Vernooij <jelmer@samba.org>
4 # Copyright (C) 2006-2008 Andrew Bartlett <abartlet@samba.org>
8 Usage: test_kinit.sh SERVER USERNAME REALM DOMAIN PREFIX
23 samba4bindir
="$BUILDDIR/bin"
24 samba4srcdir
="$SRCDIR/source4"
25 smbclient
="$samba4bindir/smbclient$EXEEXT"
26 samba4kinit
="$samba4bindir/samba4kinit$EXEEXT"
28 machineaccountccache
="$samba4srcdir/scripting/bin/machineaccountccache"
30 .
`dirname $0`/subunit.sh
38 $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp
-c "$cmd" -W "$DOMAIN" $@
40 if [ x
$status = x0
]; then
50 KRB5CCNAME
="$PREFIX/tmpccache"
53 testit
"kinit with keytab" $samba4kinit $enctype -t $PROVDIR/private
/secrets.keytab
--use-keytab $USERNAME || failed
=`expr $failed + 1`
55 #This is important because it puts the ticket for the old KVNO and password into a local ccache
56 test_smbclient
"Test login with kerberos ccache before password change" 'ls' -k yes || failed
=`expr $failed + 1`
57 testit
"change dc password" $samba4srcdir/scripting
/devel
/chgtdcpass
-s $PROVDIR/etc
/smb.conf || failed
=`expr $failed + 1`
59 #This is important because it shows that the old ticket remains valid (as it must) for incoming connections after the DC password is changed
60 test_smbclient
"Test login with kerberos ccache after password change" 'ls' -k yes || failed
=`expr $failed + 1`
62 #This confirms that the DC password is valid for a kinit too
63 testit
"kinit with keytab" $samba4kinit $enctype -t $PROVDIR/private
/secrets.keytab
--use-keytab $USERNAME || failed
=`expr $failed + 1`
64 test_smbclient
"Test login with kerberos ccache with fresh kinit" 'ls' -k yes || failed
=`expr $failed + 1`
67 rm -f $PREFIX/tmpccache tmpccfile tmppassfile tmpuserpassfile tmpuserccache tmpkpasswdscript