From e7e33091dbd67532b4a610eb2ccdc1af49f41332 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 18 Nov 2016 10:20:41 -0800 Subject: [PATCH] s3/smbd: fix the last resort check that sets the file type attribute The rule is, a directory with no other attributes should return as FILE_ATTRIBUTE_DIRECTORY, a file with no other attributes should return as FILE_ATTRIBUTE_NORMAL. If a file contains any existing attributes (e.g. FILE_ATTRIBUTE_HIDDEN, don't add in the FILE_ATTRIBUTE_NORMAL attribute). BUG: https://bugzilla.samba.org/show_bug.cgi?id=12436 Signed-off-by: Jeremy Allison --- source3/smbd/dosmode.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index dab47c0..1789b55 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -636,12 +636,10 @@ uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname) result |= dos_mode_from_name(conn, smb_fname, result); - if (result == 0) { - if (S_ISDIR(smb_fname->st.st_ex_mode)) { - result = FILE_ATTRIBUTE_DIRECTORY; - } else { - result = FILE_ATTRIBUTE_NORMAL; - } + if (S_ISDIR(smb_fname->st.st_ex_mode)) { + result |= FILE_ATTRIBUTE_DIRECTORY; + } else if (result == 0) { + result = FILE_ATTRIBUTE_NORMAL; } result = filter_mode_by_protocol(result); -- 2.8.0.rc3.226.g39d4020