]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: add and use NTCREATEX_FLAG_PERSISTENT_OPEN
authorRalph Boehme <slow@samba.org>
Tue, 7 Oct 2025 16:40:32 +0000 (18:40 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
This will be used by the SMB2-CREATE code to request a Persistent Handle from
SMB_VFS_CREATE_FILE().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/include/smb.h
source3/smbd/files.c

index 50e265f28b0a4bad4638d65222c77694e29a1f46..bbbd4a7ea3ebcb15026c4d598b3a6e82b1f75757 100644 (file)
@@ -325,6 +325,7 @@ struct interface {
  */
 #define NTCREATEX_FLAG_DENY_DOS                        0x0001
 #define NTCREATEX_FLAG_DENY_FCB                        0x0002
+#define NTCREATEX_FLAG_PERSISTENT_OPEN         0x0004
 
 /* Private flag for streams support */
 #define NTCREATEX_FLAG_STREAM_BASEOPEN         0x0010
index 363d169677e22460d5c724efe899b0b3c13d25bd..fa2e86ce664eddf4db5d40250137b646b0f2d42a 100644 (file)
@@ -2714,4 +2714,13 @@ void fsp_apply_private_ntcreatex_flags(struct files_struct *fsp,
        } else {
                fsp->fsp_flags.ntcreatex_stream_baseopen = false;
        }
+       if (flags & NTCREATEX_FLAG_PERSISTENT_OPEN) {
+               /*
+                * Dereferencing op would crash anyway if NULL, but the assert
+                * makes it more clear that op is expected when getting
+                * NTCREATEX_FLAG_PERSISTENT_OPEN.
+                */
+               SMB_ASSERT(fsp->op);
+               fsp->op->global->persistent = true;
+       }
 }