ITS#6373 create subentry if missing

This commit is contained in:
Howard Chu 2009-11-11 03:36:46 +00:00
parent 46a97b9204
commit 9ad558b78c
2 changed files with 28 additions and 0 deletions

View File

@ -1399,6 +1399,20 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on )
opm.o_managedsait = SLAP_CONTROL_NONCRITICAL;
opm.o_no_schema_check = 1;
opm.o_bd->be_modify( &opm, &rsm );
/* Should only happen with SYNC_USE_SUBENTRY */
if ( rsm.sr_err == LDAP_NO_SUCH_OBJECT ) {
const char *text;
char txtbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof txtbuf;
Entry *e = slap_create_context_csn_entry( opm.o_bd, NULL );
slap_mods2entry( &mod, &e, 0, 1, &text, txtbuf, textlen);
opm.ora_e = e;
opm.o_bd->be_add( &opm, &rsm );
if ( e == opm.ora_e )
be_entry_release_w( &opm, opm.ora_e );
}
if ( mod.sml_next != NULL ) {
slap_mods_free( mod.sml_next, 1 );
}

View File

@ -3061,6 +3061,20 @@ syncrepl_updateCookie(
op->orm_modlist = &mod;
op->orm_no_opattrs = 1;
rc = op->o_bd->be_modify( op, &rs_modify );
/* Should only happen when SYNC_USE_SUBENTRY */
if ( rs_modify.sr_err == LDAP_NO_SUCH_OBJECT ) {
const char *text;
char txtbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof txtbuf;
Entry *e = slap_create_context_csn_entry( op->o_bd, NULL );
rc = slap_mods2entry( &mod, &e, 0, 1, &text, txtbuf, textlen);
op->ora_e = e;
rc = op->o_bd->be_add( op, &rs_modify );
if ( e == op->ora_e )
be_entry_release_w( op, op->ora_e );
}
op->orm_no_opattrs = 0;
op->o_dont_replicate = 0;