mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3: tests: Add a new test test_msdfs_rename() that does simple renames on MSDFS root shares.
We fail this on SMB2 for a subtle reason. Our client code called from smbclient only sets the SMB2_HDR_FLAG_DFS flag in the outgoing packet on the SMB2_CREATE call, and SMB2 rename does the following operations: SMB2_CREATE(src_path) // We set SMB2_HDR_FLAG_DFS here for a MSDFS share. SMB2_SETINFO: SMB2_FILE_RENAME_INFO(dst_path). // We don't set SMB2_HDR_FLAG_DFS However, from smbclient, dst_path is a MSDFS path but we don't set the flag, so even though the rename code inside smbd will cope with a MSDFS path (as used in the SMB1 SMBmv call) it fails as the correct flag isn't set. Add knownfail selftest/knownfail.d/msdfs-rename. 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>
This commit is contained in:
parent
d7deb87605
commit
44cc9fb0e0
1
selftest/knownfail.d/msdfs-rename
Normal file
1
selftest/knownfail.d/msdfs-rename
Normal file
@ -0,0 +1 @@
|
||||
^samba3.blackbox.smbclient_s3.SMB3.*.Rename\ on\ MS-DFS\ share\(.*\)
|
@ -30,6 +30,7 @@
|
||||
^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.NT1.(plain|sign).member_creds.Rename 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\)
|
||||
|
@ -438,6 +438,53 @@ EOF
|
||||
return 0
|
||||
}
|
||||
|
||||
# Test doing a normal file rename on an msdfs path.
|
||||
test_msdfs_rename()
|
||||
{
|
||||
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"
|
||||
|
||||
#
|
||||
# Use both non-force and force rename to
|
||||
# ensure we test both codepaths inside libsmb.
|
||||
#
|
||||
cat > $tmpfile <<EOF
|
||||
lcd $PREFIX
|
||||
put $filename_src
|
||||
ren $filename_src $filename_dst -f
|
||||
ren $filename_dst $filename_src
|
||||
del $filename_src
|
||||
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 renaming $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 "renaming $filename_src $filename_dst got NT_STATUS_ error"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Test doing a normal file hardlink on an msdfs path.
|
||||
test_msdfs_hardlink()
|
||||
{
|
||||
@ -2057,6 +2104,10 @@ testit "Recursive ls across MS-DFS links" \
|
||||
test_msdfs_recursive_dir || \
|
||||
failed=`expr $failed + 1`
|
||||
|
||||
testit "Rename on MS-DFS share" \
|
||||
test_msdfs_rename || \
|
||||
failed=`expr $failed + 1`
|
||||
|
||||
testit "Hardlink on MS-DFS share" \
|
||||
test_msdfs_hardlink || \
|
||||
failed=`expr $failed + 1`
|
||||
|
Loading…
Reference in New Issue
Block a user