s3: tests: Add regression test for smbd crash on share force group change with existi...
authorJeremy Allison <jra@samba.org>
Thu, 24 Jan 2019 18:15:56 +0000 (10:15 -0800)
committerRalph Boehme <slow@samba.org>
Fri, 25 Jan 2019 12:20:23 +0000 (13:20 +0100)
Mark as known fail for now.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13690

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
selftest/knownfail
selftest/selftesthelpers.py
selftest/target/Samba3.pm
source3/script/tests/test_force_group_change.sh [new file with mode: 0755]
source3/selftest/tests.py

index abbbd889c7109f96766f67b833e164980230c531..9678883924ef8d59b6111a75da1b6b3425532d2a 100644 (file)
 ^samba.tests.ntlmdisabled.python\(ktest\).python2.ntlmdisabled.NtlmDisabledTests.test_samr_change_password\(ktest\)
 ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python3.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\)
 ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python2.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\)
+# BUG:https://bugzilla.samba.org/show_bug.cgi?id=13690
+^samba3.blackbox.force_group_change.*
index ebdae12866a7a74a87f8eb65b08d35aec1efd685..acce6d24ccefe5b0cdf21a9443a7bf8468caf7a8 100644 (file)
@@ -207,3 +207,4 @@ smbcquotas = binpath('smbcquotas')
 smbget = binpath('smbget')
 rpcclient = binpath('rpcclient')
 smbcacls = binpath('smbcacls')
+smbcontrol = binpath('smbcontrol')
index 49bdd2ac885c43492c8b5e3cfb9c25385d06639f..f11bb9312df6cb05665ee2f34774e7c5dbf3496a 100755 (executable)
@@ -984,6 +984,11 @@ sub setup_fileserver
        comment = inherit only unix owner
        inherit owner = unix only
        acl_xattr:ignore system acls = yes
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=13690
+[force_group_test]
+       path = $share_dir
+       comment = force group test
+#      force group = everyone
 [homes]
        comment = Home directories
        browseable = No
diff --git a/source3/script/tests/test_force_group_change.sh b/source3/script/tests/test_force_group_change.sh
new file mode 100755 (executable)
index 0000000..6cb1ab4
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# Copyright (c) Jeremy Allison <jra@samba.org>
+# License: GPLv3
+# Regression test for BUG:https://bugzilla.samba.org/show_bug.cgi?id=13690
+
+if [ $# -lt 6 ]; then
+       echo "Usage: test_force_group_change.sh SERVER USERNAME PASSWORD LOCAL_PATH SMBCLIENT SMBCONTROL"
+       exit 1
+fi
+
+SERVER="${1}"
+USERNAME="${2}"
+PASSWORD="${3}"
+LOCAL_PATH="${4}"
+SMBCLIENT="${5}"
+SMBCONTROL="${6}"
+shift 6
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+failed=0
+
+test_force_group_change()
+{
+#
+# A SMB_CONF variable passed in here is the client smb.conf.
+# We need to convert to the server.conf file from
+# the LOCAL_PATH variable.
+#
+SERVER_CONFIG=`dirname $LOCAL_PATH`/lib/server.conf
+SERVER_CONFIG_SAVE=${SERVER_CONFIG}.bak
+SERVER_CONFIG_NEW=${SERVER_CONFIG}.new
+cp $SERVER_CONFIG $SERVER_CONFIG_SAVE
+
+sed -e 's/#\tforce group = everyone/\tforce group = everyone/' <${SERVER_CONFIG} >${SERVER_CONFIG_NEW}
+
+    tmpfile=$PREFIX/smbclient_force_group_change_commands
+    cat > $tmpfile <<EOF
+ls
+!cp ${SERVER_CONFIG_NEW} ${SERVER_CONFIG}
+!${SMBCONTROL} --configfile=${SERVER_CONFIG} all reload-config
+ls
+!cp ${SERVER_CONFIG_SAVE} ${SERVER_CONFIG}
+!${SMBCONTROL} --configfile=${SERVER_CONFIG} all reload-config
+quit
+EOF
+
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/force_group_test $CONFIGURATION < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval $cmd)
+    ret=$?
+    rm -f $tmpfile
+    rm -f $SERVER_CONFIG_SAVE
+    rm -f $SERVER_CONFIG_NEW
+
+    echo "$out" | grep 'NT_STATUS_CONNECTION_DISCONNECTED'
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       # Client was disconnected as server crashed.
+       echo "$out"
+       return 1
+    fi
+
+    return 0
+}
+
+testit "test force group change" \
+    test_force_group_change || \
+    failed=`expr $failed + 1`
+
+testok $0 $failed
index 46f078759e16f6a71e072ce5b8ece96c06febd98..30a93a2ee421411bc35f997c864766780b3182be 100755 (executable)
@@ -29,6 +29,7 @@ from selftesthelpers import net, wbinfo, dbwrap_tool, rpcclient, python
 from selftesthelpers import smbget, smbcacls, smbcquotas, ntlm_auth3
 from selftesthelpers import valgrindify, smbtorture4_testsuites
 from selftesthelpers import smbtorture4_options
+from selftesthelpers import smbcontrol
 smbtorture4_options.extend([
     '--option=torture:sharedelay=100000',
    '--option=torture:writetimeupdatedelay=500000',
@@ -327,6 +328,9 @@ for env in ["fileserver"]:
     plantestsuite("samba3.blackbox.large_acl.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_large_acl.sh"), '$SERVER', '$USERNAME', '$PASSWORD', smbclient3, smbcacls, '-m', 'SMB3'])
     plantestsuite("samba3.blackbox.give_owner", env, [os.path.join(samba3srcdir, "script/tests/test_give_owner.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'tmp'])
     plantestsuite("samba3.blackbox.homes", env, [os.path.join(samba3srcdir, "script/tests/test_homes.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', '$PREFIX', smbclient3, configuration])
+    plantestsuite("samba3.blackbox.force_group_change", env,
+               [os.path.join(samba3srcdir, "script/tests/test_force_group_change.sh"),
+               '$SERVER', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, smbcontrol])
 
     #
     # tar command tests