From bc789a909c0022dd5228f0c3f15039b7274aa508 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: May 12 2020 11:36:17 +0000 Subject: Issue 51076 - prevent unnecessarily duplication of the target entry Bug Description: For any update operation the MEP plugin was calling slapi_search_internal_get_entry() which duplicates the entry it returns. In this case the entry is just read from and discarded, but this entry is already in the pblock (the PRE OP ENTRY). Fix Description: Just grab the PRE OP ENTRY from the pblock and use that to read the attribute values from. This saves two entry duplications for every update operation from MEP. fixes: https://pagure.io/389-ds-base/issue/51076 Reviewed by: tbordaz & firstyear(Thanks!!) --- diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c index ca9a64b..401d95e 100644 --- a/ldap/servers/plugins/mep/mep.c +++ b/ldap/servers/plugins/mep/mep.c @@ -2165,9 +2165,8 @@ mep_pre_op(Slapi_PBlock *pb, int modop) if (e && free_entry) { slapi_entry_free(e); } - - slapi_search_internal_get_entry(sdn, 0, &e, mep_get_plugin_id()); - free_entry = 1; + slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &e); + free_entry = 0; } if (e && mep_is_managed_entry(e)) {