Lines Matching refs:op
65 Operation *s_op; /* search op */
159 short osid; /* sid of op csn */
182 Operation *op,
201 ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
223 cp = op->o_tmpalloc( sizeof( LDAPControl ) + bv.bv_len, op->o_tmpmemctx );
225 cp->ldctl_iscritical = (op->o_sync == SLAP_CONTROL_CRITICAL);
237 send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
247 Operation *op,
262 ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
275 cp = op->o_tmpalloc( sizeof( LDAPControl ) + bv.bv_len, op->o_tmpmemctx );
277 cp->ldctl_iscritical = (op->o_sync == SLAP_CONTROL_CRITICAL);
290 send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
299 Operation *op,
314 ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
357 send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
363 send_ldap_intermediate( op, rs );
394 findbase_cb( Operation *op, SlapReply *rs )
396 slap_callback *sc = op->o_callback;
426 syncprov_findbase( Operation *op, fbase_cookie *fc )
429 * current op's threadctx / tmpmemctx
444 fop.o_hdr = op->o_hdr;
445 fop.o_time = op->o_time;
446 fop.o_tincr = op->o_tincr;
523 findmax_cb( Operation *op, SlapReply *rs )
526 struct berval *maxcsn = op->o_callback->sc_private;
540 findcsn_cb( Operation *op, SlapReply *rs )
542 slap_callback *sc = op->o_callback;
565 findpres_cb( Operation *op, SlapReply *rs )
567 slap_callback *sc = op->o_callback;
590 ret = syncprov_sendinfo( op, rs, LDAP_TAG_SYNC_ID_SET, NULL,
604 syncprov_findcsn( Operation *op, find_csn_t mode, struct berval *csn )
606 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
624 srs = op->o_controls[slap_cids.sc_LDAPsync];
627 fop = *op;
679 fop.o_dn = op->o_bd->be_rootdn;
680 fop.o_ndn = op->o_bd->be_rootndn;
681 fop.o_req_dn = op->o_bd->be_suffix[0];
682 fop.o_req_ndn = op->o_bd->be_nsuffix[0];
707 fop.ors_filter = op->ors_filter;
708 fop.ors_filterstr = op->ors_filterstr;
717 pcookie.uuids = op->o_tmpalloc( (SLAP_SYNCUUID_SET_SIZE+1) *
719 op->o_tmpmemctx );
758 op->o_tmpfree( pcookie.uuids, op->o_tmpmemctx );
833 syncprov_sendresp( Operation *op, opcookie *opc, syncops *so, int mode )
843 rs.sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2, op->o_tmpmemctx );
848 slap_compose_sync_cookie( op, &cookie, csns, so->s_rid, slap_serverID ? slap_serverID : -1 );
863 rs.sr_err = syncprov_state_ctrl( op, &rs, &e_uuid,
865 op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
876 rs.sr_ref = get_entry_referrals( op, rs.sr_entry );
877 rs.sr_err = send_search_reference( op, &rs );
883 rs.sr_attrs = op->ors_attrs;
884 rs.sr_err = send_search_entry( op, &rs );
893 rs.sr_err = send_search_reference( op, &rs );
895 rs.sr_err = send_search_entry( op, &rs );
909 syncprov_qplay( Operation *op, syncops *so )
934 rc = syncprov_sendinfo( op, &rs, LDAP_TAG_SYNC_NEW_COOKIE,
944 rc = syncprov_sendresp( op, &opc, so, sr->s_mode );
986 Operation *op;
990 op = &opbuf.ob_op;
991 *op = *so->s_op;
992 op->o_hdr = &opbuf.ob_hdr;
993 op->o_controls = opbuf.ob_controls;
994 memset( op->o_controls, 0, sizeof(opbuf.ob_controls) );
995 op->o_sync = SLAP_CONTROL_IGNORED;
997 *op->o_hdr = *so->s_op->o_hdr;
999 op->o_tmpmemctx = slap_sl_mem_create(SLAP_SLAB_SIZE, SLAP_SLAB_STACK, ctx, 1);
1000 op->o_tmpmfuncs = &slap_sl_mfuncs;
1001 op->o_threadctx = ctx;
1006 op->o_bd = &be;
1007 LDAP_SLIST_FIRST(&op->o_extra) = NULL;
1008 op->o_callback = NULL;
1010 rc = syncprov_qplay( op, so );
1115 syncprov_ab_cleanup( Operation *op, SlapReply *rs )
1117 slap_callback *sc = op->o_callback;
1118 op->o_callback = sc->sc_next;
1119 syncprov_drop_psearch( op->o_callback->sc_private, 0 );
1120 op->o_tmpfree( sc, op->o_tmpmemctx );
1125 syncprov_op_abandon( Operation *op, SlapReply *rs )
1127 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
1134 if ( so->s_op->o_connid == op->o_connid &&
1135 so->s_op->o_msgid == op->orn_msgid ) {
1144 if ( op->o_tag != LDAP_REQ_ABANDON ) {
1150 cb = op->o_tmpcalloc( 1, sizeof(slap_callback), op->o_tmpmemctx );
1152 cb->sc_next = op->o_callback;
1154 op->o_callback = cb;
1165 syncprov_matchops( Operation *op, opcookie *opc, int saveit )
1177 BackendDB *b0 = op->o_bd, db;
1179 fc.fdn = &op->o_req_ndn;
1181 if ( op->o_tag == LDAP_REQ_MODRDN && !saveit ) {
1183 if ( op->orr_nnewSup ) pdn = *op->orr_nnewSup;
1185 build_new_dn( &newdn, &pdn, &op->orr_nnewrdn, op->o_tmpmemctx );
1189 if ( op->o_tag != LDAP_REQ_ADD ) {
1190 if ( !SLAP_ISOVERLAY( op->o_bd )) {
1191 db = *op->o_bd;
1192 op->o_bd = &db;
1194 rc = overlay_entry_get_ov( op, fc.fdn, NULL, NULL, 0, &e, on );
1201 overlay_entry_release_ov( op, e, 0, on );
1205 op->o_bd = b0;
1209 e = op->ora_e;
1219 if ( saveit || op->o_tag == LDAP_REQ_ADD ) {
1220 ber_dupbv_x( &opc->sdn, &e->e_name, op->o_tmpmemctx );
1221 ber_dupbv_x( &opc->sndn, &e->e_nname, op->o_tmpmemctx );
1225 ber_dupbv_x( &opc->suuid, &a->a_nvals[0], op->o_tmpmemctx );
1226 } else if ( op->o_tag == LDAP_REQ_MODRDN && !saveit ) {
1227 op->o_tmpfree( opc->sndn.bv_val, op->o_tmpmemctx );
1228 op->o_tmpfree( opc->sdn.bv_val, op->o_tmpmemctx );
1229 ber_dupbv_x( &opc->sdn, &e->e_name, op->o_tmpmemctx );
1230 ber_dupbv_x( &opc->sndn, &e->e_nname, op->o_tmpmemctx );
1266 rc = syncprov_findbase( op, &fc );
1277 /* If we're sending results now, look for this op in old matches */
1282 if ( dn_match( &op->o_req_ndn, &ss->s_base )) {
1293 op->o_tmpfree( sm, op->o_tmpmemctx );
1302 oh = *op->o_hdr;
1305 op2.o_bd = op->o_bd->bd_self;
1307 op2.o_extra = op->o_extra;
1325 sm = op->o_tmpalloc( sizeof(syncmatches), op->o_tmpmemctx );
1352 if ( op->o_tag != LDAP_REQ_ADD && e ) {
1353 if ( !SLAP_ISOVERLAY( op->o_bd )) {
1354 op->o_bd = &db;
1357 overlay_entry_release_ov( op, e, 0, on );
1358 op->o_bd = b0;
1368 op->o_tmpfree( fc.fdn->bv_val, op->o_tmpmemctx );
1370 op->o_bd = b0;
1374 syncprov_op_cleanup( Operation *op, SlapReply *rs )
1376 slap_callback *cb = op->o_callback;
1391 op->o_tmpfree( sm, op->o_tmpmemctx );
1394 /* Remove op from lock table */
1413 op->o_tmpfree( opc->suuid.bv_val, op->o_tmpmemctx );
1415 op->o_tmpfree( opc->sndn.bv_val, op->o_tmpmemctx );
1417 op->o_tmpfree( opc->sdn.bv_val, op->o_tmpmemctx );
1418 op->o_callback = cb->sc_next;
1419 op->o_tmpfree(cb, op->o_tmpmemctx);
1425 syncprov_checkpoint( Operation *op, slap_overinst *on )
1452 opm = *op;
1457 if ( SLAP_GLUE_SUBORDINATE( op->o_bd )) {
1495 syncprov_add_slog( Operation *op )
1497 opcookie *opc = op->o_callback->sc_private;
1505 if ( BER_BVISEMPTY( &op->o_csn ) ) {
1524 op->o_csn.bv_len + 1 );
1526 se->se_tag = op->o_tag;
1533 AC_MEMCPY( se->se_csn.bv_val, op->o_csn.bv_val, op->o_csn.bv_len );
1534 se->se_csn.bv_val[op->o_csn.bv_len] = '\0';
1535 se->se_csn.bv_len = op->o_csn.bv_len;
1590 playlog_cb( Operation *op, SlapReply *rs )
1593 op->o_callback->sc_private = (void *)1;
1600 syncprov_playlog( Operation *op, SlapReply *rs, sessionlog *sl,
1603 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
1619 uuids = op->o_tmpalloc( (num+1) * sizeof( struct berval ) +
1620 num * UUID_LEN, op->o_tmpmemctx );
1712 fop = *op;
1756 slap_compose_sync_cookie( op, &cookie, delcsn, srs->sr_state.rid,
1763 syncprov_sendinfo( op, rs, LDAP_TAG_SYNC_ID_SET,
1766 op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
1769 op->o_tmpfree( uuids, op->o_tmpmemctx );
1773 syncprov_op_response( Operation *op, SlapReply *rs )
1775 opcookie *opc = op->o_callback->sc_private;
1794 slap_get_commit_csn( op, &maxcsn, &foundit );
1795 if ( BER_BVISEMPTY( &maxcsn ) && SLAP_GLUE_SUBORDINATE( op->o_bd )) {
1801 BackendDB *be = op->o_bd;
1802 op->o_bd = select_backend( &be->be_nsuffix[0], 1);
1805 slap_get_commit_csn( op, &maxcsn, &foundit );
1806 op->o_bd = be;
1835 if ( op->o_dont_replicate ) {
1836 if ( op->o_tag == LDAP_REQ_MODIFY &&
1837 op->orm_modlist->sml_op == LDAP_MOD_REPLACE &&
1838 op->orm_modlist->sml_desc == slap_schema.si_ad_contextCSN ) {
1843 Modifications *mod = op->orm_modlist;
1898 if ( op->o_tag != LDAP_REQ_ADD ||
1899 !dn_match( &op->o_req_ndn, &si->si_contextdn )) {
1905 (op->o_time - si->si_chklast >= si->si_chktime )) {
1908 si->si_chklast = op->o_time;
1920 syncprov_checkpoint( op, on );
1934 switch(op->o_tag) {
1939 syncprov_matchops( op, opc, 0 );
1956 syncprov_add_slog( op );
1968 syncprov_op_compare( Operation *op, SlapReply *rs )
1970 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
1974 if ( dn_match( &op->o_req_ndn, &si->si_contextdn ) &&
1975 op->oq_compare.rs_ava->aa_desc == slap_schema.si_ad_contextCSN )
1992 rs->sr_err = access_allowed( op, &e, op->oq_compare.rs_ava->aa_desc,
1993 &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL );
1999 if ( get_assert( op ) &&
2000 ( test_filter( op, &e, get_assertion( op ) ) != LDAP_COMPARE_TRUE ) )
2012 &op->oq_compare.rs_ava->aa_value, NULL, op->o_tmpmemctx ) == 0 )
2021 send_ldap_result( op, rs );
2033 syncprov_op_mod( Operation *op, SlapReply *rs )
2035 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
2049 cb = op->o_tmpcalloc(1, cbsize, op->o_tmpmemctx);
2055 cb->sc_next = op->o_callback;
2056 op->o_callback = cb;
2060 if ( op->o_csn.bv_val ) {
2061 opc->osid = slap_parse_csn_sid( &op->o_csn );
2063 if ( op->o_controls ) {
2065 op->o_controls[slap_cids.sc_LDAPsync];
2070 if ( op->o_dont_replicate )
2081 mi->mi_op = op;
2084 mtdummy.mt_dn = op->o_req_ndn;
2101 /* wait for this op to get to head of list */
2117 if ( op->o_abandon ) {
2127 /* abandon current active op */
2128 op->o_callback = cb->sc_next; /* reset to previous callback */
2129 op->o_tmpfree( cb, op->o_tmpmemctx ); /* remove syncprov_op_cleanup and syncprov_op_response callbacks */
2151 if (( have_psearches || si->si_logs ) && op->o_tag != LDAP_REQ_ADD )
2152 syncprov_matchops( op, opc, 1 );
2158 syncprov_op_extended( Operation *op, SlapReply *rs )
2160 if ( exop_is_write( op ))
2161 return syncprov_op_mod( op, rs );
2186 syncprov_detach_op( Operation *op, syncops *so, slap_overinst *on )
2196 for (i=0; op->ors_attrs && !BER_BVISNULL( &op->ors_attrs[i].an_name ); i++) {
2197 alen += op->ors_attrs[i].an_name.bv_len + 1;
2202 op->o_req_dn.bv_len + 1 +
2203 op->o_req_ndn.bv_len + 1 +
2204 op->o_ndn.bv_len + 1 +
2212 *op2->o_hdr = *op->o_hdr;
2213 op2->o_tag = op->o_tag;
2214 op2->o_time = op->o_time;
2216 op2->o_request = op->o_request;
2217 op2->o_managedsait = op->o_managedsait;
2225 for (i=0; !BER_BVISNULL( &op->ors_attrs[i].an_name ); i++) {
2226 op2->ors_attrs[i] = op->ors_attrs[i];
2228 ptr = lutil_strcopy( ptr, op->ors_attrs[i].an_name.bv_val ) + 1;
2233 op2->o_authz = op->o_authz;
2235 ptr = lutil_strcopy(ptr, op->o_ndn.bv_val) + 1;
2237 op2->o_req_dn.bv_len = op->o_req_dn.bv_len;
2239 ptr = lutil_strcopy(ptr, op->o_req_dn.bv_val) + 1;
2240 op2->o_req_ndn.bv_len = op->o_req_ndn.bv_len;
2242 ptr = lutil_strcopy(ptr, op->o_req_ndn.bv_val) + 1;
2249 op2->ors_filter = op->ors_filter->f_and->f_next;
2252 op2->ors_filter = op->ors_filter;
2259 for ( g1=op->o_groups; g1; g1=g1->ga_next ) {
2270 op->o_conn->c_n_ops_executing++;
2271 op->o_conn->c_n_ops_completed--;
2272 LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op2, o_next );
2275 /* Prevent anyone else from trying to send a result for this op */
2276 op->o_abandon = 1;
2280 syncprov_search_response( Operation *op, SlapReply *rs )
2282 searchstate *ss = op->o_callback->sc_private;
2285 sync_control *srs = op->o_controls[slap_cids.sc_LDAPsync];
2347 rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,
2348 op->o_tmpmemctx );
2354 slap_compose_sync_cookie( op, &cookie, a->a_nvals, srs->sr_state.rid, slap_serverID ? slap_serverID : -1 );
2355 rs->sr_err = syncprov_state_ctrl( op, rs, rs->sr_entry,
2357 op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
2359 rs->sr_err = syncprov_state_ctrl( op, rs, rs->sr_entry,
2367 slap_compose_sync_cookie( op, &cookie, ss->ss_ctxcsn,
2377 rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,
2378 op->o_tmpmemctx );
2381 rs->sr_err = syncprov_done_ctrl( op, rs, rs->sr_ctrls,
2384 op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
2387 syncprov_sendinfo( op, rs, ( ss->ss_flags & SS_PRESENT ) ?
2392 op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
2395 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
2398 if ( op->o_abandon ) {
2399 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
2408 syncprov_detach_op( op, ss->ss_so, on );
2410 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
2426 syncprov_op_search( Operation *op, SlapReply *rs )
2428 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
2441 if ( !(op->o_sync_mode & SLAP_SYNC_REFRESH) ) return SLAP_CB_CONTINUE;
2443 if ( op->ors_deref & LDAP_DEREF_SEARCHING ) {
2444 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "illegal value for derefAliases" );
2448 srs = op->o_controls[slap_cids.sc_LDAPsync];
2451 if ( op->o_sync_mode & SLAP_SYNC_PERSIST ) {
2460 so.s_op = op;
2466 cb = op->o_callback;
2467 op->o_callback = ≻
2468 rs->sr_err = syncprov_findbase( op, &fc );
2469 op->o_callback = cb;
2473 send_ldap_result( op, rs );
2512 ber_bvarray_dup_x( &ctxcsn, si->si_ctxcsn, op->o_tmpmemctx );
2513 sids = op->o_tmpalloc( numcsns * sizeof(int), op->o_tmpmemctx );
2563 ber_bvarray_free_x( srs->sr_state.ctxcsn, op->o_tmpmemctx );
2567 slap_sl_free( srs->sr_state.sids, op->o_tmpmemctx );
2610 send_ldap_result( op, rs );
2622 no_change: if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
2627 syncprov_done_ctrl( op, rs, ctrls, 0, 0,
2631 send_ldap_result( op, rs );
2669 syncprov_playlog( op, rs, sl, srs, ctxcsn, numcsns, sids );
2675 if ( syncprov_findcsn( op, FIND_CSN, &mincsn ) != LDAP_SUCCESS ) {
2680 ber_bvarray_free_x( ctxcsn, op->o_tmpmemctx );
2682 op->o_tmpfree( sids, op->o_tmpmemctx );
2688 ber_bvarray_free_x( srs->sr_state.ctxcsn, op->o_tmpmemctx );
2692 slap_sl_free( srs->sr_state.sids, op->o_tmpmemctx );
2699 if ( do_present && syncprov_findcsn( op, FIND_PRESENT, 0 ) !=
2702 ber_bvarray_free_x( ctxcsn, op->o_tmpmemctx );
2704 op->o_tmpfree( sids, op->o_tmpmemctx );
2719 sop->s_filterstr = op->ors_filterstr;
2728 fand = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
2731 fava = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
2734 fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx );
2739 ber_dupbv_x( &fava->f_ava->aa_value, &mincsn, op->o_tmpmemctx );
2740 fava->f_next = op->ors_filter;
2741 op->ors_filter = fand;
2742 filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
2752 cb = op->o_tmpcalloc(1, sizeof(slap_callback)+sizeof(searchstate), op->o_tmpmemctx);
2762 cb->sc_next = op->o_callback;
2763 op->o_callback = cb;
2772 send_ldap_result( op, rs );
2780 Operation *op,
2783 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
2789 if ( op->o_sync != SLAP_CONTROL_NONE )
2815 if ( rs_entry2modifiable( op, rs, on )) {
2885 if ( c->op == SLAP_CONFIG_EMIT ) {
2928 } else if ( c->op == LDAP_MOD_DELETE ) {
3050 Operation *op;
3073 op = &opbuf.ob_op;
3074 op->o_bd = be;
3075 op->o_dn = be->be_rootdn;
3076 op->o_ndn = be->be_rootndn;
3084 rc = overlay_entry_get_ov( op, &si->si_contextdn, NULL,
3097 overlay_entry_release_ov( op, e, 0, on );
3099 op->o_tag = LDAP_REQ_SEARCH;
3100 op->o_req_dn = be->be_suffix[0];
3101 op->o_req_ndn = be->be_nsuffix[0];
3102 op->ors_scope = LDAP_SCOPE_SUBTREE;
3103 ldap_pvt_thread_create( &tid, 0, syncprov_db_otask, op );
3113 if ( SLAP_SYNC_SHADOW( op->o_bd )) {
3122 slap_get_csn( op, &csn, 0 );
3144 op->o_bd->bd_info = (BackendInfo *)on;
3168 Operation *op;
3173 op = &opbuf.ob_op;
3174 op->o_bd = be;
3175 op->o_dn = be->be_rootdn;
3176 op->o_ndn = be->be_rootndn;
3177 syncprov_checkpoint( op, on );
3273 Operation *op,
3286 if ( op->o_sync != SLAP_CONTROL_NONE ) {
3291 if ( op->o_pagedresults != SLAP_CONTROL_NONE ) {
3356 sr = op->o_tmpcalloc( 1, sizeof(struct sync_control), op->o_tmpmemctx );
3359 ber_dupbv_x( &sr->sr_state.octet_str, &cookie, op->o_tmpmemctx );
3361 if ( slap_parse_sync_cookie( &sr->sr_state, op->o_tmpmemctx ) ||
3364 ber_bvarray_free_x( sr->sr_state.ctxcsn, op->o_tmpmemctx );
3371 op->o_controls[slap_cids.sc_LDAPsync] = sr;
3373 op->o_sync = ctrl->ldctl_iscritical
3377 op->o_sync_mode |= mode; /* o_sync_mode shares o_sync */