From: Jeremy Allison Date: Wed, 31 Mar 2010 05:24:19 +0000 (-0700) Subject: Fix bug 7310 - DOS attribute inconsistency with MS Office X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5029023e1a44e1bfcbd4e5822d937fa03ba5a1b;p=thirdparty%2Fsamba.git Fix bug 7310 - DOS attribute inconsistency with MS Office On rename we need to set the archive bit on the renamed file. Jeremy --- diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 23fa3e885b0..2dd4bad6afa 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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);