From: Jeremy Allison Date: Thu, 17 May 2018 17:24:35 +0000 (-0700) Subject: s3: smbd: Add clarifying comment on mode change on overwritten files. X-Git-Tag: ldb-1.4.0~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41ee89b2ec76c289dfa5d481870aada27516cf1e;p=thirdparty%2Fsamba.git s3: smbd: Add clarifying comment on mode change on overwritten files. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- 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;