diff options
author | Jeremy Allison <jra@samba.org> | 2009-07-01 16:58:14 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-07-01 16:58:14 -0700 |
commit | b971860e01a3e616b0dd21990c054c8f8356f513 (patch) | |
tree | 67358448a20e4feb4fe22e6d44555f6dc7dade86 /source3 | |
parent | a14efbadd53ac9678d75e6029f947d63cfa0c4e5 (diff) | |
download | samba-b971860e01a3e616b0dd21990c054c8f8356f513.tar.gz samba-b971860e01a3e616b0dd21990c054c8f8356f513.tar.bz2 samba-b971860e01a3e616b0dd21990c054c8f8356f513.zip |
Fix bug #6520 time stamps - e.g. last mod time is not preserved when "unix extensions=yes" are set - and using latest cifs vfs client
Cancel out any pending "sticky" writes or "last write" changes when
doing a UNIX info level set.
Jeremy.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/trans2.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ef3d6d7a9a..41081ca0dd 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -4981,7 +4981,7 @@ NTSTATUS smb_set_file_time(connection_struct *conn, if (setting_write_time) { /* - * This was a setfileinfo on an open file. + * This was a Windows setfileinfo on an open file. * NT does this a lot. We also need to * set the time here, as it can be read by * FindFirst/FindNext and with the patch for bug #2045 @@ -6098,6 +6098,9 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn, NTSTATUS status = NT_STATUS_OK; bool delete_on_fail = False; enum perm_type ptype; + files_struct *all_fsps = NULL; + bool modify_mtime = true; + struct file_id id; ZERO_STRUCT(ft); @@ -6246,13 +6249,38 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n", } /* Deal with any time changes. */ + id = vfs_file_id_from_sbuf(conn, psbuf); + for(all_fsps = file_find_di_first(id); all_fsps; + all_fsps = file_find_di_next(all_fsps)) { + /* + * We're setting the time explicitly for UNIX. + * Cancel any pending changes over all handles. + */ + all_fsps->update_write_time_on_close = false; + TALLOC_FREE(all_fsps->update_write_time_event); + } - return smb_set_file_time(conn, + /* + * Override the "setting_write_time" + * parameter here as it almost does what + * we need. Just remember if we modified + * mtime and send the notify ourselves. + */ + if (null_timespec(ft.mtime)) { + modify_mtime = false; + } + + status = smb_set_file_time(conn, fsp, fname, psbuf, &ft, - true); + false); + if (modify_mtime) { + notify_fname(conn, NOTIFY_ACTION_MODIFIED, + FILE_NOTIFY_CHANGE_LAST_WRITE, fname); + } + return status; } /**************************************************************************** |