summaryrefslogtreecommitdiff
path: root/source3/script/tests
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2019-01-24 10:15:56 -0800
committerKarolin Seeger <kseeger@samba.org>2019-02-21 12:31:46 +0100
commitb363885250897b37820e08a335e5a043dff2a272 (patch)
treeeafa2e6f05800c07126ea1d2ca83bdea528f1268 /source3/script/tests
parent8c8457150c53045a81207c340cc8694ac60f28bf (diff)
downloadsamba-b363885250897b37820e08a335e5a043dff2a272.tar.gz
s3: tests: Add regression test for smbd crash on share force group change with existing connection.
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> (cherry picked from commit 7b21b4c1f538650f23ec77fb3c02fe1e224d89aa)
Diffstat (limited to 'source3/script/tests')
-rwxr-xr-xsource3/script/tests/test_force_group_change.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/source3/script/tests/test_force_group_change.sh b/source3/script/tests/test_force_group_change.sh
new file mode 100755
index 00000000000..6cb1ab4e048
--- /dev/null
+++ b/source3/script/tests/test_force_group_change.sh
@@ -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