diff options
-rw-r--r-- | source3/smbd/trans2.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 93bd9107ac..8cbd259f63 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5194,6 +5194,8 @@ NTSTATUS smb_set_file_time(connection_struct *conn, uint32 action = FILE_NOTIFY_CHANGE_LAST_ACCESS |FILE_NOTIFY_CHANGE_LAST_WRITE; + bool set_createtime = false; + bool set_ctime = false; NTSTATUS status; if (!VALID_STAT(smb_fname->st)) { @@ -5201,6 +5203,16 @@ NTSTATUS smb_set_file_time(connection_struct *conn, } /* get some defaults (no modifications) if any info is zero or -1. */ + if (null_timespec(ft->create_time)) { + ft->create_time = smb_fname->st.st_ex_btime; + } else { + set_createtime = true; + } + + if (!null_timespec(ft->ctime)) { + set_ctime = true; + } + if (null_timespec(ft->atime)) { ft->atime= smb_fname->st.st_ex_atime; action &= ~FILE_NOTIFY_CHANGE_LAST_ACCESS; @@ -5235,6 +5247,10 @@ NTSTATUS smb_set_file_time(connection_struct *conn, struct timespec ats = smb_fname->st.st_ex_atime; if ((timespec_compare(&ft->atime, &ats) == 0) && (timespec_compare(&ft->mtime, &mts) == 0)) { + if (set_createtime || set_ctime) { + notify_fname(conn, NOTIFY_ACTION_MODIFIED, action, + smb_fname->base_name); + } return NT_STATUS_OK; } } |