[SCM] Samba Shared Repository - branch v3-4-test updated

Karolin Seeger kseeger at samba.org
Tue Dec 1 01:33:55 MST 2009


The branch, v3-4-test has been updated
       via  24282f2... Fix bug #6898 - Samba duplicates file content on appending. Move posix case semantics out from under the VFS. Jeremy.
      from  b1243ff... s3: Fix shadow copy display on Windows 7

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


- Log -----------------------------------------------------------------
commit 24282f2a282ba4ef78108d983d1ef4a6ad4cbf89
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 23 19:19:07 2009 -0800

    Fix bug #6898 - Samba duplicates file content on appending. Move posix case semantics out from under the VFS. Jeremy.

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

Summary of changes:
 source3/smbd/nttrans.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 source3/smbd/open.c    |   11 -----------
 2 files changed, 43 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index dfe59f0..4bfbcd1 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -436,6 +436,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
 	NTSTATUS status;
 	int oplock_request;
 	uint8_t oplock_granted = NO_OPLOCK_RETURN;
+	struct case_semantics_state *case_state = NULL;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	START_PROFILE(SMBntcreateX);
@@ -509,6 +510,25 @@ void reply_ntcreate_and_X(struct smb_request *req)
 			? BATCH_OPLOCK : 0;
 	}
 
+	/*
+	 * Check if POSIX semantics are wanted.
+	 */
+
+	if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
+		case_state = set_posix_case_semantics(ctx, conn);
+		if (!case_state) {
+			reply_nterror(req, NT_STATUS_NO_MEMORY);
+			END_PROFILE(SMBntcreateX);
+			return;
+		}
+		/*
+		 * Bug #6898 - clients using Windows opens should
+		 * never be able to set this attribute into the
+		 * VFS.
+		 */
+		file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
+	}
+
 	status = SMB_VFS_CREATE_FILE(
 		conn,					/* conn */
 		req,					/* req */
@@ -528,6 +548,8 @@ void reply_ntcreate_and_X(struct smb_request *req)
 		&info,					/* pinfo */
 		&sbuf);					/* psbuf */
 
+	TALLOC_FREE(case_state);
+
 	if (!NT_STATUS_IS_OK(status)) {
 		if (open_was_deferred(req->mid)) {
 			/* We have re-scheduled this call, no error. */
@@ -864,6 +886,7 @@ static void call_nt_transact_create(connection_struct *conn,
 	uint64_t allocation_size;
 	int oplock_request;
 	uint8_t oplock_granted;
+	struct case_semantics_state *case_state = NULL;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	SET_STAT_INVALID(sbuf);
@@ -983,6 +1006,24 @@ static void call_nt_transact_create(connection_struct *conn,
 			? BATCH_OPLOCK : 0;
 	}
 
+	/*
+	 * Check if POSIX semantics are wanted.
+	 */
+
+	if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
+		case_state = set_posix_case_semantics(ctx, conn);
+		if (!case_state) {
+			reply_nterror(req, NT_STATUS_NO_MEMORY);
+			return;
+		}
+		/*
+		 * Bug #6898 - clients using Windows opens should
+		 * never be able to set this attribute into the
+		 * VFS.
+		 */
+		file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
+	}
+
 	status = SMB_VFS_CREATE_FILE(
 		conn,					/* conn */
 		req,					/* req */
@@ -1002,6 +1043,8 @@ static void call_nt_transact_create(connection_struct *conn,
 		&info,					/* pinfo */
 		&sbuf);					/* psbuf */
 
+	TALLOC_FREE(case_state);
+
 	if(!NT_STATUS_IS_OK(status)) {
 		if (open_was_deferred(req->mid)) {
 			/* We have re-scheduled this call, no error. */
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 16cad8a..ab3bf1e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3344,7 +3344,6 @@ NTSTATUS create_file_default(connection_struct *conn,
 			     int *pinfo,
 			     SMB_STRUCT_STAT *psbuf)
 {
-	struct case_semantics_state *case_state = NULL;
 	SMB_STRUCT_STAT sbuf;
 	int info = FILE_WAS_OPENED;
 	files_struct *fsp = NULL;
@@ -3443,14 +3442,6 @@ NTSTATUS create_file_default(connection_struct *conn,
 		}
 	}
 
-	/*
-	 * Check if POSIX semantics are wanted.
-	 */
-
-	if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
-		case_state = set_posix_case_semantics(talloc_tos(), conn);
-	}
-
 	if (create_file_flags & CFF_DOS_PATH) {
 		char *converted_fname;
 
@@ -3473,8 +3464,6 @@ NTSTATUS create_file_default(connection_struct *conn,
 
 	}
 
-	TALLOC_FREE(case_state);
-
 	/* All file access must go through check_name() */
 
 	status = check_name(conn, fname);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list