andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0009-Ticket-49561-MEP-plugin-upon-direct-op-failure-will-.patch

26521d
From 99802f5290466474ca2f1fdab0bf077ec736a013 Mon Sep 17 00:00:00 2001
26521d
From: Thierry Bordaz <tbordaz@redhat.com>
26521d
Date: Mon, 18 Mar 2019 13:48:03 +0100
26521d
Subject: [PATCH 2/4] Ticket 49561 - MEP plugin, upon direct op failure, will
26521d
 delete twice the same managed entry
26521d
26521d
Bug Description:
26521d
	When a failure occurs during betxn_post plugin callback, the betxn_post plugins are called again.
26521d
	This is to process some kind of undo action (for example usn or dna that manage counters).
26521d
26521d
	If MEP plugin is called for a managing entry, it deletes the managed entry (that become a tombstone).
26521d
	If later an other betxn_postop fails, then MEP is called again.
26521d
	But as it does not detect the operation failure (for DEL and ADD), then it tries again
26521d
	to delete the managed entry that is already a tombstone.
26521d
26521d
Fix Description:
26521d
	The MEP betxn_post plugin callbacks (ADD and DEL) should catch the operation failure
26521d
	and return.
26521d
	It is already in place for MODRDN and MOD.
26521d
26521d
https://pagure.io/389-ds-base/issue/49561
26521d
26521d
Reviewed by: Mark Reynold, thanks !!
26521d
26521d
Platforms tested: F28
26521d
26521d
Flag Day: no
26521d
26521d
Doc impact: no
26521d
---
26521d
 ldap/servers/plugins/mep/mep.c | 10 ++++++++++
26521d
 1 file changed, 10 insertions(+)
26521d
26521d
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
26521d
index 7f30f412d..a7b60e129 100644
26521d
--- a/ldap/servers/plugins/mep/mep.c
26521d
+++ b/ldap/servers/plugins/mep/mep.c
26521d
@@ -2471,6 +2471,11 @@ mep_add_post_op(Slapi_PBlock *pb)
26521d
     slapi_log_err(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM,
26521d
                   "--> mep_add_post_op\n");
26521d
 
26521d
+    /* Just bail if we aren't ready to service requests yet. */
26521d
+    if (!mep_oktodo(pb)) {
26521d
+        return SLAPI_PLUGIN_SUCCESS;
26521d
+    }
26521d
+
26521d
     /* Reload config if a config entry was added. */
26521d
     if ((sdn = mep_get_sdn(pb))) {
26521d
         if (mep_dn_is_config(sdn)) {
26521d
@@ -2543,6 +2548,11 @@ mep_del_post_op(Slapi_PBlock *pb)
26521d
     slapi_log_err(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM,
26521d
                   "--> mep_del_post_op\n");
26521d
 
26521d
+    /* Just bail if we aren't ready to service requests yet. */
26521d
+    if (!mep_oktodo(pb)) {
26521d
+        return SLAPI_PLUGIN_SUCCESS;
26521d
+    }
26521d
+
26521d
     /* Reload config if a config entry was deleted. */
26521d
     if ((sdn = mep_get_sdn(pb))) {
26521d
         if (mep_dn_is_config(sdn))
26521d
-- 
26521d
2.17.2
26521d