]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/smbd: move check for "hide files" to dos_mode_from_name()
authorRalph Boehme <slow@samba.org>
Thu, 23 Jun 2016 15:14:55 +0000 (17:14 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 28 Jun 2016 14:11:19 +0000 (16:11 +0200)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f2a53efb1aab0986d6a7d9621b1efff2127df4e6)

source3/smbd/dosmode.c

index 8a44c400b7e88ffee65248df9fca2bca92235875..2bb5a4aa132618da0178ee68e8a39688f76fa3ed 100644 (file)
@@ -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;
        }