From 41ee89b2ec76c289dfa5d481870aada27516cf1e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 May 2018 10:24:35 -0700 Subject: [PATCH] s3: smbd: Add clarifying comment on mode change on overwritten files. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- source3/smbd/open.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 9d581a53359..1b83e8403d2 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3786,6 +3786,25 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, } } else if (new_unx_mode) { + /* + * We only get here in the case of: + * + * a). Not a POSIX open. + * b). File already existed. + * c). File was overwritten. + * d). Requested DOS attributes didn't match + * the DOS attributes on the existing file. + * + * In that case new_unx_mode has been set + * equal to the calculated mode (including + * possible inheritance of the mode from the + * containing directory). + * + * Note this mode was calculated with the + * DOS attribute FILE_ATTRIBUTE_ARCHIVE added, + * so the mode change here is suitable for + * an overwritten file. + */ int ret = -1; -- 2.47.2