The branch, master has been updated via bd98e040d4a Update WHATSNEW.txt with removal of wildcard copy, rename and unlink. via 4ac91bd065c s3: smbd: Remove 'const char *src_original_lcomp' from reply_mv(). via 5190a8bd821 s3: smbd: Remove 'const char *src_original_lcomp' parameter from rename_internals(). via 7ac844ce92a s3: smbd: Inside rename_internals() remove '{ ... }' block around singleton rename code. via fe92aaa962a s3: smbd: Remove the commented out resolve_wildcards(). via ff722c0fdfb s3: smbd: Remove all wildcard code from rename_internals(). via 3cb5ef1c798 s3: smbd: Remove dest_has_wild and all associated code from rename_internals() via 885a982b9fd s3: smbd: Prepare to remove wildcard matching from rename_internals(). via de90620bec5 s3: smbd: In reply_ntrename() remove 'bool dest_has_wcard' and all uses. via f44fc91505a s3: smbd: In reply_ntrename(), never set dest_has_wcard. via e66148c8741 s3: smbd: In reply_ntrename() remove the UCF_ALWAYS_ALLOW_WCARD_LCOMP flag for destination lookups. via ff4bbb1279a s3: smbd: In SMBntrename (0xa5) prevent wildcards in destination name. via f67f25bcf02 s3: smbd: In smb_file_rename_information() (SMB_FILE_RENAME_INFORMATION info level) prevent destination wildcards. via 4cfe055ca7e s3: smbd: Remove UCF_ALWAYS_ALLOW_WCARD_LCOMP flag from pathname processing in reply_mv(). via 098d63a219c s3: smbd: Remove 'bool has_wild' parameter from unlink_internals(). via 42985702df0 s3: smbd: Change unlink_internals() to ignore has_wild parameter. via f46445cb6ae s3: smbd: In reply_unlink() remove the possibility of receiving a wildcard name. via 7f61ff777b1 s3: smbd: Remove support for SMBcopy SMB_COM_COPY (0x29) via d2aae105c61 s3: torture: Remove the wildcard unlink test code. via fb4e998346d s4: torture: Remove the wildcard rename test code. via 3c9a33ca346 s4: torture: Remove the wildcard unlink test code. via ef1d9d31bc3 s3: torture: In run_smb1_wild_mangle_unlink_test() use a valid pathname for rename target. via 78ee275c734 s3: torture: In torture_mangle(), use torture_deltree() for setup and cleanup. via 6cb9f127e1f s3: torture: In test_mask(), use torture_deltree() for setup. via 9398655cfdd s3: torture: In run_streamerror(), use torture_deltree() for setup. via 5a802ae2d31 s3: torture: In torture_chkpath_test(), use torture_deltree() for setup and cleanup. via 1eeabbf8401 s3: torture: In torture_casetable(), use torture_deltree() for setup and cleanup. via 498b3d923cd s3: torture: In torture_utable(), use torture_deltree() for setup. via 7ffc03d5e7d s3: torture: In run_smb1_wild_mangle_rename_test() use torture_deltree() for setup and cleanup. via 3a73178fe48 s3: torture: In run_smb1_wild_mangle_unlink_test() use torture_deltree() for setup and cleanup. via a0bfb37b4be s3: torture: Add torture_deltree() for setup and teardown. via 770d8375fca s4: libcli: smbcli_unlink() is no longer used with wildcard patterns. via 3a42b351364 s4: torture: Use smbcli_unlink_wcard() to setup and cleanup in masktest. via 367dc3cb597 s4: torture: Use smbcli_unlink_wcard() in base.casetable test. via c697ad1e389 s4: torture: Use smbcli_unlink_wcard() to cleanup in base.mangle test. via 78102894931 s4: torture: Use smbcli_unlink_wcard() to remove wildcards in base.chkpath test. via 35d8b146655 s4: torture: In raw.notify test use smbcli_unlink_wcard() in place of smbcli_unlink(). via 5b7ff5a9d00 s4: libcli: In smbcli_deltree() use smbcli_unlink_wcard() in place of smbcli_unlink(). via 3d0857c9ec2 s4: libcli: Add smbcli_unlink_wcard(). from e2b7a2f7811 s4-auth: Remove unused headers
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit bd98e040d4a4a24cc2be5bb9cfde5ebbe575ce52 Author: Jeremy Allison <j...@samba.org> Date: Tue Dec 7 10:25:38 2021 -0800 Update WHATSNEW.txt with removal of wildcard copy, rename and unlink. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> Autobuild-User(master): Ralph Böhme <s...@samba.org> Autobuild-Date(master): Thu Dec 9 18:57:15 UTC 2021 on sn-devel-184 commit 4ac91bd065cee699cdb4daeff719d02464d75326 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:40:55 2021 -0800 s3: smbd: Remove 'const char *src_original_lcomp' from reply_mv(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 5190a8bd8211f93b11409ae2ba5fbe365b1a8390 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:39:42 2021 -0800 s3: smbd: Remove 'const char *src_original_lcomp' parameter from rename_internals(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 7ac844ce92afe15354520dfcf0e090e6af5b951b Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:35:54 2021 -0800 s3: smbd: Inside rename_internals() remove '{ ... }' block around singleton rename code. Best viewed with 'git show -b' As we're touching the DEBUG() code, change it to modern DBG_NOTICE(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit fe92aaa962a61ac912b1cad4c7c6136785c11a9c Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:31:36 2021 -0800 s3: smbd: Remove the commented out resolve_wildcards(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit ff722c0fdfb2ce7691ff67349edd96b3c6c19d2a Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:29:43 2021 -0800 s3: smbd: Remove all wildcard code from rename_internals(). We no longer use resolve_wildcards() so comment it out for later removal. Keep the '{ ... }' block around the singleton rename for now, to keep the diff small. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3cb5ef1c7985c6a9a92cc854f9b23e5cc8af7eb7 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:26:28 2021 -0800 s3: smbd: Remove dest_has_wild and all associated code from rename_internals() Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 885a982b9fde950e80862c481ee711a9e16403b2 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:25:03 2021 -0800 s3: smbd: Prepare to remove wildcard matching from rename_internals(). src_has_wild and dest_has_wild can never be true. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit de90620bec55e26535917a8bacd71b1f115e1733 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:17:51 2021 -0800 s3: smbd: In reply_ntrename() remove 'bool dest_has_wcard' and all uses. It's always false now. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit f44fc91505a4e021ebf2bdaffac9944cd2cf8a01 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:14:57 2021 -0800 s3: smbd: In reply_ntrename(), never set dest_has_wcard. It can never be true. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit e66148c8741175bfb2f117ce2ff3a3aa4bf23946 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:12:46 2021 -0800 s3: smbd: In reply_ntrename() remove the UCF_ALWAYS_ALLOW_WCARD_LCOMP flag for destination lookups. We know the destination will never be a wildcard. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit ff4bbb1279a383ae0965601d89a6fb41d3cdd9c4 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:08:13 2021 -0800 s3: smbd: In SMBntrename (0xa5) prevent wildcards in destination name. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit f67f25bcf02d82f04742eef213235e0136d875ef Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 16:07:07 2021 -0800 s3: smbd: In smb_file_rename_information() (SMB_FILE_RENAME_INFORMATION info level) prevent destination wildcards. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 4cfe055ca7e5428cf2e616039ceb065708db3af2 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 13:56:31 2021 -0800 s3: smbd: Remove UCF_ALWAYS_ALLOW_WCARD_LCOMP flag from pathname processing in reply_mv(). We are no longer supporting wildcard rename via SMBmv (0x7) as WindowsXP SMB1 and above do not use it. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 098d63a219c3db0406fecca853ea1798cf50cb1b Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 13:03:03 2021 -0800 s3: smbd: Remove 'bool has_wild' parameter from unlink_internals(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 42985702df0485208fc46117ea73622f1a9e4a26 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 12:53:29 2021 -0800 s3: smbd: Change unlink_internals() to ignore has_wild parameter. It's always passed as false now so we can remove the (horrible) enumeration code for unlink. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit f46445cb6ae81d17a423da9ef0b2703ae755d191 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 12:31:44 2021 -0800 s3: smbd: In reply_unlink() remove the possibility of receiving a wildcard name. This was the only user of "has_wild=true" passed to unlink_internals(). Next commit will remove this functionality from unlink_internals(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 7f61ff777b1dafb757794e256fb9d3a52dfb7e24 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 12:24:07 2021 -0800 s3: smbd: Remove support for SMBcopy SMB_COM_COPY (0x29) It's not used in our client code or tested. From MS-CIFS. This command was introduced in the LAN Manager 1.0 dialect It was rendered obsolete in the NT LAN Manager dialect. This command was used to perform server-side file copies, but is no longer used. Clients SHOULD NOT send requests using this command code. Servers receiving requests with this command code SHOULD return STATUS_NOT_IMPLEMENTED (ERRDOS/ERRbadfunc). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit d2aae105c610e263f53eb502822d6de65bb7a733 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 12:18:35 2021 -0800 s3: torture: Remove the wildcard unlink test code. This is pre WindowXP SMB1 functionality, and we need to remove this from the server in order to move towards SMB2-only, so the test must go. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit fb4e998346db1bbaa7c6be7edbba17b9b07f5765 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 13:22:39 2021 -0800 s4: torture: Remove the wildcard rename test code. This is pre WindowXP SMB1 functionality, and we need to remove this from the server in order to move towards SMB2-only, so the test must go. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3c9a33ca3463ab010e24430a1743f4669c70a75f Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 12:05:20 2021 -0800 s4: torture: Remove the wildcard unlink test code. This is pre WindowXP SMB1 functionality, and we need to remove this from the server in order to move towards SMB2-only, so the test must go. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit ef1d9d31bc3bf620c549a1c609e2ce99ceacff43 Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:10:41 2021 -0800 s3: torture: In run_smb1_wild_mangle_unlink_test() use a valid pathname for rename target. The server will not be supporting wildcard rename soon. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 78ee275c7347440748995e94e0c064ac30e8b3c7 Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:21:47 2021 -0800 s3: torture: In torture_mangle(), use torture_deltree() for setup and cleanup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 6cb9f127e1fcec2cef42eafa92d085e5fdfe0230 Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:20:07 2021 -0800 s3: torture: In test_mask(), use torture_deltree() for setup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 9398655cfddb2f4a3f2c8243b6c0f48f36bad14f Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:18:56 2021 -0800 s3: torture: In run_streamerror(), use torture_deltree() for setup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 5a802ae2d314e3a8558894f516f61ecf85a256aa Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:16:38 2021 -0800 s3: torture: In torture_chkpath_test(), use torture_deltree() for setup and cleanup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 1eeabbf8401b576b96723dd714d6993b096f6ed3 Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:14:53 2021 -0800 s3: torture: In torture_casetable(), use torture_deltree() for setup and cleanup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 498b3d923cd74b1190f4ab7dcaa9f9b04ddba6fd Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:13:41 2021 -0800 s3: torture: In torture_utable(), use torture_deltree() for setup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 7ffc03d5e7d517957fcf4fe26d7ba423ef02a306 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 13:51:12 2021 -0800 s3: torture: In run_smb1_wild_mangle_rename_test() use torture_deltree() for setup and cleanup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3a73178fe48efd0f98da49547941dd0ac052f715 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 12:51:54 2021 -0800 s3: torture: In run_smb1_wild_mangle_unlink_test() use torture_deltree() for setup and cleanup. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit a0bfb37b4beb74bdb3f95e491efcd1806069a154 Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 13:47:07 2021 -0800 s3: torture: Add torture_deltree() for setup and teardown. Not yet used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 770d8375fca47fa2312d25ae4deb52b6b2346aff Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 14:23:10 2021 -0800 s4: libcli: smbcli_unlink() is no longer used with wildcard patterns. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3a42b35136437b8bbb2f1473ecb2dfdee13bbbb9 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 18:08:32 2021 -0800 s4: torture: Use smbcli_unlink_wcard() to setup and cleanup in masktest. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 367dc3cb59793babc393e842c610b45b42016454 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 18:03:57 2021 -0800 s4: torture: Use smbcli_unlink_wcard() in base.casetable test. Avoid smbcli_unlink() calls with a wildcard path. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit c697ad1e389ab8c282b44961c6fa224e45759d30 Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 17:58:58 2021 -0800 s4: torture: Use smbcli_unlink_wcard() to cleanup in base.mangle test. Avoid using smbcli_unlink() calls with wildcard names. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 781028949318d808836738c8f8067c718aa24a6f Author: Jeremy Allison <j...@samba.org> Date: Wed Dec 1 17:52:37 2021 -0800 s4: torture: Use smbcli_unlink_wcard() to remove wildcards in base.chkpath test. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 35d8b1466551ebe78346265899f130b1c60ae098 Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 12:08:49 2021 -0800 s4: torture: In raw.notify test use smbcli_unlink_wcard() in place of smbcli_unlink(). We know we have a wildcard mask here. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 5b7ff5a9d0028d1ea8d22f88c410e73557f214e2 Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 12:10:14 2021 -0800 s4: libcli: In smbcli_deltree() use smbcli_unlink_wcard() in place of smbcli_unlink(). We know we have a wildcard mask here. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3d0857c9ec2c99636a44da927b6ccbb8eff9a9de Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 12:05:51 2021 -0800 s4: libcli: Add smbcli_unlink_wcard(). We will use this in place of smbcli_unlink() when we know we are using a wildcard pattern. If can be used to generally replace smbcli_unlink() as it calls down to smbcli_unlink() is no wildcard is detected. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> ----------------------------------------------------------------------- Summary of changes: WHATSNEW.txt | 16 + selftest/todo_smb2_tests_to_port.list | 2 - source3/printing/nt_printing.c | 2 +- source3/selftest/tests.py | 2 +- source3/smbd/nttrans.c | 50 +- source3/smbd/proto.h | 4 +- source3/smbd/reply.c | 1240 ++++----------------------------- source3/smbd/trans2.c | 7 +- source3/torture/mangle_test.c | 9 +- source3/torture/masktest.c | 3 +- source3/torture/proto.h | 1 + source3/torture/torture.c | 229 +++--- source3/torture/utable.c | 8 +- source4/libcli/clideltree.c | 2 +- source4/libcli/clifile.c | 100 ++- source4/libcli/libcli.h | 5 + source4/torture/basic/base.c | 4 +- source4/torture/basic/mangle_test.c | 2 +- source4/torture/basic/utable.c | 2 +- source4/torture/masktest.c | 2 +- source4/torture/raw/notify.c | 2 +- source4/torture/raw/rename.c | 33 - source4/torture/raw/unlink.c | 72 -- 23 files changed, 426 insertions(+), 1371 deletions(-) Changeset truncated at 500 lines: diff --git a/WHATSNEW.txt b/WHATSNEW.txt index 73cbe8d0392..4271539e703 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -41,6 +41,22 @@ are not affected, as the default port is 53. REMOVED FEATURES ================ +SMB1 CORE and LANMAN1 protocol wildcard copy, unlink and rename removed +======================================================================= + +In preparation for the removal of the SMB1 server, the unused +SMB1 command SMB_COM_COPY (SMB1 command number 0x29) has been +removed from the Samba smbd server. In addition, the ability +to process file name wildcards in requests using the SMB1 commands +SMB_COM_COPY (SMB1 command number 0x2A), SMB_COM_RENAME (SMB1 command +number 0x7), SMB_COM_NT_RENAME (SMB1 command number 0xA5) and +SMB_COM_DELETE (SMB1 command number 0x6) have been removed. + +This only affects clients using MS-DOS based versions of +SMB1, the last release of which was Windows 98. Users requiring +support for these features will need to use older versions +of Samba. + No longer using Linux mandatory locks for sharemodes ==================================================== diff --git a/selftest/todo_smb2_tests_to_port.list b/selftest/todo_smb2_tests_to_port.list index a9d7b8b48c5..dc1df963918 100644 --- a/selftest/todo_smb2_tests_to_port.list +++ b/selftest/todo_smb2_tests_to_port.list @@ -242,7 +242,6 @@ samba3.smbtorture_s3.crypt_client.TRANS2(nt4_dc_smb1) samba3.smbtorture_s3.crypt_client.UID-REGRESSION-TEST(nt4_dc_smb1) samba3.smbtorture_s3.crypt_client.UNLINK(nt4_dc_smb1) samba3.smbtorture_s3.crypt_client.W2K(nt4_dc_smb1) -samba3.smbtorture_s3.crypt_client.WILDDELETE(nt4_dc_smb1) samba3.smbtorture_s3.crypt_client.XCOPY(nt4_dc_smb1) samba3.smbtorture_s3.crypt.POSIX-ACL-OPLOCK(nt4_dc_smb1) samba3.smbtorture_s3.crypt.POSIX-ACL-SHAREROOT(nt4_dc_smb1) @@ -327,7 +326,6 @@ samba3.smbtorture_s3.plain.TRANS2(fileserver_smb1) samba3.smbtorture_s3.plain.UID-REGRESSION-TEST(fileserver_smb1) samba3.smbtorture_s3.plain.UNLINK(fileserver_smb1) samba3.smbtorture_s3.plain.W2K(fileserver_smb1) -samba3.smbtorture_s3.plain.WILDDELETE(fileserver_smb1) samba3.smbtorture_s3.plain.WINDOWS-BAD-SYMLINK(nt4_dc_smb1) samba3.smbtorture_s3.plain.XCOPY(fileserver_smb1) samba3.smbtorture_s3.vfs_aio_fork(fileserver_smb1).RW1(fileserver_smb1) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index b172ed92c6e..a47afda4a84 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -2042,7 +2042,7 @@ static NTSTATUS driver_unlink_internals(connection_struct *conn, goto err_out; } - status = unlink_internals(conn, NULL, 0, smb_fname, false); + status = unlink_internals(conn, NULL, 0, smb_fname); err_out: talloc_free(tmp_ctx); return status; diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index f4319959353..1b4466cc33b 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -113,7 +113,7 @@ fileserver_tests = [ "UNLINK", "BROWSE", "ATTR", "TRANS2", "TORTURE", "OPLOCK1", "OPLOCK2", "OPLOCK4", "STREAMERROR", "DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "LARGE_READX", "RW-SIGNING", - "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "WILDDELETE", "PROPERTIES", "W2K", + "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "PROPERTIES", "W2K", "TCON2", "IOCTL", "CHKPATH", "FDSESS", "CHAIN1", "CHAIN2", "OWNER-RIGHTS", "CHAIN3", "PIDHIGH", "CLI_SPLICE", "UID-REGRESSION-TEST", "SHORTNAME-TEST", diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index f381714e129..6db17b8c685 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1732,7 +1732,6 @@ void reply_ntrename(struct smb_request *req) const char *dst_original_lcomp = NULL; const char *p; NTSTATUS status; - bool dest_has_wcard = False; uint32_t attrs; uint32_t ucf_flags_src = ucf_flags_from_smb_request(req); uint32_t ucf_flags_dst = ucf_flags_from_smb_request(req); @@ -1771,6 +1770,11 @@ void reply_ntrename(struct smb_request *req) goto out; } + if (!req->posix_pathnames && ms_has_wild(newname)) { + reply_nterror(req, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); + goto out; + } + if (!req->posix_pathnames) { /* The newname must begin with a ':' if the oldname contains a ':'. */ @@ -1783,14 +1787,6 @@ void reply_ntrename(struct smb_request *req) } } - /* - * If this is a rename operation, allow wildcards and save the - * destination's last component. - */ - if (rename_type == RENAME_FLAG_RENAME) { - ucf_flags_dst |= UCF_ALWAYS_ALLOW_WCARD_LCOMP; - } - /* rename_internals() calls unix_convert(), so don't call it here. */ status = filename_convert(ctx, conn, oldname, @@ -1819,10 +1815,6 @@ void reply_ntrename(struct smb_request *req) goto out; } - if (!req->posix_pathnames) { - dest_has_wcard = ms_has_wild(dst_original_lcomp); - } - status = filename_convert(ctx, conn, newname, ucf_flags_dst, @@ -1861,7 +1853,6 @@ void reply_ntrename(struct smb_request *req) conn, req, smb_fname_old, - NULL, smb_fname_new, dst_original_lcomp, attrs, @@ -1869,27 +1860,20 @@ void reply_ntrename(struct smb_request *req) DELETE_ACCESS); break; case RENAME_FLAG_HARD_LINK: - if (dest_has_wcard) { - /* No wildcards. */ - status = NT_STATUS_OBJECT_PATH_SYNTAX_BAD; - } else { - status = hardlink_internals(ctx, conn, - req, - false, - smb_fname_old, - smb_fname_new); - } + status = hardlink_internals(ctx, + conn, + req, + false, + smb_fname_old, + smb_fname_new); break; case RENAME_FLAG_COPY: - if (dest_has_wcard) { - /* No wildcards. */ - status = NT_STATUS_OBJECT_PATH_SYNTAX_BAD; - } else { - status = copy_internals(ctx, conn, req, - smb_fname_old, - smb_fname_new, - attrs); - } + status = copy_internals(ctx, + conn, + req, + smb_fname_old, + smb_fname_new, + attrs); break; case RENAME_FLAG_MOVE_CLUSTER_INFORMATION: status = NT_STATUS_INVALID_PARAMETER; diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index ea86515a925..bc981c037b9 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -991,8 +991,7 @@ void reply_ctemp(struct smb_request *req); NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, uint32_t dirtype, - struct smb_filename *smb_fname, - bool has_wcard); + struct smb_filename *smb_fname); void reply_unlink(struct smb_request *req); ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp, off_t startpos, size_t nread); @@ -1038,7 +1037,6 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, connection_struct *conn, struct smb_request *req, struct smb_filename *smb_fname_src, - const char *src_original_lcomp, struct smb_filename *smb_fname_dst, const char *dst_original_lcomp, uint32_t attrs, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index b0101f667a8..b3b0ade839a 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3279,16 +3279,13 @@ static NTSTATUS do_unlink(connection_struct *conn, NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, uint32_t dirtype, - struct smb_filename *smb_fname, - bool has_wild) + struct smb_filename *smb_fname) { char *fname_dir = NULL; char *fname_mask = NULL; - int count=0; NTSTATUS status = NT_STATUS_OK; struct smb_filename *smb_fname_dir = NULL; TALLOC_CTX *ctx = talloc_tos(); - int ret; bool posix_pathname = (smb_fname->flags & SMB_FILENAME_POSIX_PATH); /* Split up the directory from the filename/mask. */ @@ -3319,212 +3316,37 @@ NTSTATUS unlink_internals(connection_struct *conn, } } - if (!has_wild) { - - /* - * Only one file needs to be unlinked. Append the mask back - * onto the directory. - */ - TALLOC_FREE(smb_fname->base_name); - if (ISDOT(fname_dir)) { - /* Ensure we use canonical names on open. */ - smb_fname->base_name = talloc_asprintf(smb_fname, - "%s", - fname_mask); - } else { - smb_fname->base_name = talloc_asprintf(smb_fname, - "%s/%s", - fname_dir, - fname_mask); - } - if (!smb_fname->base_name) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - if (dirtype == 0) { - dirtype = FILE_ATTRIBUTE_NORMAL; - } - - status = check_name(conn, smb_fname); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - status = do_unlink(conn, req, smb_fname, dirtype); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - count++; + /* + * Only one file needs to be unlinked. Append the mask back + * onto the directory. + */ + TALLOC_FREE(smb_fname->base_name); + if (ISDOT(fname_dir)) { + /* Ensure we use canonical names on open. */ + smb_fname->base_name = talloc_asprintf(smb_fname, + "%s", + fname_mask); } else { - struct smb_Dir *dir_hnd = NULL; - long offset = 0; - const char *dname = NULL; - char *talloced = NULL; - bool case_sensitive = - (smb_fname->flags & SMB_FILENAME_POSIX_PATH) ? - true : conn->case_sensitive; - - if ((dirtype & SAMBA_ATTRIBUTES_MASK) == FILE_ATTRIBUTE_DIRECTORY) { - status = NT_STATUS_OBJECT_NAME_INVALID; - goto out; - } - if (dirtype == 0) { - dirtype = FILE_ATTRIBUTE_NORMAL; - } - - if (strequal(fname_mask,"????????.???")) { - TALLOC_FREE(fname_mask); - fname_mask = talloc_strdup(ctx, "*"); - if (!fname_mask) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - } - - smb_fname_dir = synthetic_smb_fname(talloc_tos(), - fname_dir, - NULL, - NULL, - smb_fname->twrp, - smb_fname->flags); - if (smb_fname_dir == NULL) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - - status = check_name(conn, smb_fname_dir); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - dir_hnd = OpenDir(talloc_tos(), conn, smb_fname_dir, fname_mask, - dirtype); - if (dir_hnd == NULL) { - status = map_nt_error_from_unix(errno); - goto out; - } - - /* XXXX the CIFS spec says that if bit0 of the flags2 field is set then - the pattern matches against the long name, otherwise the short name - We don't implement this yet XXXX - */ - - status = NT_STATUS_NO_SUCH_FILE; - - while ((dname = ReadDirName(dir_hnd, &offset, - &smb_fname->st, &talloced))) { - TALLOC_CTX *frame = talloc_stackframe(); - char *p = NULL; - struct smb_filename *f = NULL; - - /* Quick check for "." and ".." */ - if (ISDOT(dname) || ISDOTDOT(dname)) { - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - continue; - } - - if (IS_VETO_PATH(conn, dname)) { - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - continue; - } - - if(!mask_match(dname, fname_mask, - case_sensitive)) { - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - continue; - } - - if (ISDOT(fname_dir)) { - /* Ensure we use canonical names on open. */ - p = talloc_asprintf(smb_fname, "%s", dname); - } else { - p = talloc_asprintf(smb_fname, "%s/%s", - fname_dir, dname); - } - if (p == NULL) { - TALLOC_FREE(dir_hnd); - status = NT_STATUS_NO_MEMORY; - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - goto out; - } - f = synthetic_smb_fname(frame, - p, - NULL, - &smb_fname->st, - smb_fname->twrp, - smb_fname->flags); - if (f == NULL) { - TALLOC_FREE(dir_hnd); - status = NT_STATUS_NO_MEMORY; - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - goto out; - } - - ret = vfs_stat(conn, f); - if (ret != 0) { - status = map_nt_error_from_unix(errno); - TALLOC_FREE(dir_hnd); - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - goto out; - } - - status = openat_pathref_fsp(conn->cwd_fsp, f); - if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND) && - (f->flags & SMB_FILENAME_POSIX_PATH) && - S_ISLNK(f->st.st_ex_mode)) - { - status = NT_STATUS_OK; - } - if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(dir_hnd); - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - goto out; - } - - if (!is_visible_fsp(f->fsp)) { - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - continue; - } - - status = check_name(conn, f); - if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(dir_hnd); - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - goto out; - } - - status = do_unlink(conn, req, f, dirtype); - if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(dir_hnd); - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - goto out; - } - - count++; - DBG_DEBUG("successful unlink [%s]\n", - smb_fname_str_dbg(f)); - - TALLOC_FREE(frame); - TALLOC_FREE(talloced); - } - TALLOC_FREE(dir_hnd); + smb_fname->base_name = talloc_asprintf(smb_fname, + "%s/%s", + fname_dir, + fname_mask); + } + if (!smb_fname->base_name) { + status = NT_STATUS_NO_MEMORY; + goto out; + } + if (dirtype == 0) { + dirtype = FILE_ATTRIBUTE_NORMAL; } - if (count == 0 && NT_STATUS_IS_OK(status) && errno != 0) { - status = map_nt_error_from_unix(errno); + status = check_name(conn, smb_fname); + if (!NT_STATUS_IS_OK(status)) { + goto out; } + status = do_unlink(conn, req, smb_fname, dirtype); + out: TALLOC_FREE(smb_fname_dir); TALLOC_FREE(fname_dir); @@ -3543,10 +3365,8 @@ void reply_unlink(struct smb_request *req) struct smb_filename *smb_fname = NULL; uint32_t dirtype; NTSTATUS status; - uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP | - ucf_flags_from_smb_request(req); + uint32_t ucf_flags = ucf_flags_from_smb_request(req); TALLOC_CTX *ctx = talloc_tos(); - bool has_wild = false; START_PROFILE(SMBunlink); @@ -3579,22 +3399,9 @@ void reply_unlink(struct smb_request *req) goto out; } - if (!req->posix_pathnames) { - char *lcomp = get_original_lcomp(ctx, - conn, - name, - ucf_flags); - if (lcomp == NULL) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - goto out; - } - has_wild = ms_has_wild(lcomp); - TALLOC_FREE(lcomp); - } - DEBUG(3,("reply_unlink : %s\n", smb_fname_str_dbg(smb_fname))); - status = unlink_internals(conn, req, dirtype, smb_fname, has_wild); + status = unlink_internals(conn, req, dirtype, smb_fname); if (!NT_STATUS_IS_OK(status)) { if (open_was_deferred(req->xconn, req->mid)) { /* We have re-scheduled this call. */ @@ -7255,133 +7062,6 @@ void reply_rmdir(struct smb_request *req) return; } -/******************************************************************* - Resolve wildcards in a filename rename. -********************************************************************/ - -static bool resolve_wildcards(TALLOC_CTX *ctx, - const char *name1, -- Samba Shared Repository