summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2018-04-11 10:33:22 -0700
committerKarolin Seeger <kseeger@samba.org>2018-05-07 09:57:26 +0200
commit6db05c047f4501de5250689e8fe0fd358f359cc0 (patch)
tree47e9575c7cbd94aa8049ee40f0738947450a17e6
parent8607feadb88ceeff688293691a5dc13021781ac2 (diff)
downloadsamba-6db05c047f4501de5250689e8fe0fd358f359cc0.tar.gz
s3: tests: Regression test to ensure we can never return a DIRECTORY attribute on a stream.
Tests streams_xattr and also streams_depot. Inspired from a real-world test case by Andrew Walker <awalker@ixsystems.com>. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Apr 12 02:04:28 CEST 2018 on sn-devel-144 (cherry picked from commit 82beaf868f252c4bc975ddafd80240af6f679b83)
-rwxr-xr-xselftest/target/Samba3.pm4
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh76
2 files changed, 80 insertions, 0 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index f1e29bf3dca..299d55b6eaf 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2040,6 +2040,10 @@ sub provision($$$$$$$$$)
kernel oplocks = yes
vfs objects = streams_xattr xattr_tdb
+[streams_xattr]
+ copy = tmp
+ vfs objects = streams_xattr xattr_tdb
+
[compound_find]
copy = tmp
smbd:find async delay usec = 10000
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 05fcf697958..04c2e2d4972 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -1521,6 +1521,78 @@ EOF
return 0
}
+# Test xattr_stream correctly reports mode.
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
+
+test_stream_directory_xattr()
+{
+ tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+#
+# Test against streams_xattr
+#
+ cat > $tmpfile <<EOF
+deltree foo
+mkdir foo
+put ${PREFIX}/smbclient_interactive_prompt_commands foo:bar
+setmode foo -a
+allinfo foo:bar
+deltree foo
+quit
+EOF
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/streams_xattr -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+ rm -f $tmpfile
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed checking attributes on xattr stream foo:bar with error $ret"
+ return 1
+ fi
+
+ echo "$out" | grep "attributes:.*80"
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed checking attributes on xattr stream foo:bar"
+ return 1
+ fi
+
+#
+# Test against streams_depot
+#
+ cat > $tmpfile <<EOF
+deltree foo
+mkdir foo
+put ${PREFIX}/smbclient_interactive_prompt_commands foo:bar
+setmode foo -a
+allinfo foo:bar
+deltree foo
+quit
+EOF
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+ rm -f $tmpfile
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed checking attributes on depot stream foo:bar with error $ret"
+ return 1
+ fi
+
+ echo "$out" | grep "attributes:.*80"
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed checking attributes on depot stream foo:bar"
+ return 1
+ fi
+}
+
+#
LOGDIR_PREFIX=test_smbclient_s3
# possibly remove old logdirs:
@@ -1620,6 +1692,10 @@ testit "streams_depot can delete correctly" \
test_streams_depot_delete || \
failed=`expr $failed + 1`
+testit "stream_xattr attributes" \
+ test_stream_directory_xattr || \
+ failed=`expr $failed + 1`
+
testit "follow symlinks = no" \
test_nosymlinks || \
failed=`expr $failed + 1`