syslog\-level=<level> (see `\-S' in slapd(8))
syslog\-user=<user> (see `\-l' in slapd(8))
- schema-check={yes|no}
- value-check={yes|no}
+ schema\-check={yes|no}
+ value\-check={yes|no}
+ remove\-sids={<sid>[,<sid>,...]}
.in
The \fIschema\-check\fR option toggles schema checking (default on);
the \fIvalue\-check\fR option toggles value checking (default off).
The latter is incompatible with \fB-q\fR.
+
+The \fIremove\-sids\fR option accepts a list of sids to ignore from the file,
+corresponding CSNs in \fBentryCSN\fR and \fBcontextCSN\fR attributes will be
+replaced with freshly generated CSNs using the server ID configured by
+\fB-S\fR. Using it also implies \fB-w\fR: overwrite syncrepl context
+information.
.TP
.B \-q
enable quick (fewer integrity checks) mode. Does fewer consistency checks
struct berval nname;
char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+ Attribute *a;
+ int entrysid = -1;
+
enum {
GOT_NONE = 0x0,
GOT_CSN = 0x1,
attr_merge( e, slap_schema.si_ad_createTimestamp, vals, NULL );
}
- if( attr_find( e->e_attrs, slap_schema.si_ad_entryCSN )
+ if( (a = attr_find( e->e_attrs, slap_schema.si_ad_entryCSN ))
== NULL )
{
got &= ~GOT_CSN;
vals[0] = csn;
attr_merge( e, slap_schema.si_ad_entryCSN, vals, NULL );
+ } else if ( a->a_numvals != 1 ||
+ (entrysid = slap_parse_csn_sid( &a->a_vals[0] )) < 0 ) {
+ Debug( LDAP_DEBUG_ANY, "%s: warning, "
+ "%s values not valid in entry dn=\"%s\"\n",
+ progname, slap_schema.si_ad_entryCSN->ad_cname.bv_val,
+ e->e_name.bv_val );
+ } else if ( sids_to_remove[entrysid] ) {
+ ber_bvreplace( &a->a_vals[0], &csn );
+ ber_bvreplace( &a->a_nvals[0], &csn );
}
if( attr_find( e->e_attrs, slap_schema.si_ad_modifiersName )
if ( isatty (2) ) enable_meter = 1;
slap_tool_init( progname, SLAPADD, argc, argv );
+ if ( sids_to_remove[csnsid] ) {
+ fprintf( stderr, "%s: remove-sids contains configured serverID %u.\n",
+ progname, csnsid );
+ exit( EXIT_FAILURE );
+ }
if( !be->be_entry_open ||
!be->be_entry_close ||
break;
}
+ } else if ( ( strncasecmp( optarg, "remove-sids", len ) == 0 ) ) {
+ switch ( tool ) {
+ case SLAPADD:
+ {
+ char *arg = strtok( p, "," );
+ if ( !arg ) {
+ Debug( LDAP_DEBUG_ANY, "remove-sids needs an argument.\n" );
+ return -1;
+ }
+ do {
+ unsigned int u;
+ if ( lutil_atou( &u, arg ) || u > SLAP_SYNC_SID_MAX ) {
+ Debug( LDAP_DEBUG_ANY, "unable to parse remove-sids=\"%s\".\n", arg );
+ return -1;
+ }
+ sids_to_remove[u] = 1;
+ update_ctxcsn = 1;
+ } while ( (arg = strtok( NULL, "," )) );
+ }
+ break;
+
+ default:
+ Debug( LDAP_DEBUG_ANY, "remove-sids meaningless for tool.\n" );
+ break;
+ }
+
} else {
return -1;
}
if ( SLAP_SYNC_SUBENTRY( be )) {
ctxcsn_e = slap_create_context_csn_entry( be, NULL );
for ( sid = 0; sid <= SLAP_SYNC_SID_MAX; sid++ ) {
- if ( maxcsn[ sid ].bv_len ) {
+ if ( maxcsn[ sid ].bv_len && !sids_to_remove[sid] ) {
attr_merge_one( ctxcsn_e, slap_schema.si_ad_contextCSN,
&maxcsn[ sid ], NULL );
}
sid = (unsigned)rc_sid;
- if ( maxcsn[ sid ].bv_len == 0 ) {
+ if ( sids_to_remove[sid] ) {
+ match = 1;
+ } else if ( maxcsn[ sid ].bv_len == 0 ) {
match = -1;
} else {
ber_len_t tv_ldif_wrap;
char tv_maxcsnbuf[ LDAP_PVT_CSNSTR_BUFSIZE * ( SLAP_SYNC_SID_MAX + 1 ) ];
struct berval tv_maxcsn[ SLAP_SYNC_SID_MAX + 1 ];
+ char tv_sids_to_remove[ SLAP_SYNC_SID_MAX + 1 ];
} tool_vars;
extern tool_vars tool_globals;
#define ldif_wrap tool_globals.tv_ldif_wrap
#define maxcsn tool_globals.tv_maxcsn
#define maxcsnbuf tool_globals.tv_maxcsnbuf
+#define sids_to_remove tool_globals.tv_sids_to_remove
#define SLAP_TOOL_LDAPDN_PRETTY SLAP_LDAPDN_PRETTY
#define SLAP_TOOL_LDAPDN_NORMAL (SLAP_LDAPDN_PRETTY << 1)