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

smbd: Simplify dos_mode_msdfs()

This is exactly what dos_mode_from_name() does.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke
2023-06-20 15:34:28 +02:00
parent c921cdf87e
commit 08e881aeb5

View File

@ -572,31 +572,9 @@ uint32_t dos_mode_msdfs(connection_struct *conn,
return 0;
}
/* First do any modifications that depend on the path name. */
/* hide files with a name starting with a . */
if (lp_hide_dot_files(SNUM(conn))) {
const char *p = strrchr_m(smb_fname->base_name, '/');
if (p) {
p++;
} else {
p = smb_fname->base_name;
}
/* Only . and .. are not hidden. */
if ((p[0] == '.') && !(ISDOT(p) || ISDOTDOT(p))) {
result |= FILE_ATTRIBUTE_HIDDEN;
}
}
result = dos_mode_from_name(conn, smb_fname, result);
result |= dos_mode_from_sbuf(conn, smb_fname);
/* 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;
}