From 72c121c484d200de2a0286d824f4e8f0582d0386 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Mon, 24 Nov 2014 12:39:52 -0500 Subject: [PATCH] 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: ? --- ldap/servers/plugins/referint/referint.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) 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 */ -- 1.9.3