2010-07-12 00:07:20 +04:00
#!/bin/sh
if [ $# -lt 1 ] ; then
2022-04-22 16:46:05 +03:00
cat <<EOF
2023-09-05 07:22:01 +03:00
Usage: test_ktpass.sh PREFIX
2010-07-12 00:07:20 +04:00
EOF
2022-04-22 16:46:05 +03:00
exit 1
2010-07-12 00:07:20 +04:00
fi
PREFIX = " $1 "
shift 1
2022-04-22 16:46:05 +03:00
. $( dirname $0 ) /subunit.sh
2010-07-12 00:07:20 +04:00
2011-04-15 06:41:22 +04:00
samba_tool = " $BINDIR /samba-tool "
samba4bindir = " $BINDIR "
2011-02-03 09:30:53 +03:00
samba4srcdir = " $SRCDIR /source4 "
2022-12-22 15:24:21 +03:00
samba4kinit_binary = $( system_or_builddir_binary kinit " ${ BINDIR } " samba4kinit)
2014-05-12 18:56:29 +04:00
2015-03-16 12:34:37 +03:00
CONFIG = " --configfile= $PREFIX /etc/smb.conf "
2010-07-12 00:07:20 +04:00
2010-07-31 13:12:10 +04:00
TESTUSER = "ktpassUser"
2022-04-22 16:46:05 +03:00
testit "user create" $PYTHON $samba_tool user create $CONFIG $TESTUSER testp@ssw0Rd || failed = $( expr $failed + 1)
2010-07-12 00:07:20 +04:00
KRB5CCNAME = " $PREFIX /tmpccache "
2020-04-03 17:29:36 +03:00
samba4kinit = " $samba4kinit_binary -c $KRB5CCNAME "
2010-07-12 00:07:20 +04:00
export KRB5CCNAME
echo "testp@ssw0Rd" >$PREFIX /tmppassfile
2022-04-22 16:46:05 +03:00
testit "kinit with passwd" $samba4kinit -e arcfour-hmac-md5 --password-file= $PREFIX /tmppassfile $TESTUSER @SAMBA.EXAMPLE.COM || failed = $( expr $failed + 1)
testit "ktpass" $samba4srcdir /scripting/bin/ktpass.sh --host LOCALDC --out $PREFIX /testuser.kt --princ $TESTUSER --pass "testp@ssw0Rd" --path-to-ldbsearch= $BINDIR /bin || failed = $( expr $failed + 1)
2010-07-12 00:07:20 +04:00
rm -f $KRB5CCNAME
2022-04-22 16:46:05 +03:00
testit "kinit with keytab" $samba4kinit -e arcfour-hmac-md5 --use-keytab -t $PREFIX /testuser.kt $TESTUSER @SAMBA.EXAMPLE.COM || failed = $( expr $failed + 1)
2010-07-12 00:07:20 +04:00
rm -f $PREFIX /tmpccache $PREFIX /testuser.kt
exit $failed