From ea3ca6be6425ffd8dffa22a122afabd47b7bb510 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 18 Jun 2016 19:30:46 +0200 Subject: [PATCH] selftest: Kerberos auth with netbios alias SPNs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Andrew Bartlett Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Sun Jun 19 19:07:46 CEST 2016 on sn-devel-144 --- selftest/target/Samba3.pm | 1 + .../tests/test_smbclient_netbios_aliases.sh | 40 +++++++++++++++++++ source3/selftest/tests.py | 5 +++ 3 files changed, 46 insertions(+) create mode 100755 source3/script/tests/test_smbclient_netbios_aliases.sh diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 7a67e77b5c5..3f6fd1e866c 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -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 index 00000000000..cb0d9673d63 --- /dev/null +++ b/source3/script/tests/test_smbclient_netbios_aliases.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then +cat < +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 diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 45a7787c92d..cc635cdccd7 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -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: