Always set the attribute first, before the time.
authorJeremy Allison <jra@samba.org>
Wed, 16 Nov 2011 00:49:42 +0000 (16:49 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 16 Nov 2011 01:01:58 +0000 (17:01 -0800)
source3/smbd/reply.c

index 0adc4e80f69ef654932f1f8d519390546e51b7a0..541789d846d521a0f4a619cf7a4681ebb0b6ed67 100644 (file)
@@ -1269,13 +1269,6 @@ void reply_setatr(struct smb_request *req)
        mode = SVAL(req->vwv+0, 0);
        mtime = srv_make_unix_date3(req->vwv+1);
 
-       ft.mtime = convert_time_t_to_timespec(mtime);
-       status = smb_set_file_time(conn, NULL, smb_fname, &ft, true);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               goto out;
-       }
-
        if (mode != FILE_ATTRIBUTE_NORMAL) {
                if (VALID_STAT_OF_DIR(smb_fname->st))
                        mode |= FILE_ATTRIBUTE_DIRECTORY;
@@ -1289,6 +1282,13 @@ void reply_setatr(struct smb_request *req)
                }
        }
 
+       ft.mtime = convert_time_t_to_timespec(mtime);
+       status = smb_set_file_time(conn, NULL, smb_fname, &ft, true);
+       if (!NT_STATUS_IS_OK(status)) {
+               reply_nterror(req, status);
+               goto out;
+       }
+
        reply_outbuf(req, 0, 0);
 
        DEBUG(3, ("setatr name=%s mode=%d\n", smb_fname_str_dbg(smb_fname),