Blame SOURCES/0001-Issue-51076-prevent-unnecessarily-duplication-of-the.patch

a26cad
From 97ecf0190f264a2d87750bc2d26ebf011542e3e1 Mon Sep 17 00:00:00 2001
a26cad
From: Mark Reynolds <mreynolds@redhat.com>
a26cad
Date: Fri, 8 May 2020 10:52:43 -0400
a26cad
Subject: [PATCH 01/12] Issue 51076 - prevent unnecessarily duplication of the
a26cad
 target entry
a26cad
a26cad
Bug Description:  For any update operation the MEP plugin was calling
a26cad
                  slapi_search_internal_get_entry() which duplicates
a26cad
                  the entry it returns.  In this case the entry is just
a26cad
                  read from and discarded, but this entry is already
a26cad
                  in the pblock (the PRE OP ENTRY).
a26cad
a26cad
Fix Description:  Just grab the PRE OP ENTRY from the pblock and use
a26cad
                  that to read the attribute values from.  This saves
a26cad
                  two entry duplications for every update operation
a26cad
                  from MEP.
a26cad
a26cad
fixes:  https://pagure.io/389-ds-base/issue/51076
a26cad
a26cad
Reviewed by: tbordaz & firstyear(Thanks!!)
a26cad
---
a26cad
 ldap/servers/plugins/mep/mep.c | 5 ++---
a26cad
 1 file changed, 2 insertions(+), 3 deletions(-)
a26cad
a26cad
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
a26cad
index ca9a64b3b..401d95e3a 100644
a26cad
--- a/ldap/servers/plugins/mep/mep.c
a26cad
+++ b/ldap/servers/plugins/mep/mep.c
a26cad
@@ -2165,9 +2165,8 @@ mep_pre_op(Slapi_PBlock *pb, int modop)
a26cad
                 if (e && free_entry) {
a26cad
                     slapi_entry_free(e);
a26cad
                 }
a26cad
-
a26cad
-                slapi_search_internal_get_entry(sdn, 0, &e, mep_get_plugin_id());
a26cad
-                free_entry = 1;
a26cad
+                slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &e);
a26cad
+                free_entry = 0;
a26cad
             }
a26cad
 
a26cad
             if (e && mep_is_managed_entry(e)) {
a26cad
-- 
a26cad
2.26.2
a26cad