From: Pierangelo Masarati Date: Fri, 25 Nov 2005 15:16:54 +0000 (+0000) Subject: detect if trying to make back-monitor shadow X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~697 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f3c007229fc83cbab62ddbc3c2707b8fb2f8e171;p=openldap detect if trying to make back-monitor shadow --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 9590130900..fe7be0dc23 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -2548,8 +2548,18 @@ config_updatedn(ConfigArgs *c) { BER_BVZERO( &c->value_dn ); BER_BVZERO( &c->value_ndn ); - SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW); - return(0); + return config_slurp_shadow( c ); +} + +int +config_shadow( ConfigArgs *c, int flag ) +{ + if ( SLAP_MONITOR( c->be ) ) { + Debug( LDAP_DEBUG_ANY, "%s: monitor database cannot be shadow.\n", c->log, 0, 0 ); + return 1; + } + SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | flag); + return 0; } static int diff --git a/servers/slapd/config.h b/servers/slapd/config.h index a1ca2208ec..b5085e2a15 100644 --- a/servers/slapd/config.h +++ b/servers/slapd/config.h @@ -173,6 +173,10 @@ ConfigTable * config_find_keyword(ConfigTable *ct, ConfigArgs *c); Entry * config_build_entry( Operation *op, SlapReply *rs, CfEntryInfo *parent, ConfigArgs *c, struct berval *rdn, ConfigOCs *main, ConfigOCs *extra ); +int config_shadow( ConfigArgs *c, int flag ); +#define config_slurp_shadow(c) config_shadow((c), SLAP_DBFLAG_SLURP_SHADOW) +#define config_sync_shadow(c) config_shadow((c), SLAP_DBFLAG_SYNC_SHADOW) + /* Make sure we don't exceed the bits reserved for userland */ #define config_check_userland(last) \ assert( ( ( (last) - 1 ) & ARGS_USERLAND ) == ( (last) - 1 ) ); diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 5b263a6030..2c539d9bcf 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -3100,8 +3100,8 @@ add_syncrepl( int rc = 0; if ( !( c->be->be_search && c->be->be_add && c->be->be_modify && c->be->be_delete ) ) { - Debug( LDAP_DEBUG_ANY, "database %s does not support operations " - "required for syncrepl\n", c->be->be_type, 0, 0 ); + Debug( LDAP_DEBUG_ANY, "%s: database %s does not support operations " + "required for syncrepl\n", c->log, c->be->be_type, 0 ); return 1; } si = (syncinfo_t *) ch_calloc( 1, sizeof( syncinfo_t ) ); @@ -3329,6 +3329,5 @@ syncrepl_config( ConfigArgs *c ) } else if ( add_syncrepl( c ) ) { return(1); } - SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SYNC_SHADOW); - return(0); + return config_sync_shadow( c ); }