summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-07-14 14:59:24 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-07-14 14:59:24 -0400
commitefa8e2f43b4c99848d962675b2e3a5b60f613e92 (patch)
tree4f1864e31a13babf063960cadb31aaca9fe5f7be /src
parent7a11d9bb00b70fe6a0e9442bee05a4293273fe93 (diff)
downloadslapi-nis-efa8e2f43b4c99848d962675b2e3a5b60f613e92.tar.gz
slapi-nis-efa8e2f43b4c99848d962675b2e3a5b60f613e92.tar.xz
slapi-nis-efa8e2f43b4c99848d962675b2e3a5b60f613e92.zip
- always return 0 from our search callback so that the backend will actually
go on and send the result
Diffstat (limited to 'src')
-rw-r--r--src/back-sch.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/back-sch.c b/src/back-sch.c
index ca1ce35..ebd92c0 100644
--- a/src/back-sch.c
+++ b/src/back-sch.c
@@ -778,9 +778,24 @@ backend_search_cb(Slapi_PBlock *pb)
map_rdlock();
map_data_foreach_domain(cbdata.state, backend_search_group_cb, &cbdata);
if (cbdata.answer) {
- if (0 && (cbdata.result == 0) && !cbdata.matched) {
+ if (cbdata.matched || (cbdata.n_entries > 0)) {
+ /* Just in case, free the closest-match that we've
+ * recorded. */
+ free(cbdata.closest_match);
+ cbdata.closest_match = NULL;
+ } 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%s%s\n", cbdata.result,
+ cbdata.closest_match ? "\"" : "",
+ cbdata.closest_match ?
+ cbdata.closest_match : "(null)",
+ cbdata.closest_match ? "\"" : "");
slapi_send_ldap_result(cbdata.pb, cbdata.result,
cbdata.closest_match, cbdata.text,
cbdata.n_entries, NULL);
@@ -789,7 +804,7 @@ backend_search_cb(Slapi_PBlock *pb)
slapi_sdn_free(&cbdata.target_dn);
free(cbdata.closest_match);
free(cbdata.text);
- return cbdata.answer ? -1 : 0;
+ return 0;
}
/* Locate the entry for a given DN. */
@@ -858,6 +873,7 @@ struct backend_group_check_scope_cbdata {
Slapi_DN *target_dn;
bool_t ours;
};
+
static bool_t
backend_group_check_scope_cb(const char *group, void *cb_data)
{
@@ -873,6 +889,7 @@ backend_group_check_scope_cb(const char *group, void *cb_data)
slapi_sdn_free(&group_dn);
return TRUE;
}
+
static bool_t
backend_check_scope(struct plugin_state *state, const char *target)
{
@@ -889,6 +906,7 @@ backend_check_scope(struct plugin_state *state, const char *target)
slapi_sdn_free(&cbdata.target_dn);
return cbdata.ours;
}
+
static bool_t
backend_check_scope_pb(Slapi_PBlock *pb)
{
@@ -899,6 +917,7 @@ backend_check_scope_pb(Slapi_PBlock *pb)
slapi_pblock_get(pb, SLAPI_TARGET_DN, &target);
return backend_check_scope(state, target);
}
+
static int
backend_write_cb(Slapi_PBlock *pb)
{
@@ -914,6 +933,7 @@ backend_write_cb(Slapi_PBlock *pb)
map_unlock();
return ret;
}
+
static int
backend_bind_cb(Slapi_PBlock *pb)
{
@@ -951,6 +971,7 @@ backend_bind_cb(Slapi_PBlock *pb)
map_unlock();
return ret;
}
+
static int
backend_compare_cb(Slapi_PBlock *pb)
{