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

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