]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix bug 7310 - DOS attribute inconsistency with MS Office
authorJeremy Allison <jra@samba.org>
Wed, 31 Mar 2010 05:24:19 +0000 (22:24 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 1 Apr 2010 06:51:42 +0000 (08:51 +0200)
On rename we need to set the archive bit on the renamed file.

Jeremy

source3/smbd/reply.c

index 23fa3e885b0c25bd662b82e312c91a8a17cc5fbd..2dd4bad6afadeaf2006aa86169d1833092f20720 100644 (file)
@@ -5815,6 +5815,23 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                DEBUG(3,("rename_internals_fsp: succeeded doing rename on %s -> %s\n",
                        fsp->fsp_name,newname));
 
+               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,newname,&sbuf1) == 0) {
+                               uint32_t old_dosmode = dos_mode(conn,
+                                                       newname,
+                                                       &sbuf1);
+                               file_set_dosmode(conn,
+                                       newname,
+                                       old_dosmode | FILE_ATTRIBUTE_ARCHIVE,
+                                       &sbuf1,
+                                       NULL,
+                                       true);
+                       }
+               }
+
                notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname);
 
                rename_open_files(conn, lck, newname);