r22235: Test kinit, and PKINIT functionality by means of a new blackbox test.
authorAndrew Bartlett <abartlet@samba.org>
Mon, 16 Apr 2007 04:55:52 +0000 (04:55 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:50:41 +0000 (14:50 -0500)
Andrew Bartlett
(This used to be commit 7f27bfc3568bc09b2b9cb9ba03aae55a03e08f9a)

source4/script/tests/tests_all.sh
testprogs/blackbox/test_kinit.sh [new file with mode: 0644]

index 95968780cd7ef94e5c73ada3d591f395b60d7385..68ec5ba22444709fde7a2e19e17b0d6f18e41806 100755 (executable)
@@ -11,6 +11,6 @@
  $SRCDIR/script/tests/test_cifs.sh
  $SRCDIR/script/tests/test_local.sh
  $SRCDIR/script/tests/test_pidl.sh
- $SRCDIR/script/tests/test_blackbox.sh $PREFIX/blackbox
+ $SRCDIR/script/tests/test_blackbox.sh $PREFIX
  $SRCDIR/script/tests/test_simple.sh
  $SRCDIR/script/tests/test_s3upgrade.sh $PREFIX/upgrade
diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh
new file mode 100644 (file)
index 0000000..635662a
--- /dev/null
@@ -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