source: vendor/3.6.0/testprogs/blackbox/test_chgdcpass.sh

Last change on this file was 740, checked in by Silvan Scherrer, 13 years ago

Samba Server: update vendor to 3.6.0

File size: 2.2 KB
Line 
1#!/bin/sh
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>
5
6if [ $# -lt 4 ]; then
7cat <<EOF
8Usage: test_kinit.sh SERVER USERNAME REALM DOMAIN PREFIX
9EOF
10exit 1;
11fi
12
13SERVER=$1
14USERNAME=$2
15REALM=$3
16DOMAIN=$4
17PREFIX=$5
18ENCTYPE=$6
19PROVDIR=$7
20shift 7
21failed=0
22
23samba4bindir="$BUILDDIR/bin"
24samba4srcdir="$SRCDIR/source4"
25smbclient="$samba4bindir/smbclient$EXEEXT"
26samba4kinit="$samba4bindir/samba4kinit$EXEEXT"
27
28machineaccountccache="$samba4srcdir/scripting/bin/machineaccountccache"
29
30. `dirname $0`/subunit.sh
31
32test_smbclient() {
33 name="$1"
34 cmd="$2"
35 shift
36 shift
37 echo "test: $name"
38 $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" -W "$DOMAIN" $@
39 status=$?
40 if [ x$status = x0 ]; then
41 echo "success: $name"
42 else
43 echo "failure: $name"
44 fi
45 return $status
46}
47
48enctype="-e $ENCTYPE"
49
50KRB5CCNAME="$PREFIX/tmpccache"
51export KRB5CCNAME
52rm -f $KRB5CCNAME
53testit "kinit with keytab" $samba4kinit $enctype -t $PROVDIR/private/secrets.keytab --use-keytab $USERNAME || failed=`expr $failed + 1`
54
55#This is important because it puts the ticket for the old KVNO and password into a local ccache
56test_smbclient "Test login with kerberos ccache before password change" 'ls' -k yes || failed=`expr $failed + 1`
57testit "change dc password" $samba4srcdir/scripting/devel/chgtdcpass -s $PROVDIR/etc/smb.conf || failed=`expr $failed + 1`
58
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
60test_smbclient "Test login with kerberos ccache after password change" 'ls' -k yes || failed=`expr $failed + 1`
61
62#This confirms that the DC password is valid for a kinit too
63testit "kinit with keytab" $samba4kinit $enctype -t $PROVDIR/private/secrets.keytab --use-keytab $USERNAME || failed=`expr $failed + 1`
64test_smbclient "Test login with kerberos ccache with fresh kinit" 'ls' -k yes || failed=`expr $failed + 1`
65rm -f $KRB5CCNAME
66
67rm -f $PREFIX/tmpccache tmpccfile tmppassfile tmpuserpassfile tmpuserccache tmpkpasswdscript
68exit $failed
Note: See TracBrowser for help on using the repository browser.