selftest: Kerberos auth with netbios alias SPNs
authorRalph Boehme <slow@samba.org>
Sat, 18 Jun 2016 17:30:46 +0000 (19:30 +0200)
committerRalph Boehme <slow@samba.org>
Sun, 19 Jun 2016 17:07:45 +0000 (19:07 +0200)
Since commit 0f6d51f34baa816b6ec422c8bc28687f0a3073de libnet_join
automatically adds netbios aliases as SPNs to the machine account.

This commit adds a simple test with smbclient -k against the aliases.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Ralph B√∂hme <slow@samba.org>
Autobuild-Date(master): Sun Jun 19 19:07:46 CEST 2016 on sn-devel-144

selftest/target/Samba3.pm
source3/script/tests/test_smbclient_netbios_aliases.sh [new file with mode: 0755]
source3/selftest/tests.py

index 7a67e77b5c527ec5dbbd8e29ebcf7814e31365fb..3f6fd1e866ca7c6c72a3ce40c103db8ccc976ee0 100755 (executable)
@@ -380,6 +380,7 @@ sub setup_admember($$$$)
        security = ads
         workgroup = $dcvars->{DOMAIN}
         realm = $dcvars->{REALM}
+        netbios aliases = foo bar
 ";
 
        my $ret = $self->provision($prefix,
diff --git a/source3/script/tests/test_smbclient_netbios_aliases.sh b/source3/script/tests/test_smbclient_netbios_aliases.sh
new file mode 100755 (executable)
index 0000000..cb0d967
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+cat <<EOF
+Usage: test_smbclient.sh smbclient3 SERVER USERNAME PASSWORD PREFIX <smbclient args>
+EOF
+exit 1;
+fi
+
+SMBCLIENT3=$1
+SERVER=$2
+USERNAME=$3
+PASSWORD=$4
+PREFIX=$5
+shift 5
+ADDARGS="$*"
+
+samba4bindir="$BINDIR"
+samba4srcdir="$SRCDIR/source4"
+samba4kinit=kinit
+if test -x $BINDIR/samba4kinit; then
+       samba4kinit=$BINDIR/samba4kinit
+fi
+
+KRB5CCNAME_PATH="$PREFIX/tmpccache"
+KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
+export KRB5CCNAME
+rm -rf $KRB5CCNAME_PATH
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+echo $PASSWORD > $PREFIX/tmppassfile
+testit "kinit" $samba4kinit --password-file=$PREFIX/tmppassfile $USERNAME || failed=`expr $failed + 1`
+rm -f $PREFIX/tmppassfile
+testit "smbclient" $VALGRIND $SMBCLIENT3 -k //$SERVER/tmp -c 'ls' $ADDARGS || failed=`expr $failed + 1`
+
+rm -rf $KRB5CCNAME_PATH
+
+testok $0 $failed
index 45a7787c92d60d01cfc858b298cb35070abb16cb..cc635cdccd7c2b18f6843d4b5b1d0a80431894b5 100755 (executable)
@@ -496,6 +496,11 @@ for options in options_list:
                    "none",
                    smbclient3, "$SERVER", "$PREFIX", options, "-U$USERNAME%$PASSWORD " + configuration])
 
+for alias in ["foo", "bar"]:
+    plantestsuite("samba3.blackbox.smbclient_netbios_aliases [%s]" % alias, "ad_member:local",
+                  [os.path.join(samba3srcdir, "script/tests/test_smbclient_netbios_aliases.sh"),
+                   smbclient3, alias, "$DC_USERNAME", "$DC_PASSWORD", "$PREFIX", options, configuration])
+
 for e in endianness_options:
     for a in auth_options:
         for s in signseal_options: