[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Mon Feb 24 11:17:04 MST 2014


The branch, master has been updated
       via  695ece2 s4: tidy up vfs smb2 in regards to using share_string_option
       via  d8d0619 s4: tidy up vfs cifs in regards to using share_string_option
       via  209386b s4: tidy up some null checks in ntvfs
      from  8cd8aa6 libcli: Overflow array index read possible, in auth code.

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


- Log -----------------------------------------------------------------
commit 695ece206b3365c99499e424e0dba43ce5de9300
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 21 09:34:45 2014 +1300

    s4: tidy up vfs smb2 in regards to using share_string_option
    
    Change-Id: Ieae6b5ddc2cd9983489c374605e4740371e81883
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Kamen Mazdrashki <kamenim at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Mon Feb 24 19:16:48 CET 2014 on sn-devel-104

commit d8d06193daad86ea7c38b78b5949d404eabb0636
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 21 09:29:38 2014 +1300

    s4: tidy up vfs cifs in regards to using share_string_option
    
    Change-Id: I014bce667d3f875a913dbccf269b514f7ffbab7b
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Kamen Mazdrashki <kamenim at samba.org>

commit 209386bbd3177fbd310b36e2d8f09c6ba7f556d3
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 21 09:06:25 2014 +1300

    s4: tidy up some null checks in ntvfs
    
    Change-Id: I629a299bea10b063de4525020a4c6b838260cd67
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Kamen Mazdrashki <kamenim at samba.org>

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

Summary of changes:
 source4/ntvfs/cifs/vfs_cifs.c |   47 +++++++++++++++++++++--------------------
 source4/ntvfs/smb2/vfs_smb2.c |   46 ++++++++++++++++++++--------------------
 2 files changed, 47 insertions(+), 46 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 16bbf97..355b0bd 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -173,7 +173,8 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 		sharename = tcon->smb2.in.path;
 		break;
 	default:
-		return NT_STATUS_INVALID_LEVEL;
+		status = NT_STATUS_INVALID_LEVEL;
+		goto out;
 	}
 
 	if (strncmp(sharename, "\\\\", 2) == 0) {
@@ -200,23 +201,24 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 
 	p = talloc_zero(ntvfs, struct cvfs_private);
 	if (!p) {
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_NO_MEMORY;
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
 	}
 
 	ntvfs->private_data = p;
 
 	if (!host) {
 		DEBUG(1,("CIFS backend: You must supply server\n"));
-		return NT_STATUS_INVALID_PARAMETER;
+		status = NT_STATUS_INVALID_PARAMETER;
+		goto out;
 	} 
 	
 	if (user && pass) {
 		DEBUG(5, ("CIFS backend: Using specified password\n"));
 		credentials = cli_credentials_init(p);
 		if (!credentials) {
-			TALLOC_FREE(tmp_ctx);
-			return NT_STATUS_NO_MEMORY;
+			status = NT_STATUS_NO_MEMORY;
+			goto out;
 		}
 		cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
 		cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
@@ -233,8 +235,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 		}
 		status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
 		if (!NT_STATUS_IS_OK(status)) {
-			TALLOC_FREE(tmp_ctx);
-			return status;
+			goto out;
 		}
 	} else if (req->session_info->credentials) {
 		DEBUG(5, ("CIFS backend: Using delegated credentials\n"));
@@ -265,8 +266,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 		}
 		status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
 		if (!NT_STATUS_IS_OK(status)) {
-			TALLOC_FREE(tmp_ctx);
-			return status;
+			goto out;
 		}
 		cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
 		cli_credentials_set_impersonate_principal(credentials,
@@ -282,14 +282,13 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 			status = NT_STATUS_CROSSREALM_DELEGATION_FAILURE;
 			DEBUG(1,("S4U2Proxy: cli_credentials_get_ccache() gave: ret[%d] str[%s] - %s\n",
 				ret, err_str, nt_errstr(status)));
-			TALLOC_FREE(tmp_ctx);
-			return status;
+			goto out;
 		}
 
 	} else {
 		DEBUG(1,("CIFS backend: NO delegated credentials found: You must supply server, user and password or the client must supply delegated credentials\n"));
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_INTERNAL_ERROR;
+		status = NT_STATUS_INTERNAL_ERROR;
+		goto out;
 	}
 
 	/* connect to the server, using the smbd event context */
@@ -315,8 +314,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 					  ntvfs->ctx->event_ctx);
 	status = smb_composite_connect_recv(creq, p);
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(tmp_ctx);
-		return status;
+		goto out;
 	}
 
 	p->tree = io.out.tree;
@@ -326,14 +324,14 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 	p->ntvfs = ntvfs;
 
 	ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
-	if (!ntvfs->ctx->fs_type) {
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_NO_MEMORY;
+	if (ntvfs->ctx->fs_type == NULL) {
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
 	}
 	ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
-	if (!ntvfs->ctx->dev_type) {
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_NO_MEMORY;
+	if (ntvfs->ctx->dev_type == NULL) {
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
 	}
 
 	if (tcon->generic.level == RAW_TCON_TCONX) {
@@ -348,8 +346,11 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 
 	p->map_trans2 = share_bool_option(scfg, CIFS_MAP_TRANS2, CIFS_MAP_TRANS2_DEFAULT);
 
+	status = NT_STATUS_OK;
+
+out:
 	TALLOC_FREE(tmp_ctx);
-	return NT_STATUS_OK;
+	return status;
 }
 
 /*
diff --git a/source4/ntvfs/smb2/vfs_smb2.c b/source4/ntvfs/smb2/vfs_smb2.c
index bb9a235..a3a670a 100644
--- a/source4/ntvfs/smb2/vfs_smb2.c
+++ b/source4/ntvfs/smb2/vfs_smb2.c
@@ -185,8 +185,8 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 		sharename = tcon->smb2.in.path;
 		break;
 	default:
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_INVALID_LEVEL;
+		status = NT_STATUS_INVALID_LEVEL;
+		goto out;
 	}
 
 	if (strncmp(sharename, "\\\\", 2) == 0) {
@@ -212,24 +212,24 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 
 	p = talloc_zero(ntvfs, struct cvfs_private);
 	if (!p) {
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_NO_MEMORY;
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
 	}
 
 	ntvfs->private_data = p;
 
 	if (!host) {
 		DEBUG(1,("CIFS backend: You must supply server\n"));
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_INVALID_PARAMETER;
+		status = NT_STATUS_INVALID_PARAMETER;
+		goto out;
 	} 
 	
 	if (user && pass) {
 		DEBUG(5, ("CIFS backend: Using specified password\n"));
 		credentials = cli_credentials_init(p);
 		if (!credentials) {
-			TALLOC_FREE(tmp_ctx);
-			return NT_STATUS_NO_MEMORY;
+			status = NT_STATUS_NO_MEMORY;
+			goto out;
 		}
 		cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
 		cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
@@ -246,16 +246,15 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 		}
 		status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
 		if (!NT_STATUS_IS_OK(status)) {
-			TALLOC_FREE(tmp_ctx);
-			return status;
+			goto out;
 		}
 	} else if (req->session_info->credentials) {
 		DEBUG(5, ("CIFS backend: Using delegated credentials\n"));
 		credentials = req->session_info->credentials;
 	} else {
 		DEBUG(1,("CIFS backend: NO delegated credentials found: You must supply server, user and password or the client must supply delegated credentials\n"));
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_INVALID_PARAMETER;
+		status = NT_STATUS_INVALID_PARAMETER;
+		goto out;
 	}
 
 	lpcfg_smbcli_options(ntvfs->ctx->lp_ctx, &options);
@@ -270,14 +269,12 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 			lpcfg_socket_options(ntvfs->ctx->lp_ctx),
 			lpcfg_gensec_settings(p, ntvfs->ctx->lp_ctx));
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(tmp_ctx);
-		return status;
+		goto out;
 	}
 
 	status = smb2_get_roothandle(tree, &p->roothandle);
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(tmp_ctx);
-		return status;
+		goto out;
 	}
 
 	p->tree = tree;
@@ -285,14 +282,14 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 	p->ntvfs = ntvfs;
 
 	ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
-	if (!ntvfs->ctx->fs_type) {
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_NO_MEMORY;
+	if (ntvfs->ctx->fs_type == NULL) {
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
 	}
 	ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
-	if (!ntvfs->ctx->dev_type) {
-		TALLOC_FREE(tmp_ctx);
-		return NT_STATUS_NO_MEMORY;
+	if (ntvfs->ctx->dev_type == NULL) {
+		status = NT_STATUS_NO_MEMORY;
+		goto out;
 	}
 
 	if (tcon->generic.level == RAW_TCON_TCONX) {
@@ -305,8 +302,11 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 	smbcli_oplock_handler(p->transport, oplock_handler, p);
 	*/
 
+	status = NT_STATUS_OK;
+
+out:
 	TALLOC_FREE(tmp_ctx);
-	return NT_STATUS_OK;
+	return status;
 }
 
 /*


-- 
Samba Shared Repository


More information about the samba-cvs mailing list