{
fprintf( stderr, "%s: database doesn't support necessary operations.\n",
progname );
- exit( EXIT_FAILURE );
+ if ( !dryrun ) {
+ exit( EXIT_FAILURE );
+ }
}
lmax = 0;
lineno = 0;
- if( be->be_entry_open( be, 1 ) != 0 ) {
+ if( !dryrun && be->be_entry_open( be, 1 ) != 0 ) {
fprintf( stderr, "%s: could not open database.\n",
progname );
exit( EXIT_FAILURE );
}
}
+ if ( dryrun ) {
+ if ( verbose ) {
+ fprintf( stderr, "(dry) added: \"%s\"\n", e->e_dn );
+ }
+ goto done;
+ }
+
if ( update_ctxcsn == SLAP_TOOL_CTXCSN_KEEP &&
( replica_promotion || replica_demotion )) {
if ( is_entry_syncProviderSubentry( e )) {
}
if (( !is_entry_syncProviderSubentry( e ) &&
- !is_entry_syncConsumerSubentry( e )) ||
- ( !replica_promotion && !replica_demotion )) {
+ !is_entry_syncConsumerSubentry( e )) ||
+ ( !replica_promotion && !replica_demotion ))
+ {
+ /* dryrun moved earlier */
+ assert( !dryrun );
+
if (!dryrun) {
ID id = be->be_entry_put( be, e, &bvtext );
if( id == NOID ) {
}
}
+done:;
entry_free( e );
}
if ( ctxcsn_id == NOID ) {
ctxcsn_e = slap_create_context_csn_entry( be, &maxcsn );
+
+ /* dryrun moved earlier */
+ assert( !dryrun );
+
if ( !dryrun ) {
ctxcsn_id = be->be_entry_put( be, ctxcsn_e, &bvtext );
if( ctxcsn_id == NOID ) {
AC_MEMCPY( attr->a_vals[0].bv_val, maxcsn.bv_val, maxcsn.bv_len );
attr->a_vals[0].bv_val[maxcsn.bv_len] = '\0';
attr->a_vals[0].bv_len = maxcsn.bv_len;
+
+ /* dryrun moved earlier */
+ assert( !dryrun );
+
if ( !dryrun ) {
ctxcsn_id = be->be_entry_modify( be, ctxcsn_e, &bvtext );
if( ctxcsn_id == NOID ) {
if ( ctxcsn_id == NOID ) {
ctxcsn_e = slap_create_syncrepl_entry( be, &mc,
- &slap_syncrepl_cn_bv,
- &slap_syncrepl_bv );
+ &slap_syncrepl_cn_bv,
+ &slap_syncrepl_bv );
+
+ /* dryrun moved earlier */
+ assert( !dryrun );
+
if ( !dryrun ) {
ctxcsn_id = be->be_entry_put( be, ctxcsn_e, &bvtext );
if( ctxcsn_id == NOID ) {
AC_MEMCPY( attr->a_vals[0].bv_val, mc.bv_val, mc.bv_len );
attr->a_vals[0].bv_val[maxcsn.bv_len] = '\0';
attr->a_vals[0].bv_len = maxcsn.bv_len;
+
+ /* dryrun moved earlier */
+ assert( !dryrun );
+
if ( !dryrun ) {
ctxcsn_id = be->be_entry_modify( be,
ctxcsn_e, &bvtext );
if ( ctxcsn_id == NOID ) {
ctxcsn_e = slap_create_syncrepl_entry( be, &sei->cookie,
- &sei->rdn, &sei->cn );
+ &sei->rdn, &sei->cn );
+
+ /* dryrun moved earlier */
+ assert( !dryrun );
+
if ( !dryrun ) {
ctxcsn_id = be->be_entry_put( be, ctxcsn_e, &bvtext );
if( ctxcsn_id == NOID ) {
AC_MEMCPY( attr->a_vals[0].bv_val, sei->cookie.bv_val, sei->cookie.bv_len );
attr->a_vals[0].bv_val[sei->cookie.bv_len] = '\0';
attr->a_vals[0].bv_len = sei->cookie.bv_len;
+
+ /* dryrun moved earlier */
+ assert( !dryrun );
+
if ( !dryrun ) {
ctxcsn_id = be->be_entry_modify( be,
ctxcsn_e, &bvtext );
ch_free( buf );
- if( be->be_entry_close( be )) rc = EXIT_FAILURE;
+ if ( !dryrun ) {
+ if( be->be_entry_close( be ) ) {
+ rc = EXIT_FAILURE;
+ }
- if( be->be_sync ) {
- be->be_sync( be );
+ if( be->be_sync ) {
+ be->be_sync( be );
+ }
}
slap_tool_destroy();