summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/back-sch.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/back-sch.c b/src/back-sch.c
index c96179a..250f6be 100644
--- a/src/back-sch.c
+++ b/src/back-sch.c
@@ -1362,24 +1362,23 @@ backend_search_cb(Slapi_PBlock *pb)
#endif
/* If we "own" the search target DN, then we need to send a response. */
if (cbdata.answer) {
- if (!(cbdata.matched || (cbdata.n_entries > 0))) {
- /* Return a no-such-object error because the target DN
- * was not found. */
- cbdata.result = LDAP_NO_SUCH_OBJECT;
- }
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "sending error %d with closest match = "
- "%s%s%s\n", cbdata.result,
- cbdata.closest_match ? "\"" : "",
- cbdata.closest_match ?
- cbdata.closest_match : "(null)",
- cbdata.closest_match ? "\"" : "");
if (cbdata.matched || (cbdata.n_entries > 0)) {
- /* Just in case, free the closest-match that we've
- * recorded. */
+ /* Free the closest-match that we've recorded, so that
+ * we don't send it as part of the result. */
free(cbdata.closest_match);
cbdata.closest_match = NULL;
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ cbdata.state->plugin_desc->spd_id,
+ "sending error %d\n", cbdata.result);
+ } else {
+ /* Return a no-such-object error because the target DN
+ * was not found. */
+ cbdata.result = LDAP_NO_SUCH_OBJECT;
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ cbdata.state->plugin_desc->spd_id,
+ "sending error %d with closest match = "
+ "\"%s\"\n", cbdata.result,
+ cbdata.closest_match);
}
slapi_pblock_set(cbdata.pb, SLAPI_PLUGIN_OPRETURN,
&cbdata.result);