From: Ralph Boehme Date: Thu, 23 Jun 2016 14:40:15 +0000 (+0200) Subject: s3/smbd: call dos_mode_from_name after get_ea_dos_attribute() X-Git-Tag: samba-4.3.12~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d728bc49bd5ff427139061eb45c5179db48bdf15;p=thirdparty%2Fsamba.git s3/smbd: call dos_mode_from_name after get_ea_dos_attribute() 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 (backported from commit 1be877038c53c88802bc19c00a49c1974f17c4eb) --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index a2aaa3d384c..8a44c400b7e 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -570,12 +570,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++; @@ -611,8 +614,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 from an EA by preference. */ if (!get_ea_dos_attribute(conn, smb_fname, &result)) { result |= dos_mode_from_sbuf(conn, smb_fname); @@ -632,6 +633,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) &&