WHATSNEW: SMB3 Directory Leases
[Samba.git] / testprogs / blackbox / test_old_enctypes.sh
blob822e329ba6e895a559bfa458d71faeb54e789adf
1 #!/bin/bash
3 if [ $# -lt 5 ]; then
4 cat <<EOF
5 Usage: test_old_enctypes.sh SERVER USERNAME PASSWORD NETBIOSNAME PREFIX_ABS
6 EOF
7 exit 1
8 fi
10 SERVER=$1
11 USERNAME=$2
12 PASSWORD=$3
13 NETBIOSNAME=$4
14 PREFIX_ABS=$5
15 shift 5
16 failed=0
18 samba4bindir="$BINDIR"
19 samba4srcdir="$SRCDIR/source4"
21 samba_tool="$samba4bindir/samba-tool"
23 . $(dirname $0)/subunit.sh
24 . $(dirname $0)/common_test_fns.inc
26 ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
27 ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
29 out="${PREFIX_ABS}/tmpldbsearch.out"
30 $ldbsearch -H ldap://$SERVER -U$USERNAME%$PASSWORD -d0 sAMAccountName="$NETBIOSNAME\$" dn msDS-SupportedEncryptionTypes >$out
31 testit_grep "find my dn" msDS-SupportedEncryptionTypes cat $out || failed=$(expr $failed + 1)
33 my_dn=$(cat $out | sed -n 's/^dn: //p')
34 my_encs=$(cat $out | sed -n 's/^msDS-SupportedEncryptionTypes: //p')
35 my_test_encs=$(expr $my_encs + 3)
37 ldif="${PREFIX_ABS}/tmpldbmodify.ldif"
39 cat >$ldif <<EOF
40 dn: $my_dn
41 changetype: modify
42 replace: msDS-SupportedEncryptionTypes
43 msDS-SupportedEncryptionTypes: $my_test_encs
44 EOF
46 testit "Change msDS-SupportedEncryptionTypes to $my_test_encs" $VALGRIND $ldbmodify -H ldap://$SERVER -U$USERNAME%$PASSWORD -d0 <$ldif || failed=$(expr $failed + 1)
47 kt=${PREFIX_ABS}/tmp_host_out_keytab
48 testit "Export keytab while old enctypes are supported" $samba_tool domain exportkeytab --principal=$NETBIOSNAME\$ $kt
50 cat >$ldif <<EOF
51 dn: $my_dn
52 changetype: modify
53 replace: msDS-SupportedEncryptionTypes
54 msDS-SupportedEncryptionTypes: $my_encs
55 EOF
57 testit "Change msDS-SupportedEncryptionTypes back to $my_encs" $VALGRIND $ldbmodify -H ldap://$SERVER -U$USERNAME%$PASSWORD -d0 <$ldif || failed=$(expr $failed + 1)
59 rm -rf $kt $out $ldif
61 exit $failed