1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

s3: tests: Add a new test test_msdfs_hardlink() that does simple hardlinks on MSDFS root shares.

We pass this already as the cmd_hardlink in smbclient doesn't
do the DFS path conversion on the hardlink target. But it's
good to have the test.

Note we need to add the new test to "selftest/knownfail.d/smb1-tests"
as test_smbclient_s3.sh is run against the (ad_member|nt4_member)
environments first using NT1 (SMB1) protocol and then using SMB3,
but the (ad_member|nt4_member) environments don't support SMB1.
Seems a bit strange to me, but all the other SMB1 tests inside
test_smbclient_s3.sh have already been added to "selftest/knownfail.d/smb1-tests"
so just go with the test environment.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14169

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
(cherry picked from commit d7deb87605)
This commit is contained in:
Jeremy Allison 2022-02-03 13:58:28 -08:00 committed by Jule Anger
parent 9a4c688c2e
commit 6ef8465cf0
2 changed files with 49 additions and 0 deletions

View File

@ -29,6 +29,7 @@
^samba3.blackbox.smbclient_s3.NT1.(plain|sign).member_creds.volume\((ad_member|nt4_member)\)
^samba3.blackbox.smbclient_s3.NT1.(plain|sign).member_creds.delete a non empty directory\((ad_member|nt4_member)\)
^samba3.blackbox.smbclient_s3.NT1.(plain|sign).member_creds.Recursive ls across MS-DFS links\((ad_member|nt4_member)\)
^samba3.blackbox.smbclient_s3.NT1.(plain|sign).member_creds.Hardlink on MS-DFS share\((ad_member|nt4_member)\)
^samba3.blackbox.smbclient_s3.*valid.users.nt4.*
^samba3.blackbox.smbclient_s3.NT1.*valid.users.*
^samba3.unix.whoami machine account.whoami\(ad_member:local\)

View File

@ -438,6 +438,50 @@ EOF
return 0
}
# Test doing a normal file hardlink on an msdfs path.
test_msdfs_hardlink()
{
tmpfile="$PREFIX/smbclient.in.$$"
filename_src="src.$$"
filename_dst="dest.$$"
filename_src_path="$PREFIX/$filename_src"
rm -f "$filename_src_path"
touch "$filename_src_path"
cat > $tmpfile <<EOF
lcd $PREFIX
put $filename_src
hardlink $filename_src $filename_dst
del $filename_src
del $filename_dst
quit
EOF
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/msdfs-share -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
eval echo "$cmd"
out=`eval $cmd`
ret=$?
rm -f "$tmpfile"
rm -f "$filename_src_path"
if [ $ret != 0 ] ; then
echo "$out"
echo "failed hardlink $filename_src $filename_dst with error $ret"
return 1
fi
echo "$out" | grep "NT_STATUS" >/dev/null 2>&1
ret="$?"
if [ "$ret" -eq 0 ] ; then
echo "$out"
echo "hardlink $filename_src $filename_dst got NT_STATUS_ error"
return 1
fi
return 0
}
# Archive bits are correctly set on file/dir creation and rename.
test_rename_archive_bit()
{
@ -2025,6 +2069,10 @@ testit "Recursive ls across MS-DFS links" \
test_msdfs_recursive_dir || \
failed=`expr $failed + 1`
testit "Hardlink on MS-DFS share" \
test_msdfs_hardlink || \
failed=`expr $failed + 1`
testit "Ensure archive bit is set correctly on file/dir rename" \
test_rename_archive_bit || \
failed=`expr $failed + 1`