diff options
author | Uri Simchoni <uri@samba.org> | 2015-11-04 07:31:47 +0200 |
---|---|---|
committer | Uri Simchoni <uri@samba.org> | 2016-03-10 11:27:29 +0100 |
commit | b27cf10c0cb306596a1c0aa8ceb2605714576e0c (patch) | |
tree | 3a4d0cd73390b2ec14d42b7519b020378ca9f8e5 /testprogs | |
parent | 645e777b0aca7d997867e0b3f0b48bfb138cc25c (diff) | |
download | samba-b27cf10c0cb306596a1c0aa8ceb2605714576e0c.tar.gz |
selftest: run net ads join test in a private client env
net ads join command changes machine password, thus affecting
the test environment beyond the thing we want to test.
This cange runs the test in a private client env, with its
own hostname, newly-generated machine SID, and a separate
secrets.tdb, thus not affecting the running AD member server,
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'testprogs')
-rwxr-xr-x | testprogs/blackbox/test_net_ads.sh | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/testprogs/blackbox/test_net_ads.sh b/testprogs/blackbox/test_net_ads.sh index 487014deea6..f26b4c46819 100755 --- a/testprogs/blackbox/test_net_ads.sh +++ b/testprogs/blackbox/test_net_ads.sh @@ -1,6 +1,6 @@ -if [ $# -lt 3 ]; then +if [ $# -lt 4 ]; then cat <<EOF -Usage: test_net.sh SERVER USERNAME PASSWORD +Usage: test_net.sh DC_SERVER DC_USERNAME DC_PASSWORD PREFIX_ABS EOF exit 1; fi @@ -8,14 +8,29 @@ fi DC_SERVER=$1 DC_USERNAME=$2 DC_PASSWORD=$3 +BASEDIR=$4 + +HOSTNAME=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | sha1sum | cut -b 1-10` + +RUNDIR=`pwd` +cd $BASEDIR +WORKDIR=`mktemp -d -p .` +WORKDIR=`basename $WORKDIR` +cp -a client/* $WORKDIR/ +sed -ri "s@(dir|directory) = (.*)/client/@\1 = \2/$WORKDIR/@" $WORKDIR/client.conf +sed -ri "s/netbios name = .*/netbios name = $HOSTNAME/" $WORKDIR/client.conf +rm -f $WORKDIR/private/secrets.tdb +cd $RUNDIR failed=0 -net_tool="$BINDIR/net" +net_tool="$BINDIR/net -s $BASEDIR/$WORKDIR/client.conf --option=security=ads" # Load test functions . `dirname $0`/subunit.sh +testit "join" $VALGRIND $net_tool ads join -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1` + testit "leave" $VALGRIND $net_tool ads leave -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1` testit "join+server" $VALGRIND $net_tool ads join -U$DC_USERNAME%$DC_PASSWORD -S$DC_SERVER || failed=`expr $failed + 1` @@ -31,5 +46,9 @@ testit_expect_failure "leave+invalid_server" $VALGRIND $net_tool ads leave -U$DC testit "testjoin" $VALGRIND $net_tool ads testjoin -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1` testit "testjoin_machine_account" $VALGRIND $net_tool ads testjoin -kP || failed=`expr $failed + 1` +##Goodbye... +testit "leave" $VALGRIND $net_tool ads leave -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1` + +rm -rf $BASEDIR/$WORKDIR exit $failed |