char *matched;
int nrefs;
BVarray refs;
+ slap_callback *prevcb;
} glue_state;
static void
LDAPControl **ctrls
)
{
- glue_state *gs = op->o_glue;
+ glue_state *gs = op->o_callback->sc_private;
if (err == LDAP_SUCCESS || gs->err != LDAP_SUCCESS)
gs->err = err;
int nentries
)
{
- glue_state *gs = op->o_glue;
+ glue_state *gs = op->o_callback->sc_private;
gs->nentries += nentries;
glue_back_response (c, op, 0, 0, err, matched, text, refs,
NULL, NULL, NULL, ctrls);
}
+static int
+glue_back_sendentry (
+ BackendDB *be,
+ Connection *c,
+ Operation *op,
+ Entry *e,
+ AttributeName *an,
+ int ao,
+ LDAPControl **ctrls
+)
+{
+ slap_callback *tmp = op->o_callback;
+ glue_state *gs = tmp->sc_private;
+ int rc;
+
+ op->o_callback = gs->prevcb;
+ if (op->o_callback && op->o_callback->sc_sendentry) {
+ rc = op->o_callback->sc_sendentry(be, c, op, e, an, ao, ctrls);
+ } else {
+ rc = send_search_entry(be, c, op, e, an, ao, ctrls);
+ }
+ op->o_callback = tmp;
+ return rc;
+}
+
static int
glue_back_search (
BackendDB *b0,
BackendDB *be;
int i, rc, t2limit = 0, s2limit = 0;
long stoptime = 0;
- glue_state gs = {0};
struct berval bv;
+ glue_state gs = {0};
+ slap_callback cb = {glue_back_response, glue_back_sresult,
+ glue_back_sendentry, &gs};
+ gs.prevcb = op->o_callback;
if (tlimit) {
stoptime = slap_get_time () + tlimit;
case LDAP_SCOPE_ONELEVEL:
case LDAP_SCOPE_SUBTREE:
- op->o_glue = &gs;
- op->o_sresult = glue_back_sresult;
- op->o_response = glue_back_response;
+ op->o_callback = &cb;
/*
* Execute in reverse order, most general first
}
break;
}
- op->o_sresult = NULL;
- op->o_response = NULL;
- op->o_glue = NULL;
+ op->o_callback = gs.prevcb;
send_search_result (conn, op, gs.err, gs.matched, NULL,
gs.refs, NULL, gs.nentries);
int rc;
long bytes;
- if (op->o_response) {
- op->o_response( conn, op, tag, msgid, err, matched,
+ if (op->o_callback && op->o_callback->sc_response) {
+ op->o_callback->sc_response( conn, op, tag, msgid, err, matched,
text, ref, resoid, resdata, sasldata, ctrls );
return;
}
assert( !LDAP_API_ERROR( err ) );
- if (op->o_sresult) {
- op->o_sresult(conn, op, err, matched, text, refs,
+ if (op->o_callback && op->o_callback->sc_sresult) {
+ op->o_callback->sc_sresult(conn, op, err, matched, text, refs,
ctrls, nentries);
return;
}
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
+ if (op->o_callback && op->o_callback->sc_sendentry) {
+ return op->o_callback->sc_sendentry( be, conn, op, e, attrs,
+ attrsonly, ctrls );
+ }
+
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
"send_search_entry: conn %d dn=\"%s\"%s\n",
ber_int_t, const char *, const char *, BVarray,
LDAPControl **, int nentries);
+typedef int (slap_sendentry)( BackendDB *, struct slap_conn *,
+ struct slap_op *, Entry *, AttributeName *, int, LDAPControl **);
+
+typedef struct slap_callback {
+ slap_response *sc_response;
+ slap_sresult *sc_sresult;
+ slap_sendentry *sc_sendentry;
+ void *sc_private;
+} slap_callback;
+
/*
* represents an operation pending from an ldap client
*/
AuthorizationInformation o_authz;
BerElement *o_ber; /* ber of the request */
- slap_response *o_response; /* callback function */
- slap_sresult *o_sresult; /* search result callback */
+ slap_callback *o_callback; /* callback pointers */
LDAPControl **o_ctrls; /* controls */
- void *o_glue; /* for the glue backend */
void *o_private; /* anything the backend needs */
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */