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

Jeremy Allison jra at samba.org
Fri Dec 19 22:00:03 GMT 2008


The branch, v3-2-test has been updated
       via  5122f064d8d05b24c755506f4d7043c693670e80 (commit)
      from  fc86d348a41bf276c1863a0012bad3d3774bc12b (commit)

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


- Log -----------------------------------------------------------------
commit 5122f064d8d05b24c755506f4d7043c693670e80
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 19 13:58:55 2008 -0800

    Fix bug #5986 - Editing a stream is broken (rename problems).
    Jeremy.

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

Summary of changes:
 source/smbd/reply.c  |    4 +++-
 source/smbd/trans2.c |   21 +++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index e445f81..762fab1 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -5556,7 +5556,9 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 	}
 
 	if(replace_if_exists && dst_exists) {
-		if (is_ntfs_stream_name(newname)) {
+		/* Ensure both or neither are stream names. */
+		if (is_ntfs_stream_name(fsp->fsp_name) !=
+				is_ntfs_stream_name(newname)) {
 			return NT_STATUS_INVALID_PARAMETER;
 		}
 	}
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index ebf448f..b6f4c34 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -5333,6 +5333,8 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
 	char *newname = NULL;
 	char *base_name = NULL;
 	bool dest_has_wcard = False;
+	SMB_STRUCT_STAT sbuf;
+	char *newname_last_component = NULL;
 	NTSTATUS status = NT_STATUS_OK;
 	char *p;
 	TALLOC_CTX *ctx = talloc_tos();
@@ -5341,6 +5343,8 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
+	ZERO_STRUCT(sbuf);
+
 	overwrite = (CVAL(pdata,0) ? True : False);
 	root_fid = IVAL(pdata,4);
 	len = IVAL(pdata,8);
@@ -5374,6 +5378,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
 	}
 
 	if (fsp && fsp->base_fsp) {
+		/* newname must be a stream name. */
 		if (newname[0] != ':') {
 			return NT_STATUS_NOT_SUPPORTED;
 		}
@@ -5384,6 +5389,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
 			return NT_STATUS_NO_MEMORY;
 		}
 	} else {
+		/* newname must *not* be a stream name. */
 		if (is_ntfs_stream_name(newname)) {
 			return NT_STATUS_NOT_SUPPORTED;
 		}
@@ -5409,18 +5415,11 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
 		if (!base_name) {
 			return NT_STATUS_NO_MEMORY;
 		}
-	}
-
-	if (fsp) {
-		SMB_STRUCT_STAT sbuf;
-		char *newname_last_component = NULL;
-
-		ZERO_STRUCT(sbuf);
 
 		status = unix_convert(ctx, conn, newname, False,
-					&newname,
-					&newname_last_component,
-					&sbuf);
+				&newname,
+				&newname_last_component,
+				&sbuf);
 
 		/* If an error we expect this to be
 		 * NT_STATUS_OBJECT_PATH_NOT_FOUND */
@@ -5430,7 +5429,9 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
 					status)) {
 			return status;
 		}
+	}
 
+	if (fsp) {
 		DEBUG(10,("smb_file_rename_information: SMB_FILE_RENAME_INFORMATION (fnum %d) %s -> %s\n",
 			fsp->fnum, fsp->fsp_name, base_name ));
 		status = rename_internals_fsp(conn, fsp, base_name,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list