From: Ralph Boehme Date: Thu, 23 Jun 2016 14:40:15 +0000 (+0200) Subject: s3/smbd: call dos_mode_from_name after SMB_VFS_GET_DOS_ATTRIBUTES() X-Git-Tag: tdb-1.3.10~712 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1be877038c53c88802bc19c00a49c1974f17c4eb;p=thirdparty%2Fsamba.git s3/smbd: call dos_mode_from_name after SMB_VFS_GET_DOS_ATTRIBUTES() This doesn't change overall behaviour in any way, it just prepares for the next step where the IS_HIDDEN_PATH() stuff will be moved to the function dos_mode_from_name(). It allows an optimisation by not checking "hide to files" patch if FILE_ATTRIBUTE_HIDDEN was already set in the DOS xattr. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11992 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 463c43e66c2..f59ed79d3f8 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -563,12 +563,15 @@ err_out: } static uint32_t dos_mode_from_name(connection_struct *conn, - const struct smb_filename *smb_fname) + const struct smb_filename *smb_fname, + uint32_t dosmode) { const char *p = NULL; - uint32_t result = 0; + uint32_t result = dosmode; - if (lp_hide_dot_files(SNUM(conn))) { + if (!(result & FILE_ATTRIBUTE_HIDDEN) && + lp_hide_dot_files(SNUM(conn))) + { p = strrchr_m(smb_fname->base_name, '/'); if (p) { p++; @@ -605,8 +608,6 @@ uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname) return 0; } - result |= dos_mode_from_name(conn, smb_fname); - /* Get the DOS attributes via the VFS if we can */ status = SMB_VFS_GET_DOS_ATTRIBUTES(conn, smb_fname, &result); if (!NT_STATUS_IS_OK(status)) { @@ -627,6 +628,8 @@ 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) &&