From: Ralph Boehme Date: Tue, 7 Oct 2025 16:40:32 +0000 (+0200) Subject: smbd: add and use NTCREATEX_FLAG_PERSISTENT_OPEN X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da58bd9733325ecd6667dcf7441ab14abde671e2;p=thirdparty%2Fsamba.git smbd: add and use NTCREATEX_FLAG_PERSISTENT_OPEN This will be used by the SMB2-CREATE code to request a Persistent Handle from SMB_VFS_CREATE_FILE(). Signed-off-by: Ralph Boehme Reviewed-by: Anoop C S --- diff --git a/source3/include/smb.h b/source3/include/smb.h index 50e265f28b0..bbbd4a7ea3e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -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 diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 363d169677e..fa2e86ce664 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -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; + } }