summaryrefslogtreecommitdiff
path: root/testprogs/blackbox/test_kinit.sh
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-04-16 04:55:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:50:41 -0500
commitb0cbe9ae4a5768c768d69c68a06e1a41b7d26985 (patch)
treedc3647d83b2f83dd46a4d0b20295cc82c2f9f907 /testprogs/blackbox/test_kinit.sh
parente24cf892883b54a567f294eacbd94a23d7d420e4 (diff)
downloadsamba-b0cbe9ae4a5768c768d69c68a06e1a41b7d26985.tar.gz
samba-b0cbe9ae4a5768c768d69c68a06e1a41b7d26985.tar.bz2
samba-b0cbe9ae4a5768c768d69c68a06e1a41b7d26985.zip
r22235: Test kinit, and PKINIT functionality by means of a new blackbox test.
Andrew Bartlett (This used to be commit 7f27bfc3568bc09b2b9cb9ba03aae55a03e08f9a)
Diffstat (limited to 'testprogs/blackbox/test_kinit.sh')
-rw-r--r--testprogs/blackbox/test_kinit.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh
new file mode 100644
index 0000000000..635662a550
--- /dev/null
+++ b/testprogs/blackbox/test_kinit.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+if [ $# -lt 5 ]; then
+cat <<EOF
+Usage: test_kinit.sh SERVER USERNAME PASSWORD REALM PREFIX
+EOF
+exit 1;
+fi
+
+SERVER=$1
+USERNAME=$2
+PASSWORD=$3
+REALM=$4
+PREFIX=$5
+shift 5
+failed=0
+
+testit() {
+ name="$1"
+ shift
+ cmdline="$*"
+ echo "test: $name"
+ $cmdline
+ status=$?
+ if [ x$status = x0 ]; then
+ echo "success: $name"
+ else
+ echo "failure: $name"
+ fi
+ return $status
+}
+
+KRB5CCNAME=`pwd`/tmpccache
+export KRB5CCNAME
+
+echo $PASSWORD > ./tmppassfile
+testit "kinit with password" samba4kinit --password-file=./tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1`
+testit "kinit with pkinit" samba4kinit --request-pac --pk-user=FILE:$PREFIX/dc/private/tls/admincert.pem,$PREFIX/dc/private/tls/adminkey.pem $USERNAME@$REALM || failed=`expr $failed + 1`
+
+echo ls | testit "Test login with kerberos ccache" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -k yes || failed=`expr $failed + 1`
+
+testit "domain join with kerberos ccache" $VALGRIND bin/net join $DOMAIN $CONFIGURATION -W "$DOMAIN" -k yes $@
+
+rm -f tmpccfile tmppassfile
+exit $failed