1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

s3/smbd: fix the last resort check that sets the file type attribute

The rule is, a directory (with any other attributes) should always also
set FILE_ATTRIBUTE_DIRECTORY, a file should only set
FILE_ATTRIBUTE_NORMAL if no other attributes is set.

Iow, 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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Nov 19 11:55:35 CET 2016 on sn-devel-144
This commit is contained in:
Jeremy Allison 2016-11-18 10:20:41 -08:00 committed by Ralph Boehme
parent 6c6d63c044
commit a0783e8dd9

View File

@ -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);