From 27dcf97dca7d14c089873e72ac00ca8e4dc82264 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 6 Aug 2013 17:20:17 -0400 Subject: Don't log "with closest match (null)" If we're sending a result, don't log that we're sending a closest match, even if it's "(null)", if we're not sending a closest match. --- src/back-sch.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src') 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); -- cgit