|
|
dc8c34 |
From 3c56e3905af3dff3b35d6cfa7c4f327fa9887f35 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
dc8c34 |
Date: Thu, 19 Mar 2015 15:29:39 -0700
|
|
|
dc8c34 |
Subject: [PATCH 308/308] Ticket #48135 - memory leak in new_passwdPolicy
|
|
|
dc8c34 |
(1.2.11 only)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Description: Backporting #47900 patch introduced a leak. The patch
|
|
|
dc8c34 |
has a dependency on #147, which was not backported to 1.2.11 branch.
|
|
|
dc8c34 |
This patch releases the pwdpolicy object in op_shared_add every time.
|
|
|
dc8c34 |
Also, moving new_passwdPolicy only where it is needed.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/48135
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit aa76f6b79db14c03c74b7c064f33a37bba991bf5)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/add.c | 5 +++--
|
|
|
dc8c34 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
|
|
|
dc8c34 |
index e03bc6c..f52f766 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/add.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/add.c
|
|
|
dc8c34 |
@@ -457,14 +457,13 @@ static void op_shared_add (Slapi_PBlock *pb)
|
|
|
dc8c34 |
int proxy_err = LDAP_SUCCESS;
|
|
|
dc8c34 |
char *errtext = NULL;
|
|
|
dc8c34 |
Slapi_DN *sdn = NULL;
|
|
|
dc8c34 |
- passwdPolicy *pwpolicy;
|
|
|
dc8c34 |
+ passwdPolicy *pwpolicy = NULL;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
|
|
|
dc8c34 |
slapi_pblock_get (pb, SLAPI_ADD_ENTRY, &e);
|
|
|
dc8c34 |
slapi_pblock_get (pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op);
|
|
|
dc8c34 |
slapi_pblock_get (pb, SLAPI_IS_LEGACY_REPLICATED_OPERATION, &legacy_op);
|
|
|
dc8c34 |
internal_op= operation_is_flag_set(operation, OP_FLAG_INTERNAL);
|
|
|
dc8c34 |
- pwpolicy = new_passwdPolicy(pb, slapi_entry_get_dn(e));
|
|
|
dc8c34 |
|
|
|
dc8c34 |
/* target spec is used to decide which plugins are applicable for the operation */
|
|
|
dc8c34 |
operation_set_target_spec (operation, slapi_entry_get_sdn (e));
|
|
|
dc8c34 |
@@ -561,6 +560,7 @@ static void op_shared_add (Slapi_PBlock *pb)
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
/* check password syntax */
|
|
|
dc8c34 |
+ pwpolicy = new_passwdPolicy(pb, slapi_entry_get_dn(e));
|
|
|
dc8c34 |
if (!pw_is_pwp_admin(pb, pwpolicy) &&
|
|
|
dc8c34 |
check_pw_syntax(pb, slapi_entry_get_sdn_const(e), present_values, NULL, e, 0) != 0)
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
@@ -745,6 +745,7 @@ static void op_shared_add (Slapi_PBlock *pb)
|
|
|
dc8c34 |
done:
|
|
|
dc8c34 |
if (be)
|
|
|
dc8c34 |
slapi_be_Unlock(be);
|
|
|
dc8c34 |
+ delete_passwdPolicy(&pwpolicy);
|
|
|
dc8c34 |
slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &pse;;
|
|
|
dc8c34 |
slapi_entry_free(pse);
|
|
|
dc8c34 |
slapi_ch_free((void **)&operation->o_params.p.p_add.parentuniqueid);
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.9.3
|
|
|
dc8c34 |
|