From 5e901f71168b0a7b528446fa0efb28fdce6df92e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke@samba.org>
Date: Sat, 30 Dec 2023 21:01:04 +0100
Subject: [PATCH 11/38] vfs_worm: move write_access_flags to global

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15997
[backported for CVE-2026-2340]

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 0022acac9a56efaca3235a10a4b1fc2b669b11a6)
---
 source3/modules/vfs_worm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source3/modules/vfs_worm.c b/source3/modules/vfs_worm.c
index f489c540c3a..0d17bbbc814 100644
--- a/source3/modules/vfs_worm.c
+++ b/source3/modules/vfs_worm.c
@@ -25,6 +25,10 @@
 struct worm_config_data {
 	double grace_period;
 };
+static const uint32_t write_access_flags = FILE_WRITE_DATA | FILE_APPEND_DATA |
+					   FILE_WRITE_ATTRIBUTES |
+					   DELETE_ACCESS | WRITE_DAC_ACCESS |
+					   WRITE_OWNER_ACCESS;
 
 static int vfs_worm_connect(struct vfs_handle_struct *handle,
 			    const char *service, const char *user)
@@ -102,10 +106,6 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
 				     const struct smb2_create_blobs *in_context_blobs,
 				     struct smb2_create_blobs *out_context_blobs)
 {
-	const uint32_t write_access_flags =
-		FILE_WRITE_DATA | FILE_APPEND_DATA |
-		FILE_WRITE_ATTRIBUTES | DELETE_ACCESS |
-		WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS;
 	NTSTATUS status;
 	bool readonly;
 
-- 
2.43.0


