From: Howard Chu Date: Fri, 15 Apr 2005 06:58:03 +0000 (+0000) Subject: ITS#3616 store contextCSN in glue entry if database suffix is empty X-Git-Tag: OPENLDAP_AC_BP~886 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6399387580380d0480055a9ea634731cb69ffce7;p=openldap ITS#3616 store contextCSN in glue entry if database suffix is empty --- diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 5124c0285f..c1d6ca3d60 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -352,17 +352,14 @@ retry: /* transaction retry */ goto retry; case DB_NOTFOUND: if ( BER_BVISEMPTY( &op->o_req_ndn )) { - struct berval ocbva[] = { - BER_BVC("locality"), - BER_BVC("syncProviderSubentry"), - BER_BVNULL - }; + struct berval gluebv = BER_BVC("glue"); e = ch_calloc( 1, sizeof(Entry)); e->e_name.bv_val = ch_strdup( "" ); ber_dupbv( &e->e_nname, &e->e_name ); - attr_merge( e, slap_schema.si_ad_objectClass, ocbva, NULL ); + attr_merge_one( e, slap_schema.si_ad_objectClass, + &gluebv, NULL ); attr_merge_one( e, slap_schema.si_ad_structuralObjectClass, - &ocbva[0], NULL ); + &gluebv, NULL ); e->e_private = ei; fakeroot = 1; rs->sr_err = 0; diff --git a/servers/slapd/back-bdb/tools.c b/servers/slapd/back-bdb/tools.c index a543f427c1..9ef48193f7 100644 --- a/servers/slapd/back-bdb/tools.c +++ b/servers/slapd/back-bdb/tools.c @@ -157,12 +157,6 @@ ID bdb_tool_dn2id_get( return ei.bei_id; } -static struct berval ocbva[] = { - BER_BVC("locality"), - BER_BVC("syncProviderSubentry"), - BER_BVNULL -}; - int bdb_tool_id2entry_get( Backend *be, ID id, @@ -173,11 +167,12 @@ int bdb_tool_id2entry_get( if ( rc == DB_NOTFOUND && id == 0 ) { Entry *dummy = ch_calloc( 1, sizeof(Entry) ); + struct berval gluebv = BER_BVC("glue"); dummy->e_name.bv_val = ch_strdup( "" ); dummy->e_nname.bv_val = ch_strdup( "" ); - attr_merge( dummy, slap_schema.si_ad_objectClass, ocbva, NULL ); + attr_merge_one( dummy, slap_schema.si_ad_objectClass, &gluebv, NULL ); attr_merge_one( dummy, slap_schema.si_ad_structuralObjectClass, - &ocbva[0], NULL ); + &gluebv, NULL ); *e = dummy; rc = LDAP_SUCCESS; } diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 721dc15b8d..7ff8df6dd0 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -250,62 +250,6 @@ syncprov_done_ctrl( return LDAP_SUCCESS; } -#if 0 -/* Generate state based on session log - not implemented yet */ -static int -syncprov_state_ctrl_from_slog( - Operation *op, - SlapReply *rs, - struct slog_entry *slog_e, - int entry_sync_state, - LDAPControl **ctrls, - int num_ctrls, - int send_cookie, - struct berval *cookie) -{ - Attribute* a; - int ret; - int res; - const char *text = NULL; - - BerElementBuffer berbuf; - BerElement *ber = (BerElement *)&berbuf; - - struct berval entryuuid_bv = BER_BVNULL; - - ber_init2( ber, NULL, LBER_USE_DER ); - ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx ); - - ctrls[num_ctrls] = ch_malloc ( sizeof ( LDAPControl ) ); - - entryuuid_bv = slog_e->sl_uuid; - - if ( send_cookie && cookie ) { - ber_printf( ber, "{eOON}", - entry_sync_state, &entryuuid_bv, cookie ); - } else { - ber_printf( ber, "{eON}", - entry_sync_state, &entryuuid_bv ); - } - - ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_SYNC_STATE; - ctrls[num_ctrls]->ldctl_iscritical = (op->o_sync == SLAP_CONTROL_CRITICAL); - ret = ber_flatten2( ber, &ctrls[num_ctrls]->ldctl_value, 1 ); - - ber_free_buf( ber ); - - if ( ret < 0 ) { - Debug( LDAP_DEBUG_TRACE, - "slap_build_sync_ctrl: ber_flatten2 failed\n", - 0, 0, 0 ); - send_ldap_error( op, rs, LDAP_OTHER, "internal error" ); - return ret; - } - - return LDAP_SUCCESS; -} -#endif - static int syncprov_sendinfo( Operation *op, @@ -470,6 +414,7 @@ syncprov_findbase( Operation *op, fbase_cookie *fc ) cb.sc_private = fc; fop.o_sync_mode &= SLAP_CONTROL_MASK; /* turn off sync mode */ + fop.o_managedsait = SLAP_CONTROL_CRITICAL; fop.o_callback = &cb; fop.o_tag = LDAP_REQ_SEARCH; fop.ors_scope = LDAP_SCOPE_BASE; @@ -623,6 +568,8 @@ syncprov_findcsn( Operation *op, int mode ) fop = *op; fop.o_sync_mode &= SLAP_CONTROL_MASK; /* turn off sync_mode */ + /* We want pure entries, not referrals */ + fop.o_managedsait = SLAP_CONTROL_CRITICAL; fbuf.bv_val = buf; cf.f_ava = &eq; @@ -673,8 +620,6 @@ syncprov_findcsn( Operation *op, int mode ) fop.ors_attrsonly = 0; fop.ors_attrs = uuid_anlist; fop.ors_slimit = SLAP_NO_LIMIT; - /* We want pure entries, not referrals */ - fop.o_managedsait = SLAP_CONTROL_CRITICAL; cb.sc_private = &pcookie; cb.sc_response = findpres_cb; pcookie.num = 0; @@ -1084,8 +1029,8 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on ) Modifications mod; Operation opm; struct berval bv[2]; - BackendInfo *orig; slap_callback cb = {0}; + int manage = get_manageDSAit(op); mod.sml_values = bv; bv[1].bv_val = NULL; @@ -1102,9 +1047,10 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on ) opm.orm_modlist = &mod; opm.o_req_dn = op->o_bd->be_suffix[0]; opm.o_req_ndn = op->o_bd->be_nsuffix[0]; - orig = opm.o_bd->bd_info; opm.o_bd->bd_info = on->on_info->oi_orig; + opm.o_managedsait = SLAP_CONTROL_NONCRITICAL; opm.o_bd->be_modify( &opm, rs ); + opm.o_managedsait = manage; } static void @@ -1761,6 +1707,7 @@ syncprov_op_search( Operation *op, SlapReply *rs ) } srs = op->o_controls[slap_cids.sc_LDAPsync]; + op->o_managedsait = SLAP_CONTROL_NONCRITICAL; /* If this is a persistent search, set it up right away */ if ( op->o_sync_mode & SLAP_SYNC_PERSIST ) {