void send_ldap_disconnect( Operation *op, SlapReply *rs ) { #define LDAP_UNSOLICITED_ERROR(e) \ ( (e) == LDAP_PROTOCOL_ERROR \ || (e) == LDAP_STRONG_AUTH_REQUIRED \ || (e) == LDAP_UNAVAILABLE ) assert( LDAP_UNSOLICITED_ERROR( rs->sr_err ) ); rs->sr_type = REP_EXTENDED; rs->sr_rspdata = NULL; Debug( LDAP_DEBUG_TRACE, "send_ldap_disconnect %d:%s\n", rs->sr_err, rs->sr_text ? rs->sr_text : "", NULL ); if ( op->o_protocol < LDAP_VERSION3 ) { rs->sr_rspoid = NULL; rs->sr_tag = slap_req2res( op->o_tag ); rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; } else { rs->sr_rspoid = LDAP_NOTICE_DISCONNECT; rs->sr_tag = LDAP_RES_EXTENDED; rs->sr_msgid = LDAP_RES_UNSOLICITED; } if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { Statslog( LDAP_DEBUG_STATS, "%s DISCONNECT tag=%lu err=%d text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "", 0 ); } }
static int translucent_tag_cb( Operation *op, SlapReply *rs ) { op->o_tag = LDAP_REQ_MODIFY; op->orm_modlist = op->o_callback->sc_private; rs->sr_tag = slap_req2res( op->o_tag ); return SLAP_CB_CONTINUE; }
void send_ldap_sasl( Operation *op, SlapReply *rs ) { rs->sr_type = REP_SASL; Debug( LDAP_DEBUG_TRACE, "send_ldap_sasl: err=%d len=%ld\n", rs->sr_err, rs->sr_sasldata ? (long) rs->sr_sasldata->bv_len : -1, NULL ); rs->sr_tag = slap_req2res( op->o_tag ); rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { Statslog( LDAP_DEBUG_STATS, "%s RESULT tag=%lu err=%d text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "", 0 ); } }
void send_ldap_sasl( Operation *op, SlapReply *rs ) { Debug( LDAP_DEBUG_TRACE, "send_ldap_sasl: err=%d len=%ld\n", rs->sr_err, rs->sr_sasldata ? (long) rs->sr_sasldata->bv_len : -1 ); RS_ASSERT( !(rs->sr_flags & REP_ENTRY_MASK) ); rs->sr_flags &= ~REP_ENTRY_MASK; /* paranoia */ rs->sr_type = REP_SASL; rs->sr_tag = slap_req2res( op->o_tag ); rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { Statslog( LDAP_DEBUG_STATS, "%s RESULT tag=%lu err=%d text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "" ); } }
void slap_send_ldap_extended( Operation *op, SlapReply *rs ) { rs->sr_type = REP_EXTENDED; Debug( LDAP_DEBUG_TRACE, "send_ldap_extended: err=%d oid=%s len=%ld\n", rs->sr_err, rs->sr_rspoid ? rs->sr_rspoid : "", rs->sr_rspdata != NULL ? rs->sr_rspdata->bv_len : 0 ); rs->sr_tag = slap_req2res( op->o_tag ); rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { Statslog( LDAP_DEBUG_STATS, "%s RESULT oid=%s err=%d text=%s\n", op->o_log_prefix, rs->sr_rspoid ? rs->sr_rspoid : "", rs->sr_err, rs->sr_text ? rs->sr_text : "", 0 ); } }
void send_ldap_disconnect( Operation *op, SlapReply *rs ) { #define LDAP_UNSOLICITED_ERROR(e) \ ( (e) == LDAP_PROTOCOL_ERROR \ || (e) == LDAP_STRONG_AUTH_REQUIRED \ || (e) == LDAP_UNAVAILABLE ) Debug( LDAP_DEBUG_TRACE, "send_ldap_disconnect %d:%s\n", rs->sr_err, rs->sr_text ? rs->sr_text : "" ); assert( LDAP_UNSOLICITED_ERROR( rs->sr_err ) ); /* TODO: Flush the entry if sr_type == REP_SEARCH/REP_SEARCHREF? */ RS_ASSERT( !(rs->sr_flags & REP_ENTRY_MASK) ); rs->sr_flags &= ~REP_ENTRY_MASK; /* paranoia */ rs->sr_type = REP_EXTENDED; rs->sr_rspdata = NULL; if ( op->o_protocol < LDAP_VERSION3 ) { rs->sr_rspoid = NULL; rs->sr_tag = slap_req2res( op->o_tag ); rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; } else { rs->sr_rspoid = LDAP_NOTICE_DISCONNECT; rs->sr_tag = LDAP_RES_EXTENDED; rs->sr_msgid = LDAP_RES_UNSOLICITED; } if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { Statslog( LDAP_DEBUG_STATS, "%s DISCONNECT tag=%lu err=%d text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "" ); } }
void slap_send_ldap_result( Operation *op, SlapReply *rs ) { char *tmp = NULL; const char *otext = rs->sr_text; BerVarray oref = rs->sr_ref; rs->sr_type = REP_RESULT; /* Propagate Abandons so that cleanup callbacks can be processed */ if ( rs->sr_err == SLAPD_ABANDON || op->o_abandon ) goto abandon; Debug( LDAP_DEBUG_TRACE, "send_ldap_result: %s p=%d\n", op->o_log_prefix, op->o_protocol ); Debug( LDAP_DEBUG_ARGS, "send_ldap_result: err=%d matched=\"%s\" text=\"%s\"\n", rs->sr_err, rs->sr_matched ? rs->sr_matched : "", rs->sr_text ? rs->sr_text : "" ); if( rs->sr_ref ) { Debug( LDAP_DEBUG_ARGS, "send_ldap_result: referral=\"%s\"\n", rs->sr_ref[0].bv_val ? rs->sr_ref[0].bv_val : "NULL" ); } assert( !LDAP_API_ERROR( rs->sr_err ) ); assert( rs->sr_err != LDAP_PARTIAL_RESULTS ); if ( rs->sr_err == LDAP_REFERRAL ) { if( op->o_domain_scope ) rs->sr_ref = NULL; if( rs->sr_ref == NULL ) { rs->sr_err = LDAP_NO_SUCH_OBJECT; } else if ( op->o_protocol < LDAP_VERSION3 ) { rs->sr_err = LDAP_PARTIAL_RESULTS; } } if ( op->o_protocol < LDAP_VERSION3 ) { tmp = v2ref( rs->sr_ref, rs->sr_text ); rs->sr_text = tmp; rs->sr_ref = NULL; } abandon: rs->sr_tag = slap_req2res( op->o_tag ); rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; if ( rs->sr_flags & REP_REF_MUSTBEFREED ) { if ( rs->sr_ref == NULL ) { rs->sr_flags ^= REP_REF_MUSTBEFREED; ber_bvarray_free( oref ); } oref = NULL; /* send_ldap_response() will free rs->sr_ref if != NULL */ } if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { if ( op->o_tag == LDAP_REQ_SEARCH ) { Statslog( LDAP_DEBUG_STATS, "%s SEARCH RESULT tag=%lu err=%d nentries=%d text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_nentries, rs->sr_text ? rs->sr_text : "" ); } else { Statslog( LDAP_DEBUG_STATS, "%s RESULT tag=%lu err=%d text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "" ); } } if( tmp != NULL ) ch_free(tmp); rs->sr_text = otext; rs->sr_ref = oref; }