Fix bug #6529 - Offline files conflict with Vista and Office 2003.
authorJeremy Allison <jra@samba.org>
Thu, 30 Jul 2009 20:19:26 +0000 (13:19 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 30 Jul 2009 20:19:26 +0000 (13:19 -0700)
We need to send a notify message when a timestamp is changed that
can't be reflected in the underlying POSIX filesystem.
Jeremy.

source3/smbd/trans2.c

index 93bd9107ac9a17ec5be621d18323050d6f3d3f31..8cbd259f634d23e89d19f4b25263a5ce62e2c3d7 100644 (file)
@@ -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;
                }
        }