summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@dahyabhai.net>2013-08-06 17:20:17 -0400
committerNalin Dahyabhai <nalin@dahyabhai.net>2013-08-12 15:43:32 -0400
commit27dcf97dca7d14c089873e72ac00ca8e4dc82264 (patch)
treea277e08de6ca2c2fdaa02bb5b057b1b56173306f
parente0e28b17f4cff80b0ca1635da7304dfa185323dd (diff)
downloadslapi-nis-27dcf97dca7d14c089873e72ac00ca8e4dc82264.tar.gz
slapi-nis-27dcf97dca7d14c089873e72ac00ca8e4dc82264.tar.xz
slapi-nis-27dcf97dca7d14c089873e72ac00ca8e4dc82264.zip
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.
-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);