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

Volker Lendecke vlendec at samba.org
Thu Jul 10 16:24:09 GMT 2008


The branch, v3-3-test has been updated
       via  3d2913d599a4cd773614110ec7b7493aa7adb547 (commit)
       via  26fb3fea812867f8b0dfe6a1be59e4922ed86e45 (commit)
       via  ea110de1dc6257b78631b7d83b7bbb728180c1a1 (commit)
      from  939e75126ebfcd9124781b5d70a68886c4bf9a54 (commit)

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


- Log -----------------------------------------------------------------
commit 3d2913d599a4cd773614110ec7b7493aa7adb547
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 10 18:21:03 2008 +0200

    Fix some memleaks regarding trustdom passwords

commit 26fb3fea812867f8b0dfe6a1be59e4922ed86e45
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 10 18:20:30 2008 +0200

    Fix some uninitialized variable references via ndr_print

commit ea110de1dc6257b78631b7d83b7bbb728180c1a1
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 10 18:12:24 2008 +0200

    Fix a segfault in base64_encode_data_blob
    
    We did not allocate enough memory for the \0 and a = at the end

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

Summary of changes:
 source/lib/util_str.c        |    4 +++-
 source/passdb/pdb_ldap.c     |   22 ++++++++++++++++++----
 source/rpc_client/init_lsa.c |    2 ++
 3 files changed, 23 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index 1e11081..7cb57ad 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -2347,7 +2347,9 @@ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data)
 
 	out_cnt = 0;
 	len = data.length;
-	output_len = data.length * 2;
+	output_len = data.length * 2 + 4; /* Account for closing bytes. 4 is
+					   * random but should be enough for
+					   * the = and \0 */
 	result = TALLOC_ARRAY(mem_ctx, char, output_len); /* get us plenty of space */
 	SMB_ASSERT(result != NULL);
 
diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c
index 6326240..5ddb485 100644
--- a/source/passdb/pdb_ldap.c
+++ b/source/passdb/pdb_ldap.c
@@ -4666,7 +4666,9 @@ static bool ldapgroup2displayentry(struct ldap_search_state *state,
 			DEBUG(0,("unkown group type: %d\n", group_type));
 			return False;
 	}
-	
+
+	result->acct_flags = 0;
+
 	return True;
 }
 
@@ -5786,6 +5788,7 @@ static char *trusteddom_dn(struct ldapsam_privates *ldap_state,
 }
 
 static bool get_trusteddom_pw_int(struct ldapsam_privates *ldap_state,
+				  TALLOC_CTX *mem_ctx,
 				  const char *domain, LDAPMessage **entry)
 {
 	int rc;
@@ -5808,6 +5811,10 @@ static bool get_trusteddom_pw_int(struct ldapsam_privates *ldap_state,
 	rc = smbldap_search(ldap_state->smbldap_state, trusted_dn, scope,
 			    filter, attrs, attrsonly, &result);
 
+	if (result != NULL) {
+		talloc_autofree_ldapmsg(mem_ctx, result);
+	}
+
 	if (rc == LDAP_NO_SUCH_OBJECT) {
 		*entry = NULL;
 		return True;
@@ -5850,7 +5857,7 @@ static bool ldapsam_get_trusteddom_pw(struct pdb_methods *methods,
 
 	DEBUG(10, ("ldapsam_get_trusteddom_pw called for domain %s\n", domain));
 
-	if (!get_trusteddom_pw_int(ldap_state, domain, &entry) ||
+	if (!get_trusteddom_pw_int(ldap_state, talloc_tos(), domain, &entry) ||
 	    (entry == NULL))
 	{
 		return False;
@@ -5921,7 +5928,7 @@ static bool ldapsam_set_trusteddom_pw(struct pdb_methods *methods,
 	 * get the current entry (if there is one) in order to put the
 	 * current password into the previous password attribute
 	 */
-	if (!get_trusteddom_pw_int(ldap_state, domain, &entry)) {
+	if (!get_trusteddom_pw_int(ldap_state, talloc_tos(), domain, &entry)) {
 		return False;
 	}
 
@@ -5936,6 +5943,9 @@ static bool ldapsam_set_trusteddom_pw(struct pdb_methods *methods,
 			 talloc_asprintf(talloc_tos(), "%li", time(NULL)));
 	smbldap_make_mod(priv2ld(ldap_state), entry, &mods,
 			 "sambaClearTextPassword", pwd);
+
+	talloc_autofree_ldapmod(talloc_tos(), mods);
+
 	if (entry != NULL) {
 		prev_pwd = smbldap_talloc_single_attribute(priv2ld(ldap_state),
 				entry, "sambaClearTextPassword", talloc_tos());
@@ -5973,7 +5983,7 @@ static bool ldapsam_del_trusteddom_pw(struct pdb_methods *methods,
 	LDAPMessage *entry = NULL;
 	const char *trusted_dn;
 
-	if (!get_trusteddom_pw_int(ldap_state, domain, &entry)) {
+	if (!get_trusteddom_pw_int(ldap_state, talloc_tos(), domain, &entry)) {
 		return False;
 	}
 
@@ -6024,6 +6034,10 @@ static NTSTATUS ldapsam_enum_trusteddoms(struct pdb_methods *methods,
 			    attrsonly,
 			    &result);
 
+	if (result != NULL) {
+		talloc_autofree_ldapmsg(mem_ctx, result);
+	}
+
 	if (rc != LDAP_SUCCESS) {
 		return NT_STATUS_UNSUCCESSFUL;
 	}
diff --git a/source/rpc_client/init_lsa.c b/source/rpc_client/init_lsa.c
index 2637158..9777f27 100644
--- a/source/rpc_client/init_lsa.c
+++ b/source/rpc_client/init_lsa.c
@@ -26,6 +26,8 @@
 void init_lsa_String(struct lsa_String *name, const char *s)
 {
 	name->string = s;
+	name->size = 2 * strlen_m(s);
+	name->length = name->size;
 }
 
 /*******************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list