} else if ( SLAP_MONITOR(c->be) ) {
notallowed = "monitor";
-
- } else if ( SLAP_CONFIG(c->be) ) {
- notallowed = "config";
}
if ( notallowed != NULL ) {
}
return 0;
}
- if(!SLAP_SHADOW(c->be)) {
+ if(!SLAP_SHADOW(c->be) && !c->be->be_syncinfo) {
snprintf( c->msg, sizeof( c->msg ), "<%s> must appear after syncrepl or updatedn",
c->argv[0] );
Debug(LDAP_DEBUG_ANY, "%s: %s\n",
{
CfEntryInfo *ce;
int index = -1, gotindex = 0, nsibs, rc = 0;
- int renumber = 0, tailindex = 0;
+ int renumber = 0, tailindex = 0, isfrontend = 0;
char *ptr1, *ptr2 = NULL;
struct berval rdn;
/* See if the rdn has an index already */
dnRdn( &e->e_name, &rdn );
+ if ( ce_type == Cft_Database && !strncmp( rdn.bv_val + rdn.bv_len -
+ STRLENOF("frontend"), "frontend", STRLENOF("frontend") ))
+ isfrontend = 1;
ptr1 = ber_bvchr( &e->e_name, '{' );
if ( ptr1 && ptr1 - e->e_name.bv_val < rdn.bv_len ) {
char *next;
}
if ( index < 0 ) {
/* Special case, we allow -1 for the frontendDB */
- if ( index != -1 || ce_type != Cft_Database ||
- strncmp( ptr2+1, "frontend,", STRLENOF("frontend,") ))
-
+ if ( index != -1 || !isfrontend )
return LDAP_NAMING_VIOLATION;
}
}
+ if ( !isfrontend && index == -1 )
+ index = 0;
+
/* count related kids */
for (nsibs=0, ce=parent->ce_kids; ce; ce=ce->ce_sibs) {
if ( ce->ce_type == ce_type ) nsibs++;
return rs->sr_err;
}
+static int
+config_back_delete( Operation *op, SlapReply *rs )
+{
+ send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, NULL );
+ return rs->sr_err;
+}
+
static int
config_back_search( Operation *op, SlapReply *rs )
{
bi->bi_op_modify = config_back_modify;
bi->bi_op_modrdn = config_back_modrdn;
bi->bi_op_add = config_back_add;
- bi->bi_op_delete = 0;
+ bi->bi_op_delete = config_back_delete;
bi->bi_op_abandon = 0;
bi->bi_extended = 0;
}
si->si_be = c->be;
- init_syncrepl( si );
- si->si_re = ldap_pvt_runqueue_insert( &slapd_rq, si->si_interval,
- do_syncrepl, si, "do_syncrepl", c->be->be_suffix[0].bv_val );
- if ( !si->si_re )
- rc = -1;
+ if ( slapMode & SLAP_SERVER_MODE ) {
+ Listener **l = slapd_get_listeners();
+ int isMe = 0;
+
+ /* check if URL points to current server. If so, ignore
+ * this configuration. We require an exact match. Just
+ * in case they really want to do this, they can vary
+ * the case of the URL to allow it.
+ */
+ if ( l ) {
+ int i;
+ for ( i=0; l[i]; i++ ) {
+ if ( bvmatch( &l[i]->sl_url, &si->si_bindconf.sb_uri )) {
+ isMe = 1;
+ break;
+ }
+ }
+ }
+
+ if ( !isMe ) {
+ init_syncrepl( si );
+ si->si_re = ldap_pvt_runqueue_insert( &slapd_rq,
+ si->si_interval, do_syncrepl, si, "do_syncrepl",
+ c->be->be_suffix[0].bv_val );
+ if ( si->si_re )
+ rc = config_sync_shadow( c ) ? -1 : 0;
+ else
+ rc = -1;
+ }
+ }
}
#ifdef HAVE_TLS
"syncrepl: database already shadowed.\n",
c->log, 0, 0);
return(1);
- } else if ( add_syncrepl( c ) ) {
- return(1);
+ } else {
+ return add_syncrepl( c );
}
- return config_sync_shadow( c );
}