- tag = LDAP_RES_INTERMEDIATE_RESP;
- msgid = (tag != LBER_SEQUENCE) ? op->o_msgid : 0;
- send_ldap_response( conn, op, tag, msgid,
- err, matched, text, refs,
- rspoid, rspdata, NULL, ctrls );
-}
-#endif
-
-void
-slap_send_search_result(
- Connection *conn,
- Operation *op,
- ber_int_t err,
- const char *matched,
- const char *text,
- BerVarray refs,
- LDAPControl **ctrls,
- int nentries
-)
-{
- ber_tag_t tag;
- ber_int_t msgid;
- char *tmp = NULL;
-
- assert( !LDAP_API_ERROR( err ) );
-
- if (op->o_callback && op->o_callback->sc_sresult) {
- op->o_callback->sc_sresult(conn, op, err, matched, text, refs,
- ctrls, nentries);
- return;
- }
-
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, ENTRY,
- "send_search_result: err=%d matched=\"%s\" text=\"%s\"\n",
- err, matched ? matched : "", text ? text : "" );
-#else
- Debug( LDAP_DEBUG_TRACE,
- "send_search_result: err=%d matched=\"%s\" text=\"%s\"\n",
- err, matched ? matched : "", text ? text : "" );
-#endif
-
-
- assert( err != LDAP_PARTIAL_RESULTS );
-
- if( op->o_protocol < LDAP_VERSION3 ) {
- /* send references in search results */
- if( err == LDAP_REFERRAL ) {
- err = LDAP_PARTIAL_RESULTS;
- }
-
- tmp = v2ref( refs, text );
- text = tmp;
- refs = NULL;
-
- } else {
- /* don't send references in search results */
- assert( refs == NULL );
- refs = NULL;
-
- if( err == LDAP_REFERRAL ) {
- err = LDAP_SUCCESS;
- }
- }
-
- tag = req2res( op->o_tag );
- msgid = (tag != LBER_SEQUENCE) ? op->o_msgid : 0;
-
- send_ldap_response( conn, op, tag, msgid,
- err, matched, text, refs,
- NULL, NULL, NULL, ctrls );
-
- {
- char nbuf[64];
- snprintf( nbuf, sizeof nbuf, "%d nentries=%d", err, nentries );
-
- Statslog( LDAP_DEBUG_STATS,
- "conn=%lu op=%lu SEARCH RESULT tag=%lu err=%s text=%s\n",
- op->o_connid, op->o_opid, tag, nbuf, text ? text : "" );
- }
-
- if (tmp != NULL) {
- ch_free(tmp);
- }