Commit e6347bc1 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Quanah Gibson-Mount
Browse files

ITS#9729 Allow multiprovider to be set before syncrepl stanzas

parent 1a92f417
......@@ -1395,7 +1395,7 @@ config_generic(ConfigArgs *c) {
c->value_int = (SLAP_SYNC_SUBENTRY(c->be) != 0);
break;
case CFG_MULTIPROVIDER:
if ( SLAP_SHADOW(c->be))
if ( sid_list )
c->value_int = (SLAP_MULTIPROVIDER(c->be) != 0);
else
rc = 1;
......@@ -1565,8 +1565,6 @@ config_generic(ConfigArgs *c) {
case CFG_MULTIPROVIDER:
SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_MULTI_SHADOW;
if(SLAP_SHADOW(c->be))
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW;
break;
#if defined(HAVE_CYRUS_SASL) && defined(SLAP_AUXPROP_DONTUSECOPY)
......@@ -2412,18 +2410,18 @@ sortval_reject:
break;
case CFG_MULTIPROVIDER:
if(c->value_int && !SLAP_SHADOW(c->be)) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> database is not a shadow",
/* Matching on sid_list rather than serverID to keep tools in check */
if ( c->value_int && !sid_list ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"serverID is not configured, do that first",
c->argv[0] );
Debug(LDAP_DEBUG_ANY, "%s: %s\n",
c->log, c->cr_msg );
return(1);
}
if(c->value_int) {
SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_SINGLE_SHADOW;
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_MULTI_SHADOW;
} else {
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW;
SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_MULTI_SHADOW;
}
break;
......@@ -3899,7 +3897,7 @@ config_updatedn(ConfigArgs *c) {
} else if ( c->op == LDAP_MOD_DELETE ) {
ch_free( c->be->be_update_ndn.bv_val );
BER_BVZERO( &c->be->be_update_ndn );
SLAP_DBFLAGS(c->be) ^= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW);
SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_SLURP_SHADOW;
return 0;
}
if(SLAP_SHADOW(c->be)) {
......@@ -3937,18 +3935,14 @@ config_shadow( ConfigArgs *c, slap_mask_t flag )
return 1;
}
if ( SLAP_SHADOW(c->be) ) {
/* if already shadow, only check consistency */
if ( ( SLAP_DBFLAGS(c->be) & flag ) != flag ) {
Debug( LDAP_DEBUG_ANY, "%s: inconsistent shadow flag 0x%lx.\n",
c->log, flag );
return 1;
}
/* if already shadow, only check consistency */
if ( ((SLAP_DBFLAGS(c->be) & SLAP_DBFLAG_SINGLE_SHADOW_MASK) | flag) != flag ) {
Debug( LDAP_DEBUG_ANY, "%s: inconsistent shadow flag 0x%lx != 0x%lx.\n",
c->log, flag, ( SLAP_DBFLAGS(c->be) & SLAP_DBFLAG_SINGLE_SHADOW_MASK ) );
return 1;
} else {
SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | flag);
if ( !SLAP_MULTIPROVIDER( c->be ))
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW;
SLAP_DBFLAGS(c->be) |= flag;
}
return 0;
......@@ -3976,7 +3970,7 @@ config_updateref(ConfigArgs *c) {
}
return 0;
}
if(!SLAP_SHADOW(c->be) && !c->be->be_syncinfo) {
if( !SLAP_SINGLE_SHADOW(c->be) && !c->be->be_syncinfo ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> must appear after syncrepl or updatedn",
c->argv[0] );
Debug(LDAP_DEBUG_ANY, "%s: %s\n",
......
......@@ -1871,15 +1871,16 @@ struct BackendDB {
#define SLAP_DBFLAG_GLOBAL_OVERLAY 0x0200U /* this db struct is a global overlay */
#define SLAP_DBFLAG_DYNAMIC 0x0400U /* this db allows dynamicObjects */
#define SLAP_DBFLAG_MONITORING 0x0800U /* custom monitoring enabled */
#define SLAP_DBFLAG_SHADOW 0x8000U /* a shadow */
#define SLAP_DBFLAG_SINGLE_SHADOW 0x4000U /* a single-provider shadow */
#define SLAP_DBFLAG_SYNC_SHADOW 0x1000U /* a sync shadow */
#define SLAP_DBFLAG_SLURP_SHADOW 0x2000U /* a slurp shadow */
#define SLAP_DBFLAG_SHADOW_MASK (SLAP_DBFLAG_SHADOW|SLAP_DBFLAG_SINGLE_SHADOW|SLAP_DBFLAG_SYNC_SHADOW|SLAP_DBFLAG_SLURP_SHADOW)
#define SLAP_DBFLAG_SLURP_SHADOW 0x2000U /* a push replication target */
#define SLAP_DBFLAG_SINGLE_SHADOW_MASK (SLAP_DBFLAG_SYNC_SHADOW|SLAP_DBFLAG_SLURP_SHADOW) /* a single-provider shadow */
#define SLAP_DBFLAG_MULTI_SHADOW 0x4000U /* uses multi-provider */
#define SLAP_DBFLAG_SHADOW_MASK (SLAP_DBFLAG_SINGLE_SHADOW_MASK|SLAP_DBFLAG_MULTI_SHADOW)
/* 0x8000U no longer used */
#define SLAP_DBFLAG_CLEAN 0x10000U /* was cleanly shutdown */
#define SLAP_DBFLAG_ACL_ADD 0x20000U /* check attr ACLs on adds */
#define SLAP_DBFLAG_SYNC_SUBENTRY 0x40000U /* use subentry for context */
#define SLAP_DBFLAG_MULTI_SHADOW 0x80000U /* uses multi-provider */
/* 0x80000U no longer used */
#define SLAP_DBFLAG_DISABLED 0x100000U
#define SLAP_DBFLAG_LASTBIND 0x200000U
#define SLAP_DBFLAG_OPEN 0x400000U /* db is currently open */
......@@ -1904,11 +1905,13 @@ struct BackendDB {
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_LINKED)
#define SLAP_GLUE_ADVERTISE(be) \
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_ADVERTISE)
#define SLAP_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SHADOW)
#define SLAP_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SHADOW_MASK)
#define SLAP_SYNC_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SYNC_SHADOW)
#define SLAP_SLURP_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SLURP_SHADOW)
#define SLAP_SINGLE_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SINGLE_SHADOW)
#define SLAP_MULTIPROVIDER(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_MULTI_SHADOW)
#define SLAP_SINGLE_SHADOW(be) \
( (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SINGLE_SHADOW_MASK) && \
!SLAP_MULTIPROVIDER(be) )
#define SLAP_DBCLEAN(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_CLEAN)
#define SLAP_DBOPEN(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_OPEN)
#define SLAP_DBACL_ADD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_ACL_ADD)
......
......@@ -7198,7 +7198,7 @@ add_syncrepl(
rc = -1;
}
} else {
/* multiprovider still needs to see this flag in tool mode */
/* tools might still want to see this flag (updateref, ...) */
rc = config_sync_shadow( c ) ? -1 : 0;
}
ldap_free_urldesc( lud );
......@@ -7508,7 +7508,7 @@ syncrepl_config( ConfigArgs *c )
}
}
if ( !c->be->be_syncinfo ) {
SLAP_DBFLAGS( c->be ) &= ~SLAP_DBFLAG_SHADOW_MASK;
SLAP_DBFLAGS( c->be ) &= ~SLAP_DBFLAG_SYNC_SHADOW;
}
return 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment