The branch, v4-16-stable has been updated
       via  c034f061d9c VERSION: Disable GIT_SNAPSHOT for the 4.16.5 release.
       via  c579b735520 WHATSNEW: Add release notes for Samba 4.16.5.
       via  1761ad3dff2 smbd: check for streams support in unix_convert()
       via  7c83b7788ec smbd: return NT_STATUS_OBJECT_NAME_INVALID if a share 
doesn't support streams
       via  b807f3624d1 smbtorture: add a test trying to create a stream on 
share without streams support
       via  bc81ebe3e39 smbd: implement access checks for SMB2-GETINFO as per 
MS-SMB2 3.3.5.20.1
       via  6e091cc59ac smbtorture: check required access for SMB2-GETINFO
       via  d89294ecfc7 s4/libcli/smb2: avoid using 
smb2_composite_setpathinfo() in smb2_util_setatr()
       via  1d244421838 smbd: directly pass fsp to SMB_VFS_FGETXATTR() in 
fget_ea_dos_attribute()
       via  5a9aa7aa84e smbd: add and use vfs_fget_dos_attributes()
       via  3d54c1b6ebc smbtorture: add test smb2.stream.attributes2
       via  6ee18ad9eaf smbtorture: rename smb2.streams.attributes to 
smb2.streams.attributes1
       via  a13748d2427 vfs_default: assert all passed in fsp's and names are 
non-stream type
       via  e661087a9e2 vfs_streams_xattr: restrict which fcntl's are allowed 
on streams
       via  06b5438132e smbd: skip access checks for stat-opens on streams in 
open_file()
       via  2ae309348ad smbd: use metadata_fsp() in get_acl_group_bits()
       via  8d0581a8ab1 smbd: ignore request to set the SPARSE attribute on 
streams
       via  39129be4fef smbd: use metadata_fsp() with 
SMB_VFS_FSET_DOS_ATTRIBUTES()
       via  eab9c65b075 smbd: use metadata_fsp() with 
SMB_VFS_FGET_DOS_ATTRIBUTES()
       via  11947a8e59a smbd: use metadata_fsp() with SMB_VFS_FSET_NT_ACL()
       via  9823e919994 smbd: use metadata_fsp() with SMB_VFS_FGET_NT_ACL()
       via  3e6566222c9 CI: add a test trying to delete a stream on a pathref 
("stat open") handle
       via  00ce839865c vfs_xattr_tdb: add "xattr_tdb:ignore_user_xattr" option
       via  6d66f432297 vfs_xattr_tdb: add a module config
       via  b83ff1252ed vfs_xattr_tdb: move close_xattr_db()
       via  56ab8361573 smdb: use fsp_is_alternate_stream() in open_file()
       via  20a425fcde0 smbd: Introduce metadata_fsp()
       via  3160ff28e87 smbd: Introduce fsp_is_alternate_stream()
       via  df7d6f0c486 lib:replace: Only include <sys/mount.h> on non-Linux 
systems
       via  ce464a83c76 s3: smbd: Plumb close_type parameter through 
close_file_in_loop(), file_close_conn()
       via  a5cf33d4041 s3: smbd: Add "enum file_close_type close_type" 
parameter to file_close_conn().
       via  706c64c6f0e s3: smbd: Add "enum file_close_type close_type" 
parameter to close_cnum().
       via  d1bc0d0b51b s3/smbd: Use after free when iterating 
smbd_server_connection->connections
       via  56e1a9fc623 s3/smbd: Use after free when iterating 
smbd_server_connection->connections
       via  9cb40437278 s3:smbd: only clear LEASE_READ if there's no read lease 
is left
       via  b910d9f6e00 s4:torture/smb2: add smb2.lease.v[1,2]_bug_15148
       via  19f285e0809 s3:smbd: share_mode_flags_set() takes SMB2_LEASE_* 
values
       via  f6afc5b35e7 libcli/smb: Set error status if 'iov' pointer is NULL
       via  f33ad1c1725 libcli/smb: Ensure we call tevent_req_nterror() on 
