From: Ralph Boehme Date: Thu, 23 Jun 2016 15:14:55 +0000 (+0200) Subject: s3/smbd: move check for "hide files" to dos_mode_from_name() X-Git-Tag: samba-4.3.12~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ecd8a2a0900786ad45beaf9f890d579ecd1c270;p=thirdparty%2Fsamba.git s3/smbd: move check for "hide files" to dos_mode_from_name() Consolidate the "hide dot files" and "hide files" handling stuff in one function. No change in overall behaviour. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11992 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit f2a53efb1aab0986d6a7d9621b1efff2127df4e6) --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 8a44c400b7e..2bb5a4aa132 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -594,6 +594,12 @@ static uint32_t dos_mode_from_name(connection_struct *conn, } } + if (!(result & FILE_ATTRIBUTE_HIDDEN) && + IS_HIDDEN_PATH(conn, smb_fname->base_name)) + { + result |= FILE_ATTRIBUTE_HIDDEN; + } + return result; } @@ -635,13 +641,6 @@ uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname) result |= dos_mode_from_name(conn, smb_fname, result); - /* Optimization : Only call is_hidden_path if it's not already - hidden. */ - if (!(result & FILE_ATTRIBUTE_HIDDEN) && - IS_HIDDEN_PATH(conn, smb_fname->base_name)) { - result |= FILE_ATTRIBUTE_HIDDEN; - } - if (result == 0) { result = FILE_ATTRIBUTE_NORMAL; }