[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Wed Apr 9 14:40:01 UTC 2025


The branch, master has been updated
       via  7089ece58ef smbd: convert all fsp->fh->private_options to fsp_flags
       via  0d3adfb1b64 smbd: remove broken initial-delete-on-close logic from rename_internals_fsp()
       via  967b7562129 smbd: add fsp_apply_private_ntcreatex_flags()
       via  c1d5aae69ce vfs: add fsp_flags ntcreatex_deny_[dos|fcb] and ntcreatex_stream_baseopen
       via  b9ef85ba0b1 smbd: remove unused private_flags from open_file()
       via  1f79af0377b s3/locking: remove now unused private_options from share_mode_entry
       via  fd281343c17 s3/locking: store NTCREATEX_FLAG_DENY_[DOS|FCB] as share_entry_flags
       via  638a4c2bbb2 s3/locking: store NTCREATEX_FLAG_STREAM_BASEOPEN as share_entry_flag
       via  c9d6581c182 s3/locking: add and use fsp_[get|apply]_share_entry_flags()
       via  831c0f78741 s3/librpc: open_files.idl: move flag definition into open_files.idl
       via  49e19cf1df6 smbd: rename SHARE_MODE_FLAG_POSIX_OPEN to SHARE_ENTRY_FLAG_POSIX_OPEN
      from  72cb5fcbed3 winbindd: let update_trusted_domains_dc() also call pdb_filter_hints()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7089ece58ef8d78e1556cb6f3eec3a78d7051c5f
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Mar 28 13:22:22 2025 +0100

    smbd: convert all fsp->fh->private_options to fsp_flags
    
    Use fsp_apply_private_ntcreatex_flags() to store the private_flags as fsp_flags
    and convert all users to check the fsp_flags.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Wed Apr  9 14:39:26 UTC 2025 on atb-devel-224

commit 0d3adfb1b6474d71154a0a402f4bf40078525987
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Mar 28 15:04:52 2025 +0100

    smbd: remove broken initial-delete-on-close logic from rename_internals_fsp()
    
    fh_get_private_options() return private_flags, not create_options and thus can
    never contain FILE_DELETE_ON_CLOSE.
    
    Afaict fsp_flags.initial_delete_on_close is already correctly filled in
    open_file_ntcreate():
    
            /* Handle strange delete on close create semantics. */
            if (create_options & FILE_DELETE_ON_CLOSE) {
                    if (!new_file_created) {
                            status = can_set_delete_on_close(fsp,
                                             existing_dos_attributes);
    
                            if (!NT_STATUS_IS_OK(status)) {
                                    /* Remember to delete the mode we just added. */
                                    lck_state.cleanup_fn =
                                            open_ntcreate_lock_cleanup_entry;
                                    goto unlock;
                            }
                    }
                    /* Note that here we set the *initial* delete on close flag,
                       not the regular one. The magic gets handled in close. */
                    fsp->fsp_flags.initial_delete_on_close = true;
            }
    
    so we can just remove the broken handling here.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 967b75621295bffa082361a949a204a347425211
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Mar 28 13:10:13 2025 +0100

    smbd: add fsp_apply_private_ntcreatex_flags()
    
    Not used yet, comes next.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit c1d5aae69cec07daba256ed8c077fd2e88ef3149
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 27 19:39:52 2025 +0100

    vfs: add fsp_flags ntcreatex_deny_[dos|fcb] and ntcreatex_stream_baseopen
    
    Not used for now.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit b9ef85ba0b1e9d45e1595c366d3f0d3087f4aad1
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 27 18:42:22 2025 +0100

    smbd: remove unused private_flags from open_file()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 1f79af0377be801e6570d2cf87b109a6fa4c69c6
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 17 12:44:45 2025 +0100

    s3/locking: remove now unused private_options from share_mode_entry
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit fd281343c178de4193a32d4d6557a92a959c5ffc
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 17 14:59:49 2025 +0100

    s3/locking: store NTCREATEX_FLAG_DENY_[DOS|FCB] as share_entry_flags
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 638a4c2bbb27265bebdaca3b28f494ed5a65d8a3
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 17 14:56:24 2025 +0100

    s3/locking: store NTCREATEX_FLAG_STREAM_BASEOPEN as share_entry_flag
    
    No change in behaviour.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit c9d6581c1821d9c873bc19e1ee34766fad6d2990
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Apr 3 22:01:09 2025 +0200

    s3/locking: add and use fsp_[get|apply]_share_entry_flags()
    
    Prepares for converting private_options to flags.
    
    Fixes Durable Handle reconnect of POSIX opens which weren't setting the fsp_flags
    when reconnecting, so fsp_flags.posix_open wasn't set.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 831c0f787410db8ff94603d9431ee76ed3b253eb
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 17 12:20:02 2025 +0100

    s3/librpc: open_files.idl: move flag definition into open_files.idl
    
    Nice to have everything in one place. No change in behaviour.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 49e19cf1df661af13fedca3eefb2730256dfdc27
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 17 12:16:40 2025 +0100

    smbd: rename SHARE_MODE_FLAG_POSIX_OPEN to SHARE_ENTRY_FLAG_POSIX_OPEN
    
    share_mode_data has flags and share_mode_entry has flags, this change allows
    to distinguish between both more easily. No change in behaviour.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/smb.h             |  2 --
 source3/include/vfs.h             |  7 +++++-
 source3/librpc/idl/open_files.idl | 10 ++++++--
 source3/locking/locking.c         |  7 +++---
 source3/locking/share_mode_lock.c | 49 +++++++++++++++++++++++++++++++++++----
 source3/locking/share_mode_lock.h |  3 +++
 source3/smbd/close.c              |  2 +-
 source3/smbd/dir.c                |  2 +-
 source3/smbd/durable.c            |  2 +-
 source3/smbd/fd_handle.c          | 16 -------------
 source3/smbd/fd_handle.h          |  3 ---
 source3/smbd/files.c              | 27 +++++++++++++++++++++
 source3/smbd/open.c               |  6 ++---
 source3/smbd/proto.h              |  3 +++
 source3/smbd/smb1_utils.c         | 13 ++++++-----
 source3/smbd/smb2_oplock.c        |  2 +-
 source3/smbd/smb2_reply.c         | 20 ----------------
 source3/utils/status.c            | 12 +++++-----
 18 files changed, 113 insertions(+), 73 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/smb.h b/source3/include/smb.h
index 2642e364d0a..61c5963a02c 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -168,8 +168,6 @@ struct interface {
 	uint32_t options;
 };
 
-#define SHARE_MODE_FLAG_POSIX_OPEN	0x1
-
 #include "librpc/gen_ndr/server_id.h"
 
 #define NT_HASH_LEN 16
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index d7ac7f0fbaf..75b81648108 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -388,9 +388,11 @@
  *              and convert struct files_struct.posix_flags to
  *              struct files_struct.fsp_flags.posix_open
  * Version 50 - Add struct files_struct.fsp_flags.posix_append
+ * Change to Version 51 - will ship with 4.23
+ * Version 51 - Add ntcreatex_deny_[dos|fcb] and ntcreatex_stream_baseopen
  */
 
-#define SMB_VFS_INTERFACE_VERSION 50
+#define SMB_VFS_INTERFACE_VERSION 51
 
 /*
     All intercepted VFS operations must be declared as static functions inside module source
@@ -462,6 +464,9 @@ typedef struct files_struct {
 		bool fstat_before_close : 1;
 		bool posix_open : 1;
 		bool posix_append : 1;
+		bool ntcreatex_deny_dos : 1;
+		bool ntcreatex_deny_fcb : 1;
+		bool ntcreatex_stream_baseopen : 1;
 	} fsp_flags;
 
 	/* Only used for SMB1 close with explicit time */
diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index 2b5a03589d1..f7582885ca4 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -12,6 +12,13 @@ import "misc.idl";
 
 interface open_files
 {
+	typedef [public,bitmap16bit] bitmap {
+		SHARE_ENTRY_FLAG_POSIX_OPEN		= 0x0001,
+		SHARE_ENTRY_FLAG_STREAM_BASEOPEN	= 0x0002,
+		SHARE_ENTRY_FLAG_DENY_DOS		= 0x0004,
+		SHARE_ENTRY_FLAG_DENY_FCB		= 0x0008
+	} share_entry_flags;
+
 	typedef [enum16bit] enum {
 		SHARE_MODE_ENTRY_OP_TYPE_NONE = 0,
 		SHARE_MODE_ENTRY_OP_TYPE_EXCLUSIVE = 1,
@@ -29,11 +36,10 @@ interface open_files
 		smb2_lease_key  lease_key;
 		uint32		access_mask;
 		uint32		share_access;
-		uint32		private_options;
 		timeval		time;
 		udlong		share_file_id;
 		uint32		uid;
-		uint16		flags;
+		share_entry_flags flags;
 		uint32		name_hash;
 
 		/*
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 8c317b4c1f0..9a45424cf3d 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -436,12 +436,12 @@ char *share_mode_str(TALLOC_CTX *ctx, int num,
 	struct file_id_buf ftmp;
 
 	return talloc_asprintf(ctx, "share_mode_entry[%d]: "
-		 "pid = %s, share_access = 0x%x, private_options = 0x%x, "
+		 "pid = %s, share_access = 0x%x, "
 		 "access_mask = 0x%x, mid = 0x%llx, type= 0x%x, gen_id = %llu, "
 		 "uid = %u, flags = %u, file_id %s, name_hash = 0x%x",
 		 num,
 		 server_id_str_buf(e->pid, &tmp),
-		 e->share_access, e->private_options,
+		 e->share_access,
 		 e->access_mask, (unsigned long long)e->op_mid,
 		 e->op_type, (unsigned long long)e->share_file_id,
 		 (unsigned int)e->uid, (unsigned int)e->flags,
@@ -1075,8 +1075,7 @@ static bool file_has_open_streams_fn(
 {
 	struct file_has_open_streams_state *state = private_data;
 
-	if ((e->private_options &
-	     NTCREATEX_FLAG_STREAM_BASEOPEN) == 0) {
+	if (!(e->flags & SHARE_ENTRY_FLAG_STREAM_BASEOPEN)) {
 		return false;
 	}
 
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 126e2e4cc14..ce5ef40e370 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -328,13 +328,13 @@ static struct share_mode_data *share_mode_memcache_fetch(
 }
 
 /*
- * 132 is the sizeof an ndr-encoded struct share_mode_entry_buf.
+ * 124 is the sizeof an ndr-encoded struct share_mode_entry_buf.
  * Reading/writing entries will immediately error out if this
  * size differs (push/pull is done without allocs).
  */
 
 struct share_mode_entry_buf {
-	uint8_t buf[132];
+	uint8_t buf[124];
 };
 #define SHARE_MODE_ENTRY_SIZE (sizeof(struct share_mode_entry_buf))
 
@@ -2072,7 +2072,6 @@ bool set_share_mode(struct share_mode_lock *lck,
 	e = (struct share_mode_entry) {
 		.pid = my_pid,
 		.share_access = share_access,
-		.private_options = fh_get_private_options(fsp->fh),
 		.access_mask = access_mask,
 		.op_mid = mid,
 		.op_type = op_type,
@@ -2080,8 +2079,7 @@ bool set_share_mode(struct share_mode_lock *lck,
 		.time.tv_usec = fsp->open_time.tv_usec,
 		.share_file_id = fh_get_gen_id(fsp->fh),
 		.uid = (uint32_t)uid,
-		.flags = fsp->fsp_flags.posix_open ?
-			SHARE_MODE_FLAG_POSIX_OPEN : 0,
+		.flags = fsp_get_share_entry_flags(fsp),
 		.name_hash = fsp->name_hash,
 	};
 
@@ -3513,3 +3511,44 @@ NTSTATUS _share_mode_entry_prepare_unlock(
 
 	return state.status;
 }
+
+
+uint16_t fsp_get_share_entry_flags(const struct files_struct *fsp)
+{
+	uint16_t flags = 0;
+
+	if (fsp->fsp_flags.posix_open) {
+		flags |= SHARE_ENTRY_FLAG_POSIX_OPEN;
+	}
+	if (fsp->fsp_flags.ntcreatex_stream_baseopen) {
+		flags |= SHARE_ENTRY_FLAG_STREAM_BASEOPEN;
+	}
+	if (fsp->fsp_flags.ntcreatex_deny_dos) {
+		flags |= SHARE_ENTRY_FLAG_DENY_DOS;
+	}
+	if (fsp->fsp_flags.ntcreatex_deny_fcb) {
+		flags |= SHARE_ENTRY_FLAG_DENY_FCB;
+	}
+	return flags;
+}
+
+void fsp_apply_share_entry_flags(struct files_struct *fsp, uint16_t flags)
+{
+	if (flags & SHARE_ENTRY_FLAG_POSIX_OPEN) {
+		fsp->fsp_flags.posix_open = true;
+	}
+	/*
+	 * This flag is only ever set on the internal base_fsp of a stream
+	 * fsp and we don't expect it to be set when we're called as part
+	 * of restoring an fsp when doing a Durable Handle reconnect.
+	 */
+	SMB_ASSERT(!(flags & SHARE_ENTRY_FLAG_STREAM_BASEOPEN));
+
+	/*
+	 * SHARE_ENTRY_FLAG_DENY_[DOS|FCB] are only valid for SMB1, so
+	 * they're not supposed to be set when we're called as part
+	 * of restoring an fsp when doing a Durable Handle reconnect.
+	 */
+	SMB_ASSERT(!(flags & SHARE_ENTRY_FLAG_DENY_DOS));
+	SMB_ASSERT(!(flags & SHARE_ENTRY_FLAG_DENY_FCB));
+}
diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h
index 0a2696d38a2..82668cd977a 100644
--- a/source3/locking/share_mode_lock.h
+++ b/source3/locking/share_mode_lock.h
@@ -205,3 +205,6 @@ NTSTATUS _share_mode_entry_prepare_unlock(
 		__fn, __private_data, __location__);
 
 #endif
+
+uint16_t fsp_get_share_entry_flags(const struct files_struct *fsp);
+void fsp_apply_share_entry_flags(struct files_struct *fsp, uint16_t flags);
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index d249271a82f..6addab5b4c1 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -241,7 +241,7 @@ static bool has_other_nonposix_opens_fn(
 	struct has_other_nonposix_opens_state *state = private_data;
 	struct files_struct *fsp = state->fsp;
 
-	if (e->flags & SHARE_MODE_FLAG_POSIX_OPEN) {
+	if (e->flags & SHARE_ENTRY_FLAG_POSIX_OPEN) {
 		return false;
 	}
 	if (fsp != NULL) {
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 31a840bd658..137d9a1dacd 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1293,7 +1293,7 @@ static int have_file_open_below_fn(const struct share_mode_data *data,
 	}
 
 	if (state->dirfsp_is_posix &&
-	    e->flags & SHARE_MODE_FLAG_POSIX_OPEN)
+	    e->flags & SHARE_ENTRY_FLAG_POSIX_OPEN)
 	{
 		/* Ignore POSIX opens */
 		return 0;
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index 1c36f552c72..8e35e32538d 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -595,7 +595,7 @@ static void vfs_default_durable_reconnect_fn(struct share_mode_lock *lck,
 		goto fail;
 	}
 
-	fh_set_private_options(fsp->fh, e.private_options);
+	fsp_apply_share_entry_flags(fsp, e.flags);
 	fsp->open_time = e.time;
 	fsp->access_mask = e.access_mask;
 	fsp->fsp_flags.can_read = ((fsp->access_mask & FILE_READ_DATA) != 0);
diff --git a/source3/smbd/fd_handle.c b/source3/smbd/fd_handle.c
index eb7fa55e22a..b0190681f7a 100644
--- a/source3/smbd/fd_handle.c
+++ b/source3/smbd/fd_handle.c
@@ -25,12 +25,6 @@ struct fd_handle {
 	int fd;
 	uint64_t position_information;
 	off_t pos;
-	/*
-	 * NT Create options, but we only look at
-	 * NTCREATEX_FLAG_DENY_DOS and
-	 * NTCREATEX_FLAG_DENY_FCB.
-	 */
-	uint32_t private_options;
 	uint64_t gen_id;
 };
 
@@ -85,16 +79,6 @@ void fh_set_pos(struct fd_handle *fh, off_t pos)
 	fh->pos = pos;
 }
 
-uint32_t fh_get_private_options(struct fd_handle *fh)
-{
-	return fh->private_options;
-}
-
-void fh_set_private_options(struct fd_handle *fh, uint32_t private_options)
-{
-	fh->private_options = private_options;
-}
-
 uint64_t fh_get_gen_id(struct fd_handle *fh)
 {
 	return fh->gen_id;
diff --git a/source3/smbd/fd_handle.h b/source3/smbd/fd_handle.h
index dc0e5e43940..4d2e5093dc4 100644
--- a/source3/smbd/fd_handle.h
+++ b/source3/smbd/fd_handle.h
@@ -36,9 +36,6 @@ void fh_set_position_information(struct fd_handle *fh, uint64_t posinfo);
 off_t fh_get_pos(struct fd_handle *fh);
 void fh_set_pos(struct fd_handle *fh, off_t pos);
 
-uint32_t fh_get_private_options(struct fd_handle *fh);
-void fh_set_private_options(struct fd_handle *fh, uint32_t private_options);
-
 uint64_t fh_get_gen_id(struct fd_handle *fh);
 void fh_set_gen_id(struct fd_handle *fh, uint64_t gen_id);
 
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 4f344063d49..73c20b68004 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -2663,3 +2663,30 @@ bool fsp_getinfo_ask_sharemode(struct files_struct *fsp)
 
 	return lp_smbd_getinfo_ask_sharemode(SNUM(fsp->conn));
 }
+
+void fsp_apply_private_ntcreatex_flags(struct files_struct *fsp,
+				       uint32_t flags)
+{
+	/*
+	 * This might be called twice when first trying to open something as a
+	 * file, which fails for directories, triggering a second open-directory
+	 * attempt via open_directory(). To handle this case make sure to reset
+	 * fsp_flags if the corresponding flag is not set, as we might get passed
+	 * different flags in pass one and pass two.
+	 */
+	if (flags & NTCREATEX_FLAG_DENY_DOS) {
+		fsp->fsp_flags.ntcreatex_deny_dos = true;
+	} else {
+		fsp->fsp_flags.ntcreatex_deny_dos = false;
+	}
+	if (flags & NTCREATEX_FLAG_DENY_FCB) {
+		fsp->fsp_flags.ntcreatex_deny_fcb = true;
+	} else {
+		fsp->fsp_flags.ntcreatex_deny_fcb = false;
+	}
+	if (flags & NTCREATEX_FLAG_STREAM_BASEOPEN) {
+		fsp->fsp_flags.ntcreatex_stream_baseopen = true;
+	} else {
+		fsp->fsp_flags.ntcreatex_stream_baseopen = false;
+	}
+}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 25f54428bb1..df6606f0215 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -955,7 +955,6 @@ static NTSTATUS open_file(
 	const struct vfs_open_how *_how,
 	uint32_t access_mask,	   /* client requested access mask. */
 	uint32_t open_access_mask, /* what we're actually using in the open. */
-	uint32_t private_flags,
 	bool *p_file_created)
 {
 	connection_struct *conn = fsp->conn;
@@ -3918,7 +3917,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 		 */
 		fsp->file_id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
 	}
-	fh_set_private_options(fsp->fh, private_flags);
+	fsp_apply_private_ntcreatex_flags(fsp, private_flags);
 	fsp->access_mask = open_access_mask; /* We change this to the
 					      * requested access_mask after
 					      * the open is done. */
@@ -3971,7 +3970,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 				     &how,
 				     access_mask,
 				     open_access_mask,
-				     private_flags,
 				     &new_file_created);
 	}
 	if (NT_STATUS_EQUAL(fsp_open, NT_STATUS_NETWORK_BUSY)) {
@@ -5071,7 +5069,7 @@ static NTSTATUS open_directory(connection_struct *conn,
 	fsp->fsp_flags.can_read = false;
 	fsp->fsp_flags.can_write = false;
 
-	fh_set_private_options(fsp->fh, 0);
+	fsp_apply_private_ntcreatex_flags(fsp, 0);
 	/*
 	 * According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted,
 	 */
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 78701e3f7b6..42f629f22b5 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -431,6 +431,9 @@ NTSTATUS parent_pathref(TALLOC_CTX *mem_ctx,
 			struct smb_filename **_parent,
 			struct smb_filename **_atname);
 
+void fsp_apply_private_ntcreatex_flags(struct files_struct *fsp,
+				       uint32_t flags);
+
 /* The following definitions come from smbd/smb2_ipc.c  */
 
 NTSTATUS nt_status_np_pipe(NTSTATUS status);
diff --git a/source3/smbd/smb1_utils.c b/source3/smbd/smb1_utils.c
index d5b6c9ba452..afd9b50c12c 100644
--- a/source3/smbd/smb1_utils.c
+++ b/source3/smbd/smb1_utils.c
@@ -57,21 +57,22 @@ struct files_struct *fcb_or_dos_open(
 
 		DBG_DEBUG("Checking file %s, fd = %d, vuid = %"PRIu64", "
 			  "file_pid = %"PRIu16", "
-			  "private_options = 0x%"PRIx32", "
+			  "ntcreatex_deny_dos: %s, "
+			  "ntcreatex_deny_fcb: %s, "
 			  "access_mask = 0x%"PRIx32"\n",
 			  fsp_str_dbg(fsp),
 			  fsp_get_pathref_fd(fsp),
 			  fsp->vuid,
 			  fsp->file_pid,
-			  fh_get_private_options(fsp->fh),
+			  fsp->fsp_flags.ntcreatex_deny_dos ? "yes":"no",
+			  fsp->fsp_flags.ntcreatex_deny_fcb ? "yes":"no",
 			  fsp->access_mask);
 
 		if (fsp_get_pathref_fd(fsp) != -1 &&
 		    fsp->vuid == req->vuid &&
 		    fsp->file_pid == req->smbpid &&
-		    (fh_get_private_options(fsp->fh) &
-		     (NTCREATEX_FLAG_DENY_DOS |
-		      NTCREATEX_FLAG_DENY_FCB)) &&
+		    (fsp->fsp_flags.ntcreatex_deny_dos |
+		     fsp->fsp_flags.ntcreatex_deny_fcb) &&
 		    (fsp->access_mask & FILE_WRITE_DATA) &&
 		    strequal(fsp->fsp_name->base_name, smb_fname->base_name) &&
 		    strequal(fsp->fsp_name->stream_name,
@@ -87,7 +88,7 @@ struct files_struct *fcb_or_dos_open(
 
 	/* quite an insane set of semantics ... */
 	if (is_executable(smb_fname->base_name) &&
-	    (fh_get_private_options(fsp->fh) & NTCREATEX_FLAG_DENY_DOS)) {
+	    fsp->fsp_flags.ntcreatex_deny_dos) {
 		DBG_DEBUG("file fail due to is_executable.\n");
 		return NULL;
 	}
diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c
index c278db25239..84e48f9a648 100644
--- a/source3/smbd/smb2_oplock.c
+++ b/source3/smbd/smb2_oplock.c
@@ -1737,7 +1737,7 @@ static int delay_for_handle_lease_break_below_fn(struct share_mode_data *d,
 	}
 
 	if ((lease & SMB2_LEASE_HANDLE) == 0) {
-		if (e->flags & SHARE_MODE_FLAG_POSIX_OPEN) {
+		if (e->flags & SHARE_ENTRY_FLAG_POSIX_OPEN) {
 			DBG_DEBUG("POSIX open file-id [%s]\n", fid_bufp);
 			/* Ignore POSIX opens. */
 			return 0;
diff --git a/source3/smbd/smb2_reply.c b/source3/smbd/smb2_reply.c
index d3220978db3..00c9f2aa6e6 100644
--- a/source3/smbd/smb2_reply.c
+++ b/source3/smbd/smb2_reply.c
@@ -1751,7 +1751,6 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 			parent_dir_fname_dst_atname,
 			&rhow);
 	if (ret == 0) {
-		uint32_t create_options = fh_get_private_options(fsp->fh);
 		struct smb_filename *old_fname = NULL;
 
 		DBG_NOTICE("succeeded doing rename on "
@@ -1793,25 +1792,6 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 			}
 		}
 
-		/*
-		 * A rename acts as a new file create w.r.t. allowing an initial delete
-		 * on close, probably because in Windows there is a new handle to the
-		 * new file. If initial delete on close was requested but not
-		 * originally set, we need to set it here. This is probably not 100% correct,
-		 * but will work for the CIFSFS client which in non-posix mode
-		 * depends on these semantics. JRA.
-		 */
-
-		if (create_options & FILE_DELETE_ON_CLOSE) {
-			status = can_set_delete_on_close(fsp, 0);
-
-			if (NT_STATUS_IS_OK(status)) {
-				/* Note that here we set the *initial* delete on close flag,
-				 * not the regular one. The magic gets handled in close. */
-				fsp->fsp_flags.initial_delete_on_close = true;
-			}
-		}
-
 		TALLOC_FREE(lck);
 
 		notify_rename(conn,
diff --git a/source3/utils/status.c b/source3/utils/status.c
index f47504208e6..f02b75b7f54 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -166,7 +166,7 @@ static int prepare_share_mode(struct traverse_state *state)
 }
 
 static uint32_t map_share_mode_to_deny_mode(
-	uint32_t share_access, uint32_t private_options)
+	uint32_t share_access, uint16_t flags)
 {
 	switch (share_access & ~FILE_SHARE_DELETE) {
 	case FILE_SHARE_NONE:
@@ -178,9 +178,9 @@ static uint32_t map_share_mode_to_deny_mode(
 	case FILE_SHARE_READ|FILE_SHARE_WRITE:
 		return DENY_NONE;
 	}
-	if (private_options & NTCREATEX_FLAG_DENY_DOS) {
+	if (flags & SHARE_ENTRY_FLAG_DENY_DOS) {
 		return DENY_DOS;
-	} else if (private_options & NTCREATEX_FLAG_DENY_FCB) {
+	} else if (flags & SHARE_ENTRY_FLAG_DENY_FCB) {
 		return DENY_FCB;
 	}
 
@@ -233,7 +233,7 @@ static int print_share_mode(struct file_id fid,
 		}
 
 		denymode_int = map_share_mode_to_deny_mode(e->share_access,
-							   e->private_options);
+							   e->flags);
 		switch (denymode_int) {
 			case DENY_NONE:
 				denymode = "DENY_NONE";
@@ -264,9 +264,9 @@ static int print_share_mode(struct file_id fid,
 				fprintf(stderr,
 					"unknown-please report ! "
 					"e->share_access = 0x%x, "
-					"e->private_options = 0x%x\n",
+					"e->flags = 0x%x\n",


-- 
Samba Shared Repository



More information about the samba-cvs mailing list