failure
       via  b75b5f60ba3 s3/util/py_net.c: fix samba-tool domain join&leave 
segfault
       via  529e86163a3 s3:rpcclient: Goto done in cmd_samr_setuserinfo_int()
       via  e10ce26dcbd mdssvc: return all-zero policy handle if spotlight is 
disabled
       via  5598ddaaf46 CI: fix check for correct mdsvc resonse when connecting 
to a share with Spotlight disabled
       via  5fd138ad809 mdssvc: convert mds_init_ctx() to return NTSTATUS
       via  ae0977177bd VERSION: Bump version up to Samba 4.16.5...
      from  9618af1b66a VERSION: Disable GIT_SNAPSHOT for the 4.16.4 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-16-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                    |   2 +-
 WHATSNEW.txt                               |  67 +++++-
 lib/replace/system/filesys.h               |   4 +-
 lib/replace/wscript                        |   3 +
 libcli/smb/smbXcli_base.c                  |  12 +-
 selftest/knownfail                         |   3 +-
 selftest/target/Samba3.pm                  |   7 +
 source3/include/proto.h                    |   3 +
 source3/modules/vfs_default.c              |  94 +++++---
 source3/modules/vfs_streams_xattr.c        |  33 +++
 source3/modules/vfs_xattr_tdb.c            | 293 ++++++++++++++---------
 source3/rpc_server/mdssvc/mdssvc.c         |  40 ++--
 source3/rpc_server/mdssvc/mdssvc.h         |  15 +-
 source3/rpc_server/mdssvc/srv_mdssvc_nt.c  |  28 ++-
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c  |   2 +-
 source3/rpcclient/cmd_samr.c               |  22 +-
 source3/script/tests/test_delete_stream.sh | 123 ++++++++++
 source3/selftest/tests.py                  |   5 +-
 source3/smbd/conn.c                        |  36 ++-
 source3/smbd/dir.c                         |   2 +-
 source3/smbd/dosmode.c                     |  24 +-
 source3/smbd/file_access.c                 |   2 +-
 source3/smbd/filename.c                    |   9 +-
 source3/smbd/files.c                       |  30 ++-
 source3/smbd/open.c                        |  67 +++---
 source3/smbd/oplock.c                      |  13 +-
 source3/smbd/posix_acls.c                  |   2 +-
 source3/smbd/proto.h                       |   8 +-
 source3/smbd/pysmbd.c                      |   4 +-
 source3/smbd/service.c                     |   6 +-
 source3/smbd/smb2_getinfo.c                |  28 +++
 source3/smbd/smbXsrv_tcon.c                |  11 +-
 source3/smbd/vfs.c                         |  54 +++++
 source3/torture/cmd_vfs.c                  |  12 +-
 source3/utils/py_net.c                     |  10 +-
 source4/libcli/smb2/util.c                 |  37 ++-
 source4/selftest/tests.py                  |   1 +
 source4/torture/rpc/mdssvc.c               |  17 +-
 source4/torture/smb2/create.c              |  48 ++++
 source4/torture/smb2/getinfo.c             | 147 ++++++++++++
 source4/torture/smb2/lease.c               | 208 +++++++++++++++++
 source4/torture/smb2/oplock.c              |  10 +-
 source4/torture/smb2/smb2.c                |   1 +
 source4/torture/smb2/streams.c             | 361 ++++++++++++++++++++++++++++-
 44 files changed, 1608 insertions(+), 296 deletions(-)
 create mode 100755 source3/script/tests/test_delete_stream.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index d948db4fa15..bb80bd65bd8 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=16
-SAMBA_VERSION_RELEASE=4
+SAMBA_VERSION_RELEASE=5
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index c9146b8ef29..08bb7086b27 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,67 @@
+                   ==============================
+                   Release Notes for Samba 4.16.5
+                         September 07, 2022
+                   ==============================
+
+
+This is the latest stable release of the Samba 4.16 release series.
+
+
+Changes since 4.16.4
+--------------------
+
+o  Jeremy Allison <j...@samba.org>
+   * BUG 15128: Possible use after free of connection_struct when iterating
+     smbd_server_connection->connections.
+
+o  Ralph Boehme <s...@samba.org>
+   * BUG 15086: Spotlight RPC service returns wrong response when Spotlight is
+     disabled on a share.
+   * BUG 15126: acl_xattr VFS module may unintentionally use filesystem
+     permissions instead of ACL from xattr.
+   * BUG 15153: Missing SMB2-GETINFO access checks from MS-SMB2 3.3.5.20.1.
+   * BUG 15161: assert failed: !is_named_stream(smb_fname)") at
+     ../../lib/util/fault.c:197.
+
+o  Stefan Metzmacher <me...@samba.org>
+   * BUG 15148: Missing READ_LEASE break could cause data corruption.
+
+o  Andreas Schneider <a...@samba.org>
+   * BUG 15124: rpcclient can crash using setuserinfo(2).
+   * BUG 15132: Samba fails to build with glibc 2.36 caused by including
+     <sys/mount.h> in libreplace.
+
+o  Joseph Sutton <josephsut...@catalyst.net.nz>
+   * BUG 15152: SMB1 negotiation can fail to handle connection errors.
+
+o  Michael Tokarev <m...@tls.msk.ru>
+   * BUG 15078: samba-tool domain join segfault when joining a samba ad domain.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical:matrix.org matrix room, or
+#samba-technical IRC channel on irc.libera.chat.
+
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.1 and newer product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
                    ==============================
                    Release Notes for Samba 4.16.4
                            July 27, 2022
@@ -64,8 +128,7 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
                    ==============================
                    Release Notes for Samba 4.16.3
                            July 18, 2022
diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h
index 034e5d5886c..bb9482c69af 100644
--- a/lib/replace/system/filesys.h
+++ b/lib/replace/system/filesys.h
@@ -36,7 +36,8 @@
 #include <sys/param.h>
 #endif
 
-#ifdef HAVE_SYS_MOUNT_H
+/* This include is required on UNIX (*BSD, AIX, ...) for statfs() */
+#if !defined(LINUX) && defined(HAVE_SYS_MOUNT_H)
 #include <sys/mount.h>
 #endif
 
@@ -44,6 +45,7 @@
 #include <mntent.h>
 #endif
 
+/* This include is required on Linux for statfs() */
 #ifdef HAVE_SYS_VFS_H
 #include <sys/vfs.h>
 #endif
diff --git a/lib/replace/wscript b/lib/replace/wscript
index e4c2d513076..0db93d8caf1 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -31,6 +31,9 @@ def configure(conf):
 
     conf.env.standalone_replace = conf.IN_LAUNCH_DIR()
 
+    if sys.platform.rfind('linux') > -1:
+        conf.DEFINE('LINUX', '1')
+
     conf.DEFINE('BOOL_DEFINED', 1)
     conf.DEFINE('HAVE_LIBREPLACE', 1)
     conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1)
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 7579fa1c378..5d5b5ac45fd 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -4469,7 +4469,11 @@ static void smbXcli_negprot_smb1_done(struct tevent_req 
*subreq)
                                  NULL, /* pinbuf */
                                  expected, ARRAY_SIZE(expected));
        TALLOC_FREE(subreq);
-       if (inhdr == NULL || tevent_req_nterror(req, status)) {
+       if (tevent_req_nterror(req, status)) {
+               return;
+       }
+       if (inhdr == NULL) {
+               tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
                return;
        }
 
@@ -5009,7 +5013,11 @@ static void smbXcli_negprot_smb2_done(struct tevent_req 
*subreq)
 
        status = smb2cli_req_recv(subreq, state, &iov,
                                  expected, ARRAY_SIZE(expected));
-       if (tevent_req_nterror(req, status) || iov == NULL) {
+       if (tevent_req_nterror(req, status)) {
+               return;
+       }
+       if (iov == NULL) {
+               tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
                return;
        }
 
diff --git a/selftest/knownfail b/selftest/knownfail
index 4c5d03147d2..a630270e5f0 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -176,6 +176,7 @@
 ^samba4.smb2.oplock.stream1 # samba 4 oplocks are a mess
 ^samba4.smb2.oplock.statopen1\(ad_dc_ntvfs\)$ # fails with ACCESS_DENIED on a 
SYNCHRONIZE_ACCESS open
 ^samba4.smb2.getinfo.complex # streams on directories does not work
+^samba4.smb2.getinfo.getinfo_access\(ad_dc_ntvfs\) # Access checks not 
implemented
 ^samba4.smb2.getinfo.qfs_buffercheck # S4 does not do the 
INFO_LENGTH_MISMATCH/BUFFER_OVERFLOW thingy
 ^samba4.smb2.getinfo.qfile_buffercheck # S4 does not do the 
INFO_LENGTH_MISMATCH/BUFFER_OVERFLOW thingy
 ^samba4.smb2.getinfo.qsec_buffercheck # S4 does not do the BUFFER_TOO_SMALL 
thingy
@@ -207,10 +208,8 @@
 ^samba3.smb2.oplock.stream1
 ^samba3.smb2.streams.rename
 ^samba3.smb2.streams.rename2
-^samba3.smb2.streams.attributes
 ^samba3.smb2.streams streams_xattr.rename\(nt4_dc\)
 ^samba3.smb2.streams streams_xattr.rename2\(nt4_dc\)
-^samba3.smb2.streams streams_xattr.attributes\(nt4_dc\)
 ^samba3.smb2.getinfo.complex
 ^samba3.smb2.getinfo.fsinfo # quotas don't work yet
 ^samba3.smb2.setinfo.setinfo
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 595be223dce..976afe89186 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -3255,6 +3255,13 @@ sub provision($$)
        copy = tmp
        vfs objects = streams_xattr xattr_tdb
 
+[acl_streams_xattr]
+       copy = tmp
+       vfs objects = acl_xattr streams_xattr fake_acls xattr_tdb
+       acl_xattr:ignore system acls = yes
+       acl_xattr:security_acl_name = user.acl
+       xattr_tdb:ignore_user_xattr = yes
+
 [compound_find]
        copy = tmp
        smbd:find async delay usec = 10000
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 19a9c6b8a01..81357968bf6 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -82,6 +82,9 @@ NTSTATUS vfs_at_fspcwd(TALLOC_CTX *mem_ctx,
                       struct connection_struct *conn,
                       struct files_struct **_fsp);
 
+NTSTATUS vfs_fget_dos_attributes(struct files_struct *fsp,
+                                uint32_t *dosmode);
+
 #include "source3/lib/interface.h"
 
 /* The following definitions come from lib/ldap_debug_handler.c  */
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5977122a512..c6784538353 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -700,11 +700,7 @@ static int vfswrap_openat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_openat);
 
-       if (is_named_stream(smb_fname)) {
-               errno = ENOENT;
-               result = -1;
-               goto out;
-       }
+       SMB_ASSERT(!is_named_stream(smb_fname));
 
 #ifdef O_PATH
        have_opath = true;
@@ -729,7 +725,6 @@ static int vfswrap_openat(vfs_handle_struct *handle,
 
        fsp->fsp_flags.have_proc_fds = fsp->conn->have_proc_fds;
 
-out:
        END_PROFILE(syscall_openat);
        return result;
 }
@@ -1250,17 +1245,14 @@ static int vfswrap_renameat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_renameat);
 
-       if (is_named_stream(smb_fname_src) || is_named_stream(smb_fname_dst)) {
-               errno = ENOENT;
-               goto out;
-       }
+       SMB_ASSERT(!is_named_stream(smb_fname_src));
+       SMB_ASSERT(!is_named_stream(smb_fname_dst));
 
        result = renameat(fsp_get_pathref_fd(srcfsp),
                        smb_fname_src->base_name,
                        fsp_get_pathref_fd(dstfsp),
                        smb_fname_dst->base_name);
 
- out:
        END_PROFILE(syscall_renameat);
        return result;
 }
@@ -1272,14 +1264,11 @@ static int vfswrap_stat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_stat);
 
-       if (is_named_stream(smb_fname)) {
-               errno = ENOENT;
-               goto out;
-       }
+       SMB_ASSERT(!is_named_stream(smb_fname));
 
        result = sys_stat(smb_fname->base_name, &smb_fname->st,
                          lp_fake_directory_create_times(SNUM(handle->conn)));
- out:
+
        END_PROFILE(syscall_stat);
        return result;
 }
@@ -1302,14 +1291,11 @@ static int vfswrap_lstat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_lstat);
 
-       if (is_named_stream(smb_fname)) {
-               errno = ENOENT;
-               goto out;
-       }
+       SMB_ASSERT(!is_named_stream(smb_fname));
 
        result = sys_lstat(smb_fname->base_name, &smb_fname->st,
                           lp_fake_directory_create_times(SNUM(handle->conn)));
- out:
+
        END_PROFILE(syscall_lstat);
        return result;
 }
@@ -1406,6 +1392,8 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct 
*handle,
        char **out_data = (char **)_out_data;
        NTSTATUS status;
 
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        switch (function) {
        case FSCTL_SET_SPARSE:
        {
@@ -1770,6 +1758,8 @@ static struct tevent_req *vfswrap_get_dos_attributes_send(
        struct tevent_req *subreq = NULL;
        struct vfswrap_get_dos_attributes_state *state = NULL;
 
+       SMB_ASSERT(!is_named_stream(smb_fname));
+
        req = tevent_req_create(mem_ctx, &state,
                                struct vfswrap_get_dos_attributes_state);
        if (req == NULL) {
@@ -1926,6 +1916,8 @@ static NTSTATUS vfswrap_fget_dos_attributes(struct 
vfs_handle_struct *handle,
 {
        bool offline;
 
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        offline = vfswrap_is_offline(handle->conn, fsp->fsp_name);
        if (offline) {
                *dosmode |= FILE_ATTRIBUTE_OFFLINE;
@@ -1938,6 +1930,8 @@ static NTSTATUS vfswrap_fset_dos_attributes(struct 
vfs_handle_struct *handle,
                                            struct files_struct *fsp,
                                            uint32_t dosmode)
 {
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        return set_ea_dos_attribute(handle->conn, fsp->fsp_name, dosmode);
 }
 
@@ -2614,15 +2608,12 @@ static int vfswrap_unlinkat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_unlinkat);
 
-       if (is_named_stream(smb_fname)) {
-               errno = ENOENT;
-               goto out;
-       }
+       SMB_ASSERT(!is_named_stream(smb_fname));
+
        result = unlinkat(fsp_get_pathref_fd(dirfsp),
                        smb_fname->base_name,
                        flags);
 
- out:
        END_PROFILE(syscall_unlinkat);
        return result;
 }
@@ -3107,6 +3098,8 @@ static int vfswrap_linux_setlease(vfs_handle_struct 
*handle, files_struct *fsp,
 
        START_PROFILE(syscall_linux_setlease);
 
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
        result = linux_setlease(fsp_get_io_fd(fsp), leasetype);
 #else
@@ -3125,6 +3118,8 @@ static int vfswrap_symlinkat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_symlinkat);
 
+       SMB_ASSERT(!is_named_stream(new_smb_fname));
+
        result = symlinkat(link_target->base_name,
                        fsp_get_pathref_fd(dirfsp),
                        new_smb_fname->base_name);
@@ -3142,6 +3137,8 @@ static int vfswrap_readlinkat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_readlinkat);
 
+       SMB_ASSERT(!is_named_stream(smb_fname));
+
        result = readlinkat(fsp_get_pathref_fd(dirfsp),
                        smb_fname->base_name,
                        buf,
@@ -3162,6 +3159,9 @@ static int vfswrap_linkat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_linkat);
 
+       SMB_ASSERT(!is_named_stream(old_smb_fname));
+       SMB_ASSERT(!is_named_stream(new_smb_fname));
+
        result = linkat(fsp_get_pathref_fd(srcfsp),
                        old_smb_fname->base_name,
                        fsp_get_pathref_fd(dstfsp),
@@ -3182,6 +3182,8 @@ static int vfswrap_mknodat(vfs_handle_struct *handle,
 
        START_PROFILE(syscall_mknodat);
 
+       SMB_ASSERT(!is_named_stream(smb_fname));
+
        result = sys_mknodat(fsp_get_pathref_fd(dirfsp),
                        smb_fname->base_name,
                        mode,
@@ -3220,6 +3222,8 @@ static int vfswrap_fchflags(vfs_handle_struct *handle,
 #ifdef HAVE_FCHFLAGS
        int fd = fsp_get_pathref_fd(fsp);
 
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        if (!fsp->fsp_flags.is_pathref) {
                return fchflags(fd, flags);
        }
@@ -3295,6 +3299,8 @@ static NTSTATUS vfswrap_fstreaminfo(vfs_handle_struct 
*handle,
        struct stream_struct *streams = *pstreams;
        NTSTATUS status;
 
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        if (fsp->fsp_flags.is_directory) {
                /*
                 * No default streams on directories
@@ -3395,6 +3401,9 @@ static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct 
*handle,
        NTSTATUS result;
 
        START_PROFILE(fget_nt_acl);
+
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        result = posix_fget_nt_acl(fsp, security_info,
                                   mem_ctx, ppdesc);
        END_PROFILE(fget_nt_acl);
@@ -3406,6 +3415,9 @@ static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct 
*handle, files_struct *fsp
        NTSTATUS result;
 
        START_PROFILE(fset_nt_acl);
+
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        result = set_nt_acl(fsp, security_info_sent, psd);
        END_PROFILE(fset_nt_acl);
        return result;
@@ -3425,6 +3437,8 @@ static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct 
*handle,
                                        SMB_ACL_TYPE_T type,
                                        TALLOC_CTX *mem_ctx)
 {
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        return sys_acl_get_fd(handle, fsp, type, mem_ctx);
 }
 
@@ -3433,12 +3447,16 @@ static int vfswrap_sys_acl_set_fd(vfs_handle_struct 
*handle,
                                  SMB_ACL_TYPE_T type,
                                  SMB_ACL_T theacl)
 {
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        return sys_acl_set_fd(handle, fsp, type, theacl);
 }
 
 static int vfswrap_sys_acl_delete_def_fd(vfs_handle_struct *handle,
                                         files_struct *fsp)
 {
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        return sys_acl_delete_def_fd(handle, fsp);
 }
 
@@ -3454,6 +3472,8 @@ static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct 
*handle,
 {
        int fd = fsp_get_pathref_fd(fsp);
 
+       SMB_ASSERT(!fsp_is_alternate_stream(fsp));
+
        if (!fsp->fsp_flags.is_pathref) {
                return fgetxattr(fd, name, value, size);
        }
@@ -3524,6 +3544,8 @@ static struct tevent_req *vfswrap_getxattrat_send(
        bool have_per_thread_creds = false;
        bool do_async = false;
 
+       SMB_ASSERT(!is_named_stream(smb_fname));
+
        req = tevent_req_create(mem_ctx, &state,
                                struct vfswrap_getxattrat_state);
        if (req == NULL) {
@@ -3630,14 +3652,9 @@ static void vfswrap_getxattrat_do_sync(struct tevent_req 
*req)
 {
        struct vfswrap_getxattrat_state *state = tevent_req_data(
                req, struct vfswrap_getxattrat_state);
-       struct files_struct *fsp = state->smb_fname->fsp;
-
-       if (fsp->base_fsp != NULL) {
-               fsp = fsp->base_fsp;
-       }
 
        state->xattr_size = vfswrap_fgetxattr(state->handle,
-                                             fsp,
+                                             state->smb_fname->fsp,
                                              state->xattr_name,
                                              state->xattr_value,
                                              
talloc_array_length(state->xattr_value));
@@ -3657,11 +3674,6 @@ static void vfswrap_getxattrat_do_async(void 
*private_data)
        struct timespec start_time;
        struct timespec end_time;
        int ret;
-       struct files_struct *fsp = state->smb_fname->fsp;
-
-       if (fsp->base_fsp != NULL) {


-- 
Samba Shared Repository

Reply via email to