[SCM] Samba Shared Repository - branch master updated

Simo Sorce idra at samba.org
Fri Feb 21 16:59:04 MST 2014


The branch, master has been updated
       via  2b77b07 s3/libsmb: Free memdup'd local variable
       via  9a9e569 passdb: Patch memory leak in pdb_ldap.c
      from  293aac0 testprogs: Fix pkinit test with system ldb.

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


- Log -----------------------------------------------------------------
commit 2b77b072862accc3fffddc964740917102898567
Author: Jose A. Rivera <jarrpa at redhat.com>
Date:   Thu Feb 20 09:14:59 2014 -0600

    s3/libsmb: Free memdup'd local variable
    
    secrets_fetch_machine_password() sets pwd to point to memdup()'d (and thus
    malloc()'d) memory. This memory should be freed before we go out of scope.
    
    Change-Id: I07e575819c309fa5b85627dce2eb969bc720ce4e
    Coverity-Id: 1168001
    Reviewed-by: Ira Cooper <ira at samba.org>
    Signed-off-by: Jose A. Rivera <jarrpa at redhat.com>
    Reviewed-by: Simo Sorce <idra at samba.org>
    
    Autobuild-User(master): Simo Sorce <idra at samba.org>
    Autobuild-Date(master): Sat Feb 22 00:58:23 CET 2014 on sn-devel-104

commit 9a9e56943d186e5a8655b5d731a339e453da8ae8
Author: Jose A. Rivera <jarrpa at redhat.com>
Date:   Tue Feb 18 07:35:37 2014 -0600

    passdb: Patch memory leak in pdb_ldap.c
    
    Moved the call to the talloc autofree function to as early a point as
    possible. init_ldap_from_sam() already calls smbldap_set_mod(), and there's
    a chance that the init will fail after having already allocated memory for
    &mods.
    
    Coverity-Id: 1167997
    Change-Id: Ic26bfb3c530f90aa885e447b8409deba49708d64
    Reviewed-by: Ira Cooper	<ira at samba.org>
    Signed-off-by: Jose A. Rivera <jarrpa at redhat.com>
    Reviewed-by: Simo Sorce <idra at samba.org>

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

Summary of changes:
 source3/libsmb/trusts_util.c |    1 +
 source3/passdb/pdb_ldap.c    |   10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index b38aec6..bb2e977 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -118,6 +118,7 @@ NTSTATUS trust_pw_change(struct netlogon_creds_cli_context *context,
 			TALLOC_FREE(frame);
 			return NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE;
 		}
+		free(pwd);
 		break;
 	case SEC_CHAN_DOMAIN:
 		if (!pdb_get_trusteddom_pw(domain, &pwd, &sid, &pass_last_set_time)) {
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 6be5fb6..cea8627 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -5168,6 +5168,7 @@ static NTSTATUS ldapsam_create_user(struct pdb_methods *my_methods,
 	uint32_t num_result;
 	bool is_machine = False;
 	bool add_posix = False;
+	bool init_okay = False;
 	LDAPMod **mods = NULL;
 	struct samu *user;
 	char *filter;
@@ -5285,7 +5286,10 @@ static NTSTATUS ldapsam_create_user(struct pdb_methods *my_methods,
 		return NT_STATUS_UNSUCCESSFUL;
 	}
 
-	if (!init_ldap_from_sam(ldap_state, entry, &mods, user, pdb_element_is_set_or_changed)) {
+	init_okay = init_ldap_from_sam(ldap_state, entry, &mods, user, pdb_element_is_set_or_changed);
+	smbldap_talloc_autofree_ldapmod(tmp_ctx, mods);
+
+	if (!init_okay) {
 		DEBUG(1,("ldapsam_create_user: Unable to fill user structs\n"));
 		return NT_STATUS_UNSUCCESSFUL;
 	}
@@ -5371,9 +5375,7 @@ static NTSTATUS ldapsam_create_user(struct pdb_methods *my_methods,
 		smbldap_set_mod(&mods, LDAP_MOD_ADD, "loginShell", shell);
 	}
 
-	smbldap_talloc_autofree_ldapmod(tmp_ctx, mods);
-
-	if (add_posix) {	
+	if (add_posix) {
 		rc = smbldap_add(ldap_state->smbldap_state, dn, mods);
 	} else {
 		rc = smbldap_modify(ldap_state->smbldap_state, dn, mods);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list