s3-pdb_ldap: fix crash bug in ldapsam_set_trusteddom_pw().
authorGünther Deschner <gd@samba.org>
Tue, 20 Oct 2009 16:35:16 +0000 (18:35 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 20 Oct 2009 19:44:02 +0000 (21:44 +0200)
Thanks Volker for the hint.

Guenther

source3/passdb/pdb_ldap.c

index 2c8d0518d551d96aa391d145a4c28af95ec5e18b..c464a88f38c95da148f0858626bcfd343f391c14 100644 (file)
@@ -6013,8 +6013,6 @@ static bool ldapsam_set_trusteddom_pw(struct pdb_methods *methods,
        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());
@@ -6025,6 +6023,8 @@ static bool ldapsam_set_trusteddom_pw(struct pdb_methods *methods,
                }
        }
 
+       talloc_autofree_ldapmod(talloc_tos(), mods);
+
        trusted_dn = trusteddom_dn(ldap_state, domain);
        if (trusted_dn == NULL) {
                return False;