1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
samba-mirror/source3/script/tests/test_itime.sh
Ralph Boehme 6e65c28312 selftest: add a test that itime is not set when setting DOS attrs
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
2019-07-01 23:21:07 +00:00

40 lines
1.0 KiB
Bash
Executable File

#!/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