]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: add fsp_apply_private_ntcreatex_flags()
authorRalph Boehme <slow@samba.org>
Fri, 28 Mar 2025 12:10:13 +0000 (13:10 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 9 Apr 2025 13:40:36 +0000 (13:40 +0000)
Not used yet, comes next.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/files.c
source3/smbd/proto.h

index 4f344063d49d74c112e324b2749ca1562ab4a747..73c20b680043478827152a3594a5efd82b1eb867 100644 (file)
@@ -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;
+       }
+}
index 78701e3f7b6b2452df6a67b89dc30ec74f86c6d6..42f629f22b58bfaf6722d3fd00955235377fa419 100644 (file)
@@ -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);