[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3636-g00aaf9a

Karolin Seeger kseeger at samba.org
Thu Jul 2 06:41:22 GMT 2009


The branch, v3-2-test has been updated
       via  00aaf9a46a202d7cd0a8cd3b8e2f9d95238a761a (commit)
      from  8fe47789306605c174a800e549991027b9203f4c (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 00aaf9a46a202d7cd0a8cd3b8e2f9d95238a761a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jul 2 08:37:59 2009 +0200

    Fix bug #6520 time stamps.
    
    E.g. last mod time is not preserved when "unix extensions=yes" are set - and u
    Cancel out any pending "sticky" writes or "last write" changes when
    doing a UNIX info level set.
    
    Jeremy.
    (cherry picked from commit 5b03af33ad45368bea7cf6cabc91f62e2503de99)

-----------------------------------------------------------------------

Summary of changes:
 source/smbd/trans2.c |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index 4dcc245..9e675fc 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -4908,7 +4908,7 @@ NTSTATUS smb_set_file_time(connection_struct *conn,
 
 	if (setting_write_time) {
 		/*
-		 * This was a setfileinfo on an open file.
+		 * This was a Windows setfileinfo on an open file.
 		 * NT does this a lot. We also need to 
 		 * set the time here, as it can be read by 
 		 * FindFirst/FindNext and with the patch for bug #2045
@@ -5977,6 +5977,9 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn,
 	NTSTATUS status = NT_STATUS_OK;
 	bool delete_on_fail = False;
 	enum perm_type ptype;
+	files_struct *all_fsps = NULL;
+	bool modify_mtime = true;
+	struct file_id id;
 
 	if (total_data < 100) {
 		return NT_STATUS_INVALID_PARAMETER;
@@ -6123,13 +6126,39 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
 	}
 
 	/* Deal with any time changes. */
+	id = vfs_file_id_from_sbuf(conn, psbuf);
+	for(all_fsps = file_find_di_first(id); all_fsps;
+			all_fsps = file_find_di_next(all_fsps)) {
+		/*
+		 * We're setting the time explicitly for UNIX.
+		 * Cancel any pending changes over all handles.
+		 */
+		all_fsps->update_write_time_on_close = false;
+		TALLOC_FREE(all_fsps->update_write_time_event);
+	}
 
-	return smb_set_file_time(conn,
+	/*
+	 * Override the "setting_write_time"
+	 * parameter here as it almost does what
+	 * we need. Just remember if we modified
+	 * mtime and send the notify ourselves.
+	 */
+	if (null_timespec(ts[1])) {
+		modify_mtime = false;
+	}
+
+	status = smb_set_file_time(conn,
 				fsp,
 				fname,
 				psbuf,
 				ts,
-				true);
+				false);
+
+	if (modify_mtime) {
+		notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+			FILE_NOTIFY_CHANGE_LAST_WRITE, fname);
+	}
+	return status;
 }
 
 /****************************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list