- mod = (Modifications *) ch_malloc( sizeof( Modifications ));
- mod->sml_op = LDAP_MOD_REPLACE;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- ber_str2bv( "structuralObjectClass", strlen("structuralObjectClass"), 1, &mod->sml_type );
- mod->sml_bvalues = socbva;
- mod->sml_nvalues = NULL;
- *modtail = mod;
- modtail = &mod->sml_next;
-
- sprintf( substr, "ldapsync" );
- sprintf( rdnstr, "cn=%s", substr );
- ber_str2bv( substr, strlen( substr ), 1, &cnbva[0] );
- ber_str2bv( rdnstr, strlen( rdnstr ), 1, &psubrdn );
- cnbva[1].bv_len = 0;
- cnbva[1].bv_val = NULL;
- mod = (Modifications *) ch_malloc( sizeof( Modifications ));
- mod->sml_op = LDAP_MOD_REPLACE;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- ber_str2bv( "cn", strlen("cn"), 1, &mod->sml_type );
- mod->sml_bvalues = cnbva;
- mod->sml_nvalues = NULL;
- *modtail = mod;
- modtail = &mod->sml_next;
-
- if ( context_csn ) {
- ber_dupbv( &scbva[0], context_csn );
- scbva[1].bv_len = 0;
- scbva[1].bv_val = NULL;
- mod = (Modifications *) ch_malloc( sizeof( Modifications ));
- mod->sml_op = LDAP_MOD_REPLACE;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- ber_str2bv( "contextCSN", strlen("contextCSN"), 1, &mod->sml_type );
- mod->sml_bvalues = scbva;
- mod->sml_nvalues = NULL;
- *modtail = mod;
- modtail = &mod->sml_next;
- }
-
- ber_str2bv( "{}", strlen("{}"), 1, &ssbva[0] );
- ssbva[1].bv_len = 0;
- ssbva[1].bv_val = NULL;
- mod = (Modifications *) ch_malloc( sizeof( Modifications ));
- mod->sml_op = LDAP_MOD_REPLACE;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- ber_str2bv( "subtreeSpecification",
- strlen("subtreeSpecification"), 1, &mod->sml_type );
- mod->sml_bvalues = ssbva;
- mod->sml_nvalues = NULL;
- *modtail = mod;
- modtail = &mod->sml_next;
-
- rc = slap_mods_check( modlist, 1, &text, txtbuf, textlen, NULL );
-
- if ( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, ERR,
- "create_context_csn_entry: mods check (%s)\n", text, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY, "create_context_csn_entry: mods check (%s)\n",
- text, 0, 0 );
-#endif
- }
-
- e = ( Entry * ) ch_calloc( 1, sizeof( Entry ));
-
- build_new_dn( &sub_bv, &be->be_nsuffix[0], &psubrdn );
- dnPrettyNormal( NULL, &sub_bv, &e->e_name, &e->e_nname, NULL );
- ch_free( sub_bv.bv_val );
- ch_free( psubrdn.bv_val );
-
- e->e_attrs = NULL;
-
- rc = slap_mods2entry( modlist, &e, 1, 1, &text, txtbuf, textlen );
-
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, ERR,
- "create_context_csn_entry: mods2entry (%s)\n", text, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY, "create_context_csn_entry: mods2entry (%s)\n",
- text, 0, 0 );
-#endif
- }
-
- return e;
-}
-
-static int
-slap_contextcsn_callback(
- Operation* op,
- SlapReply* rs
-)
-{
- if ( rs->sr_type != REP_SEARCH ) {
- *((int*)op->o_callback->sc_private) = 0;
- } else {
- *((int*)op->o_callback->sc_private) = 1;
- }
- return LDAP_SUCCESS;