diff options
author | Jeremy Allison <jra@samba.org> | 2009-11-05 16:20:11 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-11-05 16:20:11 -0800 |
commit | 7f9fe127ba31e6dd064d090d5ffc8eeb377627ab (patch) | |
tree | 6b2c63f2d022c82c14ea517bac06e49a605b4f5e /source3/smbd/close.c | |
parent | c2df97f57ce205935c37cd5a90cfeddb129cd92b (diff) | |
download | samba-7f9fe127ba31e6dd064d090d5ffc8eeb377627ab.tar.gz samba-7f9fe127ba31e6dd064d090d5ffc8eeb377627ab.tar.bz2 samba-7f9fe127ba31e6dd064d090d5ffc8eeb377627ab.zip |
Get closer to an accurate model of Windows timestamp changes.
"Normal" non truncate writes always cause the timestamp to
be set on close. Once a close is done on a handle this can
reset the sticky write time to current time also.
Updated smbtorture4 confirms this.
Jeremy.
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r-- | source3/smbd/close.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 642864f27e..c1623ce290 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -291,7 +291,15 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, } if (fsp->write_time_forced) { - set_close_write_time(fsp, lck->changed_write_time); + DEBUG(10,("close_remove_share_mode: write time forced " + "for file %s\n", + fsp_str_dbg(fsp))); + set_close_write_time(lck, fsp, lck->changed_write_time); + } else if (fsp->update_write_time_on_close) { + DEBUG(10,("close_remove_share_mode: update_write_time_on_close " + "set for file %s\n", + fsp_str_dbg(fsp))); + set_close_write_time(lck, fsp, timespec_current()); } if (!del_share_mode(lck, fsp)) { @@ -468,7 +476,8 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, return status; } -void set_close_write_time(struct files_struct *fsp, struct timespec ts) +void set_close_write_time(struct share_mode_lock *lck, + struct files_struct *fsp, struct timespec ts) { DEBUG(6,("close_write_time: %s" , time_to_asc(convert_timespec_to_time_t(ts)))); @@ -483,6 +492,14 @@ void set_close_write_time(struct files_struct *fsp, struct timespec ts) fsp->update_write_time_on_close = true; fsp->close_write_time = ts; + + /* On close if we're changing the real file time we + * must update it in the open file db too. */ + (void)set_write_time(fsp->file_id, ts); + /* If someone has a sticky write time then update it as well. */ + if (lck && !null_timespec(lck->changed_write_time)) { + (void)set_sticky_write_time(fsp->file_id, ts); + } } static NTSTATUS update_write_time_on_close(struct files_struct *fsp) |