summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-10 18:21:03 +0200
committerVolker Lendecke <vl@samba.org>2008-07-10 18:25:00 +0200
commit90f3da47205e670bfdde26d5c7858238a5ed7716 (patch)
treea7a1f60a9ae1db412d02cf94537afbb7458a91ee /source3
parentad91d960d0edfc4c7797fb7c324494c1b60bfd57 (diff)
downloadsamba-90f3da47205e670bfdde26d5c7858238a5ed7716.tar.gz
samba-90f3da47205e670bfdde26d5c7858238a5ed7716.tar.bz2
samba-90f3da47205e670bfdde26d5c7858238a5ed7716.zip
Fix some memleaks regarding trustdom passwords
(This used to be commit 3d2913d599a4cd773614110ec7b7493aa7adb547)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_ldap.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index e5080bac14..5ddb485bb5 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -5788,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;
@@ -5810,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;
@@ -5852,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;
@@ -5923,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;
}
@@ -5938,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());
@@ -5975,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;
}
@@ -6026,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;
}