[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Feb 22 19:01:02 MST 2011


The branch, master has been updated
       via  2296871 Torture test added to run_opentest() to ensure we don't regress on the previous change.
       via  7464793 Fix bug found against the new Mac client @ Connectathon. Mac clients don't open with FILE_WRITE_ATTRIBUTES when just doing a write, so updating the write time on close fails as smb_set_file_time() now (correctly) checks for FILE_WRITE_ATTRIBUTES in the access_mask before allowing client time update. This is an internal time update being done on a close, not a handle-based client request.
      from  67e72f5 s3-waf: move some parts of auth to AUTH_COMMON to avoid duplicate symbols with winbindd.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2296871f0c3b2c2d874c8b33034d608b89c5fd6f
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Feb 22 16:40:23 2011 -0800

    Torture test added to run_opentest() to ensure we don't regress on
    the previous change.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Wed Feb 23 03:00:53 CET 2011 on sn-devel-104

commit 7464793c9d00ac2aee40b1377477eb1e2b7c8251
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Feb 22 16:38:42 2011 -0800

    Fix bug found against the new Mac client @ Connectathon. Mac clients
    don't open with FILE_WRITE_ATTRIBUTES when just doing a write, so updating
    the write time on close fails as smb_set_file_time() now (correctly) checks
    for FILE_WRITE_ATTRIBUTES in the access_mask before allowing client time
    update. This is an internal time update being done on a close, not a handle-based
    client request.

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

Summary of changes:
 source3/smbd/close.c      |   10 +++++++++-
 source3/torture/torture.c |   26 ++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 0efa36f..4234f32 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -572,8 +572,16 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
 	}
 
 	ft.mtime = fsp->close_write_time;
-	status = smb_set_file_time(fsp->conn, fsp, fsp->fsp_name, &ft, false);
+	/* We must use NULL for the fsp handle here, as smb_set_file_time()
+	   checks the fsp access_mask, which may not include FILE_WRITE_ATTRIBUTES.
+	   As this is a close based update, we are not directly changing the
+	   file attributes from a client call, but indirectly from a write. */
+	status = smb_set_file_time(fsp->conn, NULL, fsp->fsp_name, &ft, false);
 	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(10,("update_write_time_on_close: smb_set_file_time "
+			"on file %s returned %s\n",
+			fsp_str_dbg(fsp),
+			nt_errstr(status)));
 		return status;
 	}
 
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 893497e..2670485 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4440,6 +4440,7 @@ static bool run_opentest(int dummy)
 	SMB_OFF_T fsize;
 	bool correct = True;
 	char *tmp_path;
+	NTSTATUS status;
 
 	printf("starting open test\n");
 
@@ -4779,6 +4780,31 @@ static bool run_opentest(int dummy)
 
 	cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
 
+	printf("TEST #8 testing open without WRITE_ATTRIBUTES, updating close write time.\n");
+	status = cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL,
+				FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+				FILE_OVERWRITE_IF, 0, 0, &fnum1);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("TEST #8 open of %s failed (%s)\n", fname, nt_errstr(status));
+		correct = false;
+		goto out;
+	}
+
+	/* Write to ensure we have to update the file time. */
+	if (cli_write(cli1, fnum1, 0, "TEST DATA\n", 0, 10) != 10) {
+		printf("TEST #8 cli_write failed: %s\n", cli_errstr(cli1));
+		correct = false;
+		goto out;
+	}
+
+        status = cli_close(cli1, fnum1);
+        if (!NT_STATUS_IS_OK(status)) {
+                printf("TEST #8 close of %s failed (%s)\n", fname, nt_errstr(status));
+		correct = false;
+        }
+
+  out:
+
 	if (!torture_close_connection(cli1)) {
 		correct = False;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list