s3: tests: Regression test to ensure we can never return a DIRECTORY attribute on...
authorJeremy Allison <jra@samba.org>
Wed, 11 Apr 2018 17:33:22 +0000 (10:33 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 12 Apr 2018 00:04:28 +0000 (02:04 +0200)
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

selftest/target/Samba3.pm
source3/script/tests/test_smbclient_s3.sh

index 8914507c12e2a0055103a0f723b51582bb109e1f..b93cbc2750742894b10167f0c653c5a994d1ff2c 100755 (executable)
@@ -2143,6 +2143,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
index cc0d69dfb6e65e6301e59dc47fae539216dd562c..96bd5eb3f311a6b1375e67390b2a72aa99c51d1f 100755 (executable)
@@ -1606,6 +1606,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:
@@ -1705,6 +1777,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`