selftest: add a test that itime is not set when setting DOS attrs
authorRalph Boehme <slow@samba.org>
Thu, 27 Jun 2019 07:38:57 +0000 (09:38 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 1 Jul 2019 23:21:07 +0000 (23:21 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jul  1 23:21:07 UTC 2019 on sn-devel-184

selftest/target/Samba4.pm
source3/script/tests/test_itime.sh [new file with mode: 0755]
source3/selftest/tests.py

index 59ea6f38e18039b73c0cabd6285a7030ab351ee2..32de94cf21f6193a059bd97d77fb1f2793a17639 100755 (executable)
@@ -1215,6 +1215,11 @@ sub provision($$$$$$$$$$)
        fruit:locking = netatalk
        fruit:encoding = native
 
+[xattr]
+       path = $ctx->{share}
+        # This can be used for testing real fs xattr stuff
+       vfs objects = streams_xattr acl_xattr
+
 $extra_smbconf_shares
 ";
 
diff --git a/source3/script/tests/test_itime.sh b/source3/script/tests/test_itime.sh
new file mode 100755 (executable)
index 0000000..c457da9
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# this tests immutable birthtime
+
+if [ $# != 6 ]; then
+cat <<EOF
+Usage: $0 SERVER USERNAME PASSWORD LOCAL_PATH SMBCLIENT SHARE
+EOF
+exit 1
+fi
+
+SERVER="$1"
+USERNAME="$2"
+PASSWORD="$3"
+LOCAL_PATH="$4"
+SMBCLIENT="$5"
+SHARE="$6"
+SAMBATOOL="$BINDIR/samba-tool"
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+# Show that setting DOS attributes on a locally created file, therefore lacking
+# a DOS xattr and an itime, doesn't set an itime
+no_itime_on_local_file() {
+    fname="tmp.$$"
+    local_fname="$LOCAL_PATH/$fname"
+    touch $local_fname || return 1
+
+    $SMBCLIENT //$SERVER/$SHARE -U $USERNAME%$PASSWORD -c "setmode $fname +h" || return 1
+
+    dosinfo=$($SAMBATOOL ntacl getdosinfo $local_fname) || return 1
+    echo $dosinfo | grep -q "xattr_DosInfo4" || return 1
+    echo $dosinfo | grep -q "1: XATTR_DOSINFO_ATTRIB" || return 1
+    echo $dosinfo | grep -q "1: XATTR_DOSINFO_CREATE_TIME" || return 1
+    echo $dosinfo | grep -q "0: XATTR_DOSINFO_ITIME" || return 1
+}
+
+testit "no_itime_on_local_file" no_itime_on_local_file
index 5ef227732bee7d865f02138ae0f3f2832ed565b1..1394dc456b2a514853bd5fa1ae9e6df126b0abe3 100755 (executable)
@@ -832,3 +832,5 @@ for env in ["ad_member_idmap_rid:local", "maptoguest:local"]:
     plantestsuite("samba3.blackbox.guest (%s)" % env , env,
                   [os.path.join(samba3srcdir, "script/tests/test_guest_auth.sh"),
                    '$SERVER', smbclient3, smbcontrol, net, configuration])
+
+plantestsuite("samba3.blackbox.itime", "ad_dc", [os.path.join(samba3srcdir, "script/tests/test_itime.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, 'xattr'])