[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Apr 24 10:19:03 MDT 2012


The branch, master has been updated
       via  2d01099 s3: Simplify check_reduced_name a bit
       via  d1d0f1d s3: Fix a typo
       via  1267ced s3: Introduce variable "indyniov" for easier reading
      from  84ae92d s4:libnet: pass an explicit mem_ctx to libnet_rpc_userinfo_send() (bug #8889)

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


- Log -----------------------------------------------------------------
commit 2d01099acc77d433f06f36f854f27fd9f1e43f05
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 24 14:23:11 2012 +0200

    s3: Simplify check_reduced_name a bit
    
    It's pointless to do a talloc_asprintf with a SMB_STRDUP on the
    result. Use asprintf directly.
    
    Autobuild-User: Volker Lendecke <vl at samba.org>
    Autobuild-Date: Tue Apr 24 18:18:05 CEST 2012 on sn-devel-104

commit d1d0f1d11d07ee2ae64e7a83493e5dddde8611c0
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 24 14:07:00 2012 +0200

    s3: Fix a typo

commit 1267ced693fa9ac16e8b161e2d475a2a3ea99859
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 24 12:58:23 2012 +0200

    s3: Introduce variable "indyniov" for easier reading

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

Summary of changes:
 source3/smbd/filename.c    |    2 +-
 source3/smbd/smb2_create.c |   18 ++++++++++--------
 source3/smbd/vfs.c         |   14 +++++---------
 3 files changed, 16 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 95e8c14..ac218a1 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -1276,7 +1276,7 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
  * @param ctx		talloc_ctx to allocate memory with.
  * @param conn		connection struct for vfs calls.
  * @param dfs_path	Whether this path requires dfs resolution.
- * @param smbreq	SMB request if we're using privilages.
+ * @param smbreq	SMB request if we're using privileges.
  * @param name_in	The unconverted name.
  * @param ucf_flags	flags to pass through to unix_convert().
  *			UCF_ALWAYS_ALLOW_WCARD_LCOMP will be OR'd in if
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 3e5b81d..35be328 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -100,6 +100,7 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq);
 NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req)
 {
 	const uint8_t *inbody;
+	const struct iovec *indyniov;
 	int i = smb2req->current_idx;
 	uint8_t in_oplock_level;
 	uint32_t in_impersonation_level;
@@ -163,18 +164,19 @@ NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req)
 		name_offset = in_name_offset - dyn_offset;
 	}
 
-	if (name_offset > smb2req->in.vector[i+2].iov_len) {
+	indyniov = &smb2req->in.vector[i+2];
+
+	if (name_offset > indyniov->iov_len) {
 		return smbd_smb2_request_error(smb2req, NT_STATUS_INVALID_PARAMETER);
 	}
 
-	name_available_length = smb2req->in.vector[i+2].iov_len - name_offset;
+	name_available_length = indyniov->iov_len - name_offset;
 
 	if (in_name_length > name_available_length) {
 		return smbd_smb2_request_error(smb2req, NT_STATUS_INVALID_PARAMETER);
 	}
 
-	in_name_buffer.data = (uint8_t *)smb2req->in.vector[i+2].iov_base +
-			      name_offset;
+	in_name_buffer.data = (uint8_t *)indyniov->iov_base + name_offset;
 	in_name_buffer.length = in_name_length;
 
 	if (in_context_offset == 0 && in_context_length == 0) {
@@ -186,18 +188,18 @@ NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req)
 		context_offset = in_context_offset - dyn_offset;
 	}
 
-	if (context_offset > smb2req->in.vector[i+2].iov_len) {
+	if (context_offset > indyniov->iov_len) {
 		return smbd_smb2_request_error(smb2req, NT_STATUS_INVALID_PARAMETER);
 	}
 
-	context_available_length = smb2req->in.vector[i+2].iov_len - context_offset;
+	context_available_length = indyniov->iov_len - context_offset;
 
 	if (in_context_length > context_available_length) {
 		return smbd_smb2_request_error(smb2req, NT_STATUS_INVALID_PARAMETER);
 	}
 
-	in_context_buffer.data = (uint8_t *)smb2req->in.vector[i+2].iov_base +
-				  context_offset;
+	in_context_buffer.data = (uint8_t *)indyniov->iov_base +
+		context_offset;
 	in_context_buffer.length = in_context_length;
 
 	/*
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index b330c03..6c9692a 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1089,6 +1089,7 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
 				char *dir_name = NULL;
 				const char *last_component = NULL;
 				char *new_name = NULL;
+				int ret;
 
 				/* Last component didn't exist.
 				   Remove it and try and canonicalise
@@ -1114,18 +1115,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
 						nt_errstr(status)));
 					return status;
 				}
-				new_name = talloc_asprintf(ctx,
-						"%s/%s",
-						resolved_name,
-						last_component);
-				if (!new_name) {
-					return NT_STATUS_NO_MEMORY;
-				}
+				ret = asprintf(&new_name, "%s/%s",
+					       resolved_name, last_component);
 				SAFE_FREE(resolved_name);
-				resolved_name = SMB_STRDUP(new_name);
-				if (!resolved_name) {
+				if (ret == -1) {
 					return NT_STATUS_NO_MEMORY;
 				}
+				resolved_name = new_name;
 				break;
 			}
 			default:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list