Lines Matching refs:op
42 int slap_null_cb( Operation *op, SlapReply *rs )
47 int slap_freeself_cb( Operation *op, SlapReply *rs )
49 assert( op->o_callback != NULL );
51 op->o_tmpfree( op->o_callback, op->o_tmpmemctx );
52 op->o_callback = NULL;
239 rs_flush_entry( Operation *op, SlapReply *rs, slap_overinst *on )
247 overlay_entry_release_ov( op, rs->sr_entry, 0, on );
249 be_entry_release_rw( op, rs->sr_entry, 0 );
259 rs_replace_entry( Operation *op, SlapReply *rs, slap_overinst *on, Entry *e )
261 rs_flush_entry( op, rs, on );
271 rs_entry2modifiable( Operation *op, SlapReply *rs, slap_overinst *on )
277 rs_replace_entry( op, rs, on, entry_dup( rs->sr_entry ));
283 Operation *op,
286 Connection *conn = op->o_conn;
294 if (( op->o_abandon && !op->o_cancel ) || !connection_valid( conn ) ||
439 /* this is a hack to avoid having to modify op->s_ctrls */
472 * - remove itself from the list, by setting op->o_callback = NULL;
476 * op->o_callback = a new (list of) callback(s); in this case, it
492 Operation *op,
497 slap_callback *sc = op->o_callback, **scp;
503 op->o_callback = *scp;
504 if ( op->o_callback->sc_response ) {
505 rc = op->o_callback->sc_response( op, rs );
506 if ( op->o_callback == NULL ) {
512 } else if ( op->o_callback != *scp ) {
515 *scp = op->o_callback;
523 op->o_callback = sc;
529 Operation *op,
532 slap_callback *sc = op->o_callback, **scp;
537 op->o_callback = *scp;
538 if ( op->o_callback->sc_cleanup ) {
539 (void)op->o_callback->sc_cleanup( op, rs );
540 if ( op->o_callback == NULL ) {
546 } else if ( op->o_callback != *scp ) {
551 *scp = op->o_callback;
559 op->o_callback = sc;
565 Operation *op,
573 /* op was actually aborted, bypass everything if client didn't Cancel */
574 if (( rs->sr_err == SLAPD_ABANDON ) && !op->o_cancel ) {
579 if ( op->o_callback ) {
580 rc = slap_response_play( op, rs );
586 /* op completed, connection aborted, bypass sending response */
587 if ( op->o_abandon && !op->o_cancel ) {
593 if (op->o_conn && op->o_conn->c_is_udp)
594 ber = op->o_res_ber;
599 ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
603 if ( rc == SLAPD_ABANDON && op->o_cancel )
617 if (op->o_conn && op->o_conn->c_is_udp &&
618 op->o_protocol == LDAP_VERSION2 )
674 rc = send_ldap_controls( op, ber, rs->sr_ctrls );
682 if( op->o_conn && op->o_conn->c_is_udp && op->o_protocol == LDAP_VERSION2
693 if (!op->o_conn || op->o_conn->c_is_udp == 0)
702 bytes = send_ldap_ber( op, ber );
704 if (!op->o_conn || op->o_conn->c_is_udp == 0)
718 ldap_pvt_thread_mutex_lock( &op->o_counters->sc_mutex );
719 ldap_pvt_mp_add_ulong( op->o_counters->sc_pdu, 1 );
720 ldap_pvt_mp_add_ulong( op->o_counters->sc_bytes, (unsigned long)bytes );
721 ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex );
730 if ( op->o_callback ) {
731 (void)slap_cleanup_play( op, rs );
753 slap_free_ctrls( op, rs->sr_ctrls );
763 send_ldap_disconnect( Operation *op, SlapReply *rs )
782 if ( op->o_protocol < LDAP_VERSION3 ) {
784 rs->sr_tag = slap_req2res( op->o_tag );
785 rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
793 if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
796 op->o_log_prefix, rs->sr_tag, rs->sr_err,
802 slap_send_ldap_result( Operation *op, SlapReply *rs )
811 if ( rs->sr_err == SLAPD_ABANDON || op->o_abandon )
816 op->o_log_prefix, op->o_protocol, 0 );
831 if( op->o_domain_scope ) rs->sr_ref = NULL;
835 } else if ( op->o_protocol < LDAP_VERSION3 ) {
840 if ( op->o_protocol < LDAP_VERSION3 ) {
847 rs->sr_tag = slap_req2res( op->o_tag );
848 rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
858 if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
859 if ( op->o_tag == LDAP_REQ_SEARCH ) {
862 op->o_log_prefix, rs->sr_tag, rs->sr_err,
867 op->o_log_prefix, rs->sr_tag, rs->sr_err,
878 send_ldap_sasl( Operation *op, SlapReply *rs )
888 rs->sr_tag = slap_req2res( op->o_tag );
889 rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
891 if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
894 op->o_log_prefix, rs->sr_tag, rs->sr_err,
900 slap_send_ldap_extended( Operation *op, SlapReply *rs )
912 rs->sr_tag = slap_req2res( op->o_tag );
913 rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
915 if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
918 op->o_log_prefix, rs->sr_rspoid ? rs->sr_rspoid : "",
924 slap_send_ldap_intermediate( Operation *op, SlapReply *rs )
937 rs->sr_msgid = op->o_msgid;
938 if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
941 op->o_log_prefix,
957 slap_send_search_entry( Operation *op, SlapReply *rs )
976 if ( op->ors_slimit >= 0 && rs->sr_nentries >= op->ors_slimit ) {
1000 rc = backend_operational( op, rs );
1005 if ( op->o_callback ) {
1006 rc = slap_response_play( op, rs );
1013 op->o_connid, rs->sr_entry->e_name.bv_val,
1014 op->ors_attrsonly ? " (attrsOnly)" : "" );
1016 attrsonly = op->ors_attrsonly;
1018 if ( !access_allowed( op, rs->sr_entry, ad_entry, NULL, ACL_READ, NULL )) {
1021 op->o_connid, rs->sr_entry->e_name.bv_val, 0 );
1027 if ( op->o_res_ber ) {
1029 ber = op->o_res_ber;
1034 bv.bv_val = op->o_tmpalloc( bv.bv_len, op->o_tmpmemctx );
1037 ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
1041 if ( op->o_conn && op->o_conn->c_is_udp ) {
1043 if ( op->o_protocol == LDAP_VERSION2 ) {
1047 rc = ber_printf( ber, "{it{O{" /*}}}*/, op->o_msgid,
1052 if ( op->o_res_ber ) {
1057 rc = ber_printf( ber, "{it{O{" /*}}}*/, op->o_msgid,
1064 op->o_connid, 0, 0 );
1066 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1067 send_ldap_error( op, rs, LDAP_OTHER, "encoding DN error" );
1079 if ( op->o_vrFilter != NULL ) {
1090 e_flags = slap_sl_calloc ( 1, i * sizeof(char *) + k, op->o_tmpmemctx );
1094 op->o_connid, 0, 0 );
1097 send_ldap_error( op, rs, LDAP_OTHER, "out of memory" );
1108 rc = filter_matched_values(op, rs->sr_entry->e_attrs, &e_flags) ;
1112 op->o_connid, 0, 0 );
1113 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1114 send_ldap_error( op, rs, LDAP_OTHER,
1137 /* if not all op attrs requested, skip */
1141 if ( op->o_sync != SLAP_CONTROL_NONE &&
1153 if ( ! access_allowed( op, rs->sr_entry, desc, NULL,
1158 op->o_connid, desc->ad_cname.bv_val, 0 );
1165 op->o_connid, 0, 0 );
1167 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1168 send_ldap_error( op, rs, LDAP_OTHER,
1178 if ( ! access_allowed( op, rs->sr_entry,
1184 op->o_connid, desc->ad_cname.bv_val, i );
1189 if ( op->o_vrFilter && e_flags[j][i] == 0 ){
1199 op->o_connid, 0, 0 );
1201 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1202 send_ldap_error( op, rs, LDAP_OTHER,
1211 "ber_printf failed.\n", op->o_connid, 0, 0 );
1213 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1214 send_ldap_error( op, rs, LDAP_OTHER,
1225 op->o_connid, 0, 0 );
1227 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1228 send_ldap_error( op, rs, LDAP_OTHER, "encode end error" );
1236 if ( rs->sr_operational_attrs != NULL && op->o_vrFilter != NULL ) {
1253 op->o_tmpmemctx );
1259 op->o_connid, 0, 0 );
1260 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1261 send_ldap_error( op, rs, LDAP_OTHER,
1273 rc = filter_matched_values(op, rs->sr_operational_attrs, &e_flags) ;
1279 op->o_connid, 0, 0);
1280 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1281 send_ldap_error( op, rs, LDAP_OTHER,
1307 if ( op->o_sync != SLAP_CONTROL_NONE &&
1317 if ( ! access_allowed( op, rs->sr_entry, desc, NULL,
1323 op->o_connid, desc->ad_cname.bv_val, 0 );
1332 "ber_printf failed\n", op->o_connid, 0, 0 );
1334 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1335 send_ldap_error( op, rs, LDAP_OTHER,
1343 if ( ! access_allowed( op, rs->sr_entry,
1349 op->o_connid, desc->ad_cname.bv_val, i );
1354 if ( op->o_vrFilter && e_flags[j][i] == 0 ){
1361 op->o_connid, 0, 0 );
1363 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1364 send_ldap_error( op, rs, LDAP_OTHER,
1375 op->o_connid, 0, 0 );
1377 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1378 send_ldap_error( op, rs, LDAP_OTHER, "encode end error" );
1386 slap_sl_free( e_flags, op->o_tmpmemctx );
1393 rc = send_ldap_controls( op, ber, rs->sr_ctrls );
1398 if( op->o_conn && op->o_conn->c_is_udp ) {
1399 if ( op->o_protocol != LDAP_VERSION2 ) {
1404 if ( op->o_res_ber == NULL ) {
1412 if ( op->o_res_ber == NULL ) ber_free_buf( ber );
1413 send_ldap_error( op, rs, LDAP_OTHER, "encode entry end error" );
1419 op->o_log_prefix, rs->sr_entry->e_nname.bv_val, 0, 0, 0 );
1421 rs_flush_entry( op, rs, NULL );
1423 if ( op->o_res_ber == NULL ) {
1424 bytes = send_ldap_ber( op, ber );
1430 op->o_connid, 0, 0 );
1437 ldap_pvt_thread_mutex_lock( &op->o_counters->sc_mutex );
1438 ldap_pvt_mp_add_ulong( op->o_counters->sc_bytes, (unsigned long)bytes );
1439 ldap_pvt_mp_add_ulong( op->o_counters->sc_entries, 1 );
1440 ldap_pvt_mp_add_ulong( op->o_counters->sc_pdu, 1 );
1441 ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex );
1445 "<= send_search_entry: conn %lu exit.\n", op->o_connid, 0, 0 );
1450 if ( op->o_callback ) {
1451 (void)slap_cleanup_play( op, rs );
1455 slap_sl_free( e_flags, op->o_tmpmemctx );
1465 if ( op->o_tag == LDAP_REQ_SEARCH && rs->sr_type == REP_SEARCH ) {
1466 rs_flush_entry( op, rs, NULL );
1474 slap_free_ctrls( op, rs->sr_ctrls );
1483 slap_send_search_reference( Operation *op, SlapReply *rs )
1495 if ( op->o_callback ) {
1496 rc = slap_response_play( op, rs );
1506 if ( rs->sr_entry && ! access_allowed( op, rs->sr_entry,
1516 if ( rs->sr_entry && ! access_allowed( op, rs->sr_entry,
1527 if( op->o_domain_scope ) {
1543 if( op->o_protocol < LDAP_VERSION3 ) {
1554 if( op->o_conn && op->o_conn->c_is_udp ) {
1555 ber = op->o_res_ber;
1560 ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
1563 rc = ber_printf( ber, "{it{W}" /*"}"*/ , op->o_msgid,
1567 rc = send_ldap_controls( op, ber, rs->sr_ctrls );
1579 if (!op->o_conn || op->o_conn->c_is_udp == 0)
1582 send_ldap_error( op, rs, LDAP_OTHER, "encode DN error" );
1587 rs_flush_entry( op, rs, NULL );
1590 if (!op->o_conn || op->o_conn->c_is_udp == 0) {
1592 bytes = send_ldap_ber( op, ber );
1598 ldap_pvt_thread_mutex_lock( &op->o_counters->sc_mutex );
1599 ldap_pvt_mp_add_ulong( op->o_counters->sc_bytes, (unsigned long)bytes );
1600 ldap_pvt_mp_add_ulong( op->o_counters->sc_refs, 1 );
1601 ldap_pvt_mp_add_ulong( op->o_counters->sc_pdu, 1 );
1602 ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex );
1612 op->o_log_prefix, r, rs->sr_ref[0].bv_val,
1618 op->o_log_prefix, 0, 0, 0, 0 );
1625 rs_flush_entry( op, rs, NULL );
1628 if ( op->o_callback ) {
1629 (void)slap_cleanup_play( op, rs );
1635 slap_free_ctrls( op, rs->sr_ctrls );
1733 Operation *op,
1747 op->o_log_prefix, oid->bv_val, e->e_dn );
1751 op->o_preread_attrs : op->o_postread_attrs;
1754 bv.bv_val = op->o_tmpalloc( bv.bv_len, op->o_tmpmemctx );
1757 ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
1760 myop = *op;
1762 myop.o_bd = op->o_bd;
1783 slap_sl_free( (*ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );