From 95abd2f59fa98159a7dee2ca18da849631781275 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 31 Oct 2023 12:25:38 +0100 Subject: [PATCH] smbd: allow setting ARCHIVE bit in POSIX context with "store dos attributes" Cf https://lists.samba.org/archive/samba-technical/2023-October/138504.html Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/smbd/dosmode.c | 6 ++++-- source3/torture/test_posix.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index b388b5dc581..c0fc468cdfb 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -925,8 +925,10 @@ int file_set_dosmode(connection_struct *conn, return -1; } - if (fsp->fsp_flags & FSP_POSIX_FLAGS_OPEN) { - return; + if (smb_fname->fsp->posix_flags & FSP_POSIX_FLAGS_OPEN && + !lp_store_dos_attributes(SNUM(conn))) + { + return 0; } unixmode = smb_fname->st.st_ex_mode; diff --git a/source3/torture/test_posix.c b/source3/torture/test_posix.c index d0289abb834..28198451166 100644 --- a/source3/torture/test_posix.c +++ b/source3/torture/test_posix.c @@ -143,7 +143,7 @@ bool run_posix_ls_wildcard_test(int dummy) .name = symlnk_in_share, .target = symlnk_dst_in_share, .expected = symlnk_in_share, - .attr_win = FILE_ATTRIBUTE_NORMAL, + .attr_win = FILE_ATTRIBUTE_ARCHIVE, .attr_lin = FILE_ATTRIBUTE_NORMAL, }, { .name = symlnk_outside_share, @@ -319,7 +319,7 @@ bool run_posix_ls_single_test(int dummy) .name = symlnk_in_share, .target = symlnk_dst_in_share, .expected = symlnk_in_share, - .attr_win = FILE_ATTRIBUTE_NORMAL, + .attr_win = FILE_ATTRIBUTE_ARCHIVE, .attr_lin = FILE_ATTRIBUTE_NORMAL, }, { .name = symlnk_outside_share,