The branch, master has been updated via 63a4e883582 smbd: split out POSIX info_levels from smbd_do_setfilepathinfo() into own function via 537069b6e05 smbd: mark UCF_UNIX_NAME_LOOKUP as unused via df92b06f5be smbd: remove use of UCF_UNIX_NAME_LOOKUP via 29e212dd6a4 smbd: use UCF_POSIX_PATHNAMES flag for path validation logic in filename_convert_internal() via 71a57596239 smbd: base POSIX semantics of call_trans2findfirst() on SMB_FILENAME_POSIX_PATH flag via 2e5e49e41dc smbd: let directory entries inherit the smb_fname->flags from the directory via 42b8a431f04 smbd: base POSIX semantics in call_trans2findfirst() on req->posix_pathnames via 0d6d53a9209 vfs_default: allow dirfsps in the link VFS functions via 5161edbdb28 selftest: remove POSIX test from planned tests for ad_dc_ntvfs environ via 219a44ee5ff vfs_streams_depot: only assert AT_FDCWD for streams via ac45ce0227d vfs_streams_xattr: only assert AT_FDCWD for streams via 3caf53a0546 smbd: fix order of smb_fname flags and twrp args in call_trans2findfirst() via 3df5f851c67 smbd: fix order of smb_fname flags and twrp args in unlink_internals() via c4cbe0610cf vfs: make dirfsp arg to SMB_VFS_READLINKAT() const from 54b4d2d3cb3 wb_sids2xids: defer/skip wb_lookupsids* unless we get ID_TYPE_WB_REQUIRE_TYPE
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 63a4e8835824f0f0696223c0a3b0afb207595078 Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 22 12:26:17 2020 +0200 smbd: split out POSIX info_levels from smbd_do_setfilepathinfo() into own function smbd_do_setfilepathinfo() can be made fully handle based for all non-POSIX infolevels with pathref fsps, but for a POSIX create we may not have a fsp if the path points at a symlink. Splitting the POSIX from the non-POSIX logic allows for cleaner handling of this in the future with pathref fsps. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Ralph Böhme <s...@samba.org> Autobuild-Date(master): Fri Oct 23 09:19:12 UTC 2020 on sn-devel-184 commit 537069b6e05fafbf7103405e755d8bbb69eafdae Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 22 11:12:11 2020 +0200 smbd: mark UCF_UNIX_NAME_LOOKUP as unused Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit df92b06f5beba89d1394bb38f6ab6d354cfc88e2 Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 22 11:10:32 2020 +0200 smbd: remove use of UCF_UNIX_NAME_LOOKUP This is now handled by SMB_FILENAME_POSIX_PATH. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 29e212dd6a46a5e69ee3ae4ee1a444cf606b0f9e Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 22 11:04:59 2020 +0200 smbd: use UCF_POSIX_PATHNAMES flag for path validation logic in filename_convert_internal() This change means that if a client path is a symlink, we *always* only call check_veto_path() for POSIX clients using a POSIX pathname, not just when a POSIX info-level was used in an SMB request. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 71a57596239e0c9ff307235e4777ffe2bcf92004 Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 15 19:50:14 2020 +0200 smbd: base POSIX semantics of call_trans2findfirst() on SMB_FILENAME_POSIX_PATH flag We really want to apply POSIX semantics in this place whenever the client has enabled UNIX extensions, not only when using UNIX find info-levels. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2e5e49e41dc9c4f134db7c98c244237ea3c403cf Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 15 19:45:21 2020 +0200 smbd: let directory entries inherit the smb_fname->flags from the directory If the listed directory has SMB_FILENAME_POSIX_PATH set, this change causes the smb_fname of directory entries to inherit the flag so subsequent operations on the directory entry can correctly implement POSIX semantics. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 42b8a431f04afcd487d3c4c6280ccce06359b508 Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 15 10:27:23 2020 +0200 smbd: base POSIX semantics in call_trans2findfirst() on req->posix_pathnames This will require a SMB1 client to enable SMB1 POSIX extensions, just sending POSIX info-level requests without first enabling them won't cut it. As discussed with Jeremy, SMB1 POSIX extensions is a global thing and the client that wants to use it is expected to enable them explicitly before making use of POSIX info-levels. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0d6d53a9209715fb019000f253d79d718fa7c026 Author: Ralph Boehme <s...@samba.org> Date: Wed Oct 14 15:34:55 2020 +0200 vfs_default: allow dirfsps in the link VFS functions The functions work just fine with real dirfsps. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5161edbdb28fcfe44abac8c0caf5ad592c638405 Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 15 15:45:06 2020 +0200 selftest: remove POSIX test from planned tests for ad_dc_ntvfs environ Just don't run the tests instead of retrofitting them to the skiplist. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 219a44ee5fff168c40c0f26b29a54453c3017674 Author: Ralph Boehme <s...@samba.org> Date: Sat Oct 17 17:00:53 2020 +0200 vfs_streams_depot: only assert AT_FDCWD for streams Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ac45ce0227d0bdc704b95f650b57da0bdb651251 Author: Ralph Boehme <s...@samba.org> Date: Sat Oct 17 16:59:55 2020 +0200 vfs_streams_xattr: only assert AT_FDCWD for streams Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3caf53a0546a1e05bd1ce7e07b987585ebe0ad71 Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 15 19:49:24 2020 +0200 smbd: fix order of smb_fname flags and twrp args in call_trans2findfirst() Also not creating a BUG for this one as I've not seen any reports from the field that this is causing issues. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3df5f851c67fcbac01a214ede9bffd3e20231de3 Author: Ralph Boehme <s...@samba.org> Date: Thu Oct 15 19:48:42 2020 +0200 smbd: fix order of smb_fname flags and twrp args in unlink_internals() As snapshots are read-only by design, this bug was likely not a real issue so I'm not creating a BUG for this. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c4cbe0610cfa275581332c156963301e8c6d013b Author: Ralph Boehme <s...@samba.org> Date: Tue Oct 13 15:19:30 2020 +0200 vfs: make dirfsp arg to SMB_VFS_READLINKAT() const Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: examples/VFS/skel_opaque.c | 2 +- examples/VFS/skel_transparent.c | 2 +- selftest/knownfail.d/samba3.smbtorture_s3 | 2 + selftest/skip | 11 -- source3/include/vfs.h | 7 +- source3/modules/vfs_cap.c | 2 +- source3/modules/vfs_ceph.c | 2 +- source3/modules/vfs_ceph_snapshots.c | 2 +- source3/modules/vfs_default.c | 11 +- source3/modules/vfs_expand_msdfs.c | 2 +- source3/modules/vfs_full_audit.c | 2 +- source3/modules/vfs_glusterfs.c | 2 +- source3/modules/vfs_media_harmony.c | 2 +- source3/modules/vfs_not_implemented.c | 2 +- source3/modules/vfs_shadow_copy2.c | 2 +- source3/modules/vfs_snapper.c | 2 +- source3/modules/vfs_streams_depot.c | 10 +- source3/modules/vfs_streams_xattr.c | 10 +- source3/modules/vfs_time_audit.c | 2 +- source3/modules/vfs_unityed_media.c | 2 +- source3/selftest/tests.py | 1 - source3/smbd/dir.c | 1 + source3/smbd/filename.c | 7 +- source3/smbd/reply.c | 12 +- source3/smbd/smbd.h | 2 +- source3/smbd/trans2.c | 294 +++++++++++++++++------------- source3/smbd/vfs.c | 2 +- 27 files changed, 207 insertions(+), 191 deletions(-) create mode 100644 selftest/knownfail.d/samba3.smbtorture_s3 Changeset truncated at 500 lines: diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 90ee82ab258..2a3a7301bdb 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -474,7 +474,7 @@ static int skel_symlinkat(vfs_handle_struct *handle, } static int skel_vfs_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index d48ac47443b..a86b3e7cd19 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -600,7 +600,7 @@ static int skel_symlinkat(vfs_handle_struct *handle, } static int skel_vfs_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/selftest/knownfail.d/samba3.smbtorture_s3 b/selftest/knownfail.d/samba3.smbtorture_s3 new file mode 100644 index 00000000000..f56cf2327e9 --- /dev/null +++ b/selftest/knownfail.d/samba3.smbtorture_s3 @@ -0,0 +1,2 @@ +^samba3.smbtorture_s3.plain.POSIX-LS-WILDCARD.smbtorture\(nt4_dc_smb1\) +^samba3.smbtorture_s3.crypt.POSIX-LS-WILDCARD.smbtorture\(nt4_dc_smb1\) diff --git a/selftest/skip b/selftest/skip index 5bdc10648da..454f8bde33a 100644 --- a/selftest/skip +++ b/selftest/skip @@ -40,19 +40,8 @@ ^samba3.smbtorture_s3.plain.DIR1\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server ^samba3.smbtorture_s3.plain.DIR-CREATETIME\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server ^samba3.smbtorture_s3.plain.DELETE-LN\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server ^samba3.smbtorture_s3.plain.UID-REGRESSION-TEST\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server ^samba3.smbtorture_s3.plain.SHORTNAME-TEST\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-APPEND\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-SYMLINK-ACL\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-SYMLINK-EA\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-OFD-LOCK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-STREAM-DELETE\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-MKDIR\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-ACL-OPLOCK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-ACL-SHAREROOT\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.POSIX-BLOCKING-LOCK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server -^samba3.smbtorture_s3.plain.WINDOWS-BAD-SYMLINK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server ^samba3.smbtorture_s3.plain.RENAME-ACCESS\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server ^samba3.smbtorture_s3.plain.OWNER-RIGHTS\(ad_dc_ntvfs\) # Don't test against the s4 ntvfs server anymore ^samba3.smbtorture_s3.plain.PIDHIGH\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server diff --git a/source3/include/vfs.h b/source3/include/vfs.h index b282e2a361b..22c139607e2 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -330,6 +330,7 @@ * Change to Version 44 - will ship with 4.14. * Version 44 - Remove dirfsp arg from struct files_struct * Version 44 - Remove dirfsp arg to SMB_VFS_CREATE_FILE() + * Version 44 - Make dirfsp arg to SMB_VFS_READLINKAT() const */ #define SMB_VFS_INTERFACE_VERSION 44 @@ -863,7 +864,7 @@ struct vfs_fn_pointers { struct files_struct *dirfsp, const struct smb_filename *new_smb_fname); int (*readlinkat_fn)(struct vfs_handle_struct *handle, - struct files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz); @@ -1407,7 +1408,7 @@ int smb_vfs_call_symlinkat(struct vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *new_smb_fname); int smb_vfs_call_readlinkat(struct vfs_handle_struct *handle, - struct files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz); @@ -1853,7 +1854,7 @@ int vfs_not_implemented_symlinkat(vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *new_smb_fname); int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle, - struct files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz); diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 93f0454c608..5deb7754f02 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -519,7 +519,7 @@ static int cap_symlinkat(vfs_handle_struct *handle, } static int cap_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index a87d162e573..546502eb88f 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1051,7 +1051,7 @@ static int cephwrap_symlinkat(struct vfs_handle_struct *handle, } static int cephwrap_readlinkat(struct vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 9ff5b9de074..80dfb48c201 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -1023,7 +1023,7 @@ static int ceph_snap_gmt_ntimes(vfs_handle_struct *handle, } static int ceph_snap_gmt_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *csmb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 49e92ffea55..7ea9b716e21 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2873,8 +2873,6 @@ static int vfswrap_symlinkat(vfs_handle_struct *handle, START_PROFILE(syscall_symlinkat); - SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); - result = symlinkat(link_target->base_name, dirfsp->fh->fd, new_smb_fname->base_name); @@ -2883,7 +2881,7 @@ static int vfswrap_symlinkat(vfs_handle_struct *handle, } static int vfswrap_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) @@ -2892,8 +2890,6 @@ static int vfswrap_readlinkat(vfs_handle_struct *handle, START_PROFILE(syscall_readlinkat); - SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); - result = readlinkat(dirfsp->fh->fd, smb_fname->base_name, buf, @@ -2914,9 +2910,6 @@ static int vfswrap_linkat(vfs_handle_struct *handle, START_PROFILE(syscall_linkat); - SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp); - SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp); - result = linkat(srcfsp->fh->fd, old_smb_fname->base_name, dstfsp->fh->fd, @@ -2937,8 +2930,6 @@ static int vfswrap_mknodat(vfs_handle_struct *handle, START_PROFILE(syscall_mknodat); - SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); - result = sys_mknodat(dirfsp->fh->fd, smb_fname->base_name, mode, diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c index 6845b81b0cb..7deeb2b7374 100644 --- a/source3/modules/vfs_expand_msdfs.c +++ b/source3/modules/vfs_expand_msdfs.c @@ -183,7 +183,7 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx, } static int expand_msdfs_readlinkat(struct vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 5fceac6cf1f..f1823e3b22e 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1813,7 +1813,7 @@ static int smb_full_audit_symlinkat(vfs_handle_struct *handle, } static int smb_full_audit_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index bf7244ea3a5..ca8b54829cd 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -1703,7 +1703,7 @@ static int vfs_gluster_symlinkat(struct vfs_handle_struct *handle, } static int vfs_gluster_readlinkat(struct vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index e3ce2804b5f..12e7ad61806 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -1643,7 +1643,7 @@ out: * Failure: set errno, return -1 */ static int mh_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 9b5b0f6b4f6..59aaddb163a 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -472,7 +472,7 @@ int vfs_not_implemented_symlinkat(vfs_handle_struct *handle, } int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 0780895b0dd..e5413b75128 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1568,7 +1568,7 @@ static int shadow_copy2_ntimes(vfs_handle_struct *handle, } static int shadow_copy2_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 8f239c6cb3f..3663bf2d4a3 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2237,7 +2237,7 @@ static int snapper_gmt_ntimes(vfs_handle_struct *handle, } static int snapper_gmt_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index dca814f5df0..bd2ad48656d 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -627,11 +627,6 @@ static int streams_depot_openat(struct vfs_handle_struct *handle, NTSTATUS status; int ret = -1; - /* - * For now assert this so the below SMB_VFS_STAT() is ok. - */ - SMB_ASSERT(dirfsp->fh->fd == AT_FDCWD); - if (!is_named_stream(smb_fname)) { return SMB_VFS_NEXT_OPENAT(handle, dirfsp, @@ -641,6 +636,11 @@ static int streams_depot_openat(struct vfs_handle_struct *handle, mode); } + /* + * For now assert this so the below SMB_VFS_STAT() is ok. + */ + SMB_ASSERT(dirfsp->fh->fd == AT_FDCWD); + /* Ensure the base file still exists. */ smb_fname_base = synthetic_smb_fname(talloc_tos(), smb_fname->base_name, diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 13ea46b0806..2f786327835 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -375,11 +375,6 @@ static int streams_xattr_openat(struct vfs_handle_struct *handle, bool set_empty_xattr = false; int ret; - /* - * For now assert this, so the below SMB_VFS_SETXATTR() works. - */ - SMB_ASSERT(dirfsp->fh->fd == AT_FDCWD); - SMB_VFS_HANDLE_GET_DATA(handle, config, struct streams_xattr_config, return -1); @@ -395,6 +390,11 @@ static int streams_xattr_openat(struct vfs_handle_struct *handle, mode); } + /* + * For now assert this, so the below SMB_VFS_SETXATTR() works. + */ + SMB_ASSERT(dirfsp->fh->fd == AT_FDCWD); + status = streams_xattr_get_name(handle, talloc_tos(), smb_fname->stream_name, &xattr_name); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index c6b0130bb93..7ff0b24cced 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1433,7 +1433,7 @@ static int smb_time_audit_symlinkat(vfs_handle_struct *handle, } static int smb_time_audit_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index ca20dc6baeb..014420fd961 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -1284,7 +1284,7 @@ err: } static int um_readlinkat(vfs_handle_struct *handle, - files_struct *dirfsp, + const struct files_struct *dirfsp, const struct smb_filename *smb_fname, char *buf, size_t bufsiz) diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 604a13b95da..b9c44398e81 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -228,7 +228,6 @@ posix_tests = ["POSIX", "POSIX-APPEND", "POSIX-SYMLINK-ACL", "POSIX-SYMLINK-EA", for t in posix_tests: plantestsuite("samba3.smbtorture_s3.plain.%s" % t, "nt4_dc_smb1", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/posix_share', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"]) plantestsuite("samba3.smbtorture_s3.crypt.%s" % t, "nt4_dc_smb1", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/posix_share', '$USERNAME', '$PASSWORD', smbtorture3, "-e", "-l $LOCAL_PATH"]) - plantestsuite("samba3.smbtorture_s3.plain.%s" % t, "ad_dc_ntvfs", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/posix_share', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"]) local_tests = [ "LOCAL-SUBSTITUTE", diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 0001726e582..6b5b4715d54 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -872,6 +872,7 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx, .base_name = pathreal, .st = sbuf, .twrp = dirptr->smb_dname->twrp, + .flags = dirptr->smb_dname->flags, }; ok = mode_fn(ctx, private_data, &smb_fname, get_dosmode, &mode); diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 00e5d93cc95..716e10d9914 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -1961,9 +1961,10 @@ static NTSTATUS filename_convert_internal(TALLOC_CTX *ctx, return status; } - if ((ucf_flags & UCF_UNIX_NAME_LOOKUP) && - VALID_STAT(smb_fname->st) && - S_ISLNK(smb_fname->st.st_ex_mode)) { + if ((ucf_flags & UCF_POSIX_PATHNAMES) && + VALID_STAT(smb_fname->st) && + S_ISLNK(smb_fname->st.st_ex_mode)) + { status = check_veto_path(conn, smb_fname); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(smb_fname); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 51f95f565c0..8dfc97c8586 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3446,8 +3446,8 @@ NTSTATUS unlink_internals(connection_struct *conn, p, NULL, &smb_fname->st, - smb_fname->flags, - smb_fname->twrp); + smb_fname->twrp, + smb_fname->flags); if (f == NULL) { TALLOC_FREE(dir_hnd); status = NT_STATUS_NO_MEMORY; @@ -8270,13 +8270,9 @@ void reply_mv(struct smb_request *req) struct smb_filename *smb_fname_dst = NULL; const char *dst_original_lcomp = NULL; uint32_t src_ucf_flags = ucf_flags_from_smb_request(req) | - (req->posix_pathnames ? - UCF_UNIX_NAME_LOOKUP : - UCF_ALWAYS_ALLOW_WCARD_LCOMP); + (!req->posix_pathnames ? UCF_ALWAYS_ALLOW_WCARD_LCOMP : 0); uint32_t dst_ucf_flags = ucf_flags_from_smb_request(req) | - (req->posix_pathnames ? - 0 : - UCF_ALWAYS_ALLOW_WCARD_LCOMP); + (!req->posix_pathnames ? UCF_ALWAYS_ALLOW_WCARD_LCOMP : 0); bool stream_rename = false; START_PROFILE(SMBmv); diff --git a/source3/smbd/smbd.h b/source3/smbd/smbd.h index b7d2bbb5408..fb277bde780 100644 --- a/source3/smbd/smbd.h +++ b/source3/smbd/smbd.h @@ -63,7 +63,7 @@ struct trans_state { #define UCF_ALWAYS_ALLOW_WCARD_LCOMP 0x00000002 /* UCF_COND_ALLOW_WCARD_LCOMP 0x00000004 is no longer used. */ #define UCF_POSIX_PATHNAMES 0x00000008 -#define UCF_UNIX_NAME_LOOKUP 0x00000010 +/* #define UCF_UNIX_NAME_LOOKUP 0x00000010 is no longer used. */ #define UCF_PREP_CREATEFILE 0x00000020 /* * Use the same bit as FLAGS2_REPARSE_PATH diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index f9300efee9a..2e2b9e899a5 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1784,7 +1784,7 @@ static bool smbd_dirptr_lanman2_mode_fn(TALLOC_CTX *ctx, bool ms_dfs_link = false; uint32_t mode = 0; - if (INFO_LEVEL_IS_UNIX(state->info_level)) { + if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) { if (SMB_VFS_LSTAT(state->conn, smb_fname) != 0) { DEBUG(5,("smbd_dirptr_lanman2_mode_fn: " "Couldn't lstat [%s] (%s)\n", @@ -2784,19 +2784,21 @@ close_if_end = %d requires_resume_key = %d backup_priv = %d level = 0x%x, max_da break; case SMB_FIND_FILE_UNIX: case SMB_FIND_FILE_UNIX_INFO2: - /* Always use filesystem for UNIX mtime query. */ - ask_sharemode = false; if (!lp_unix_extensions()) { reply_nterror(req, NT_STATUS_INVALID_LEVEL); goto out; } - ucf_flags |= UCF_UNIX_NAME_LOOKUP; break; default: reply_nterror(req, NT_STATUS_INVALID_LEVEL); goto out; } + if (req->posix_pathnames) { + /* Always use filesystem for UNIX mtime query. */ + ask_sharemode = false; + } + if (req->posix_pathnames) { srvstr_get_path_posix(talloc_tos(), params, @@ -2881,8 +2883,8 @@ close_if_end = %d requires_resume_key = %d backup_priv = %d level = 0x%x, max_da ".", NULL, &old_name->st, - old_name->flags, - old_name->twrp); + old_name->twrp, + old_name->flags); TALLOC_FREE(old_name); if (smb_dname == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); @@ -6143,12 +6145,6 @@ static void call_trans2qfilepathinfo(connection_struct *conn, reply_nterror(req, NT_STATUS_INVALID_LEVEL); return; } - if (info_level == SMB_QUERY_FILE_UNIX_BASIC || - info_level == SMB_QUERY_FILE_UNIX_INFO2 || -- Samba Shared Repository