ldap/servers/plugins/referint/referint.c | 32 ++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
New commits:
commit c5cc125915023d03caa3548b8d55c5b8b8ce59aa
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Nov 24 12:39:52 2014 -0500
Ticket 47810 - RI plugin does not return result code if update fails
Bug Description: If using backend txns the initial delete operation should fail
if we fail to update the integrity.
Fix Description: If using backend txns, stop and return an error if we fail to
update the membership integrity.
https://fedorahosted.org/389/ticket/47810
Reviewed by: rmeggins(Thanks!)
diff --git a/ldap/servers/plugins/referint/referint.c
b/ldap/servers/plugins/referint/referint.c
index 9ffd038..66bb95e 100644
--- a/ldap/servers/plugins/referint/referint.c
+++ b/ldap/servers/plugins/referint/referint.c
@@ -1250,7 +1250,18 @@ update_integrity(Slapi_DN *origSDN,
slapi_sdn_get_dn(newsuperior),
mod_pb);
}
- /* Should we stop if one modify returns an error? */
+ if (rc) {
+ if (use_txn) {
+ /*
+ * We're using backend transactions,
+ * so we need to stop on failure.
+ */
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto free_and_return;
+ } else {
+ rc = SLAPI_PLUGIN_SUCCESS;
+ }
+ }
}
}
}
@@ -1267,17 +1278,16 @@ update_integrity(Slapi_DN *origSDN,
}
slapi_free_search_results_internal(search_result_pb);
}
- if (plugin_ContainerScope) {
- /* at the moment only a single scope is supported
- * so the loop ends after the first iteration
- */
- sdn = NULL;
- } else {
- sdn = slapi_get_next_suffix( &node, 0 );
- }
+ if (plugin_ContainerScope) {
+ /* at the moment only a single scope is supported
+ * so the loop ends after the first iteration
+ */
+ sdn = NULL;
+ } else {
+ sdn = slapi_get_next_suffix( &node, 0 );
+ }
}
- /* if got here, then everything good rc = 0 */
- rc = SLAPI_PLUGIN_SUCCESS;
+
free_and_return:
/* free filter and search_results_pb */