diff options
Diffstat (limited to 'source/smbd/dosmode.c')
-rw-r--r-- | source/smbd/dosmode.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/source/smbd/dosmode.c b/source/smbd/dosmode.c index a2bc424b8e7..efbd5f04cb9 100644 --- a/source/smbd/dosmode.c +++ b/source/smbd/dosmode.c @@ -297,27 +297,28 @@ uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf) return 0; } - /* Get the DOS attributes from an EA by preference. */ - if (get_ea_dos_attribute(conn, path, sbuf, &result)) { - result |= set_sparse_flag(sbuf); - return result; - } - - result = dos_mode_from_sbuf(conn, path, sbuf); - - /* Now do any modifications that depend on the path name. */ + /* 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(path,'/'); - if (p) + if (p) { p++; - else + } else { p = path; + } - if (p[0] == '.' && p[1] != '.' && p[1] != 0) + if (p[0] == '.' && p[1] != '.' && p[1] != 0) { result |= aHIDDEN; + } } + /* Get the DOS attributes from an EA by preference. */ + if (get_ea_dos_attribute(conn, path, sbuf, &result)) { + result |= set_sparse_flag(sbuf); + } else { + result |= dos_mode_from_sbuf(conn, path, sbuf); + } + /* Optimization : Only call is_hidden_path if it's not already hidden. */ if (!(result & aHIDDEN) && IS_HIDDEN_PATH(conn,path)) { @@ -451,6 +452,17 @@ int file_utime(connection_struct *conn, const char *fname, struct utimbuf *times errno = 0; ZERO_STRUCT(sbuf); + /* Don't update the time on read-only shares */ + /* We need this as set_filetime (which can be called on + close and other paths) can end up calling this function + without the NEED_WRITE protection. Found by : + Leo Weppelman <leo@wau.mis.ah.nl> + */ + + if (!CAN_WRITE(conn)) { + return 0; + } + if(SMB_VFS_UTIME(conn,fname, times) == 0) return 0; |