Hello
I am working on a slapd overlay where I need to perform an internal
search to validate a modify operation. It is roughtly the same situation
as slapo-constraint with an url constraint type.
In .bi_op_modify(), I piggy back on Operation with the code below. It
works, my callback gets the entry, but when op2.o_bd->be_search() is
called, the ldapmodify command gets this:
ldap_modify: msgtype: expected 103 got 101
That is, LDAP_RES_SEARCH_RESULT instead of LDAP_RES_MODIFY: the search is
not just insternal, its results are sent to the client.
What did I do wrong?
char filterstr[] = "(objectClass=*)";
Operation op2 = *op;
SlapReply rs2 = { REP_RESULT };
(...)
op2.ors_filterstr.bv_len = sizeof(filterstr);
op2.ors_filterstr.bv_val =
op->o_tmpalloc(op2.ors_filterstr.bv_len + 1, op->o_tmpmemctx);
strcpy(op2.ors_filterstr.bv_val, filterstr);
op2.o_dn = op->o_bd->be_rootdn;
op2.o_ndn = op->o_bd->be_rootndn;
op2.o_req_dn = op->o_req_dn;
op2.o_req_ndn = op->o_req_ndn;
op2.o_bd = select_backend(&op2.o_req_ndn, 1 );
op2.o_do_not_cache = 1;
op2.o_tag = LDAP_REQ_SEARCH;
op2.o_callback = NULL;
op2.ors_limit = NULL;
op2.ors_slimit = SLAP_NO_LIMIT;;
op2.ors_tlimit = SLAP_NO_LIMIT;
op2.ors_attrs = slap_anlist_no_attrs;
op2.ors_attrsonly = 0;
op2.ors_deref = LDAP_DEREF_NEVER;
op2.ors_scope = LDAP_SCOPE_BASE;
op2.ors_filter = str2filter_x( op, op2.ors_filterstr.bv_val );
cb.sc_response = supann_internal_search_cb;
cb.sc_private = op;
op2.o_callback = &cb;
rc = op2.o_bd->be_search(&op2, &rs2);
--
Emmanuel Dreyfus
[email protected]