Fix bug 7310 - DOS attribute inconsistency with MS Office
authorJeremy Allison <jra@samba.org>
Wed, 31 Mar 2010 05:16:37 +0000 (22:16 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 31 Mar 2010 17:10:52 +0000 (10:10 -0700)
On rename we need to set the archive bit on the renamed file.

Jeremy

source3/smbd/reply.c

index fdcf4870e83008aa947cc3f722a40bf780a6aebc..c34e7f8b067737cdd707b55f967727f142b7f4ab 100644 (file)
@@ -5905,6 +5905,21 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                          "%s -> %s\n", smb_fname_str_dbg(fsp->fsp_name),
                          smb_fname_str_dbg(smb_fname_dst)));
 
+               if (lp_map_archive(SNUM(conn)) ||
+                   lp_store_dos_attributes(SNUM(conn))) {
+                       /* We must set the archive bit on the newly
+                          renamed file. */
+                       if (SMB_VFS_STAT(conn, smb_fname_dst) == 0) {
+                               uint32_t old_dosmode = dos_mode(conn,
+                                                       smb_fname_dst);
+                               file_set_dosmode(conn,
+                                       smb_fname_dst,
+                                       old_dosmode | FILE_ATTRIBUTE_ARCHIVE,
+                                       NULL,
+                                       true);
+                       }
+               }
+
                notify_rename(conn, fsp->is_directory, fsp->fsp_name,
                              smb_fname_dst);