if ( op->o_bd->be_add ) {
/* do the update here */
int repl_user = be_isupdate( op );
-#ifndef SLAPD_MULTIMASTER
- if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif /* ! SLAPD_MULTIMASTER */
+ if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user )
{
int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
send_ldap_result( op, rs );
goto done;
}
- }
-#ifdef SLAPD_MULTIMASTER
- if ( !repl_user )
-#endif /* SLAPD_MULTIMASTER */
- {
cb.sc_next = op->o_callback;
op->o_callback = &cb;
}
+
rc = op->o_bd->be_add( op, rs );
if ( rc == LDAP_SUCCESS ) {
/* NOTE: be_entry_release_w() is
op->o_private = op->o_bd;
}
-#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif /* SLAPD_MULTIMASTER */
}
} else {
Debug( LDAP_DEBUG_ARGS, "do_add: no backend support\n", 0, 0, 0 );
CFG_SSTR_IF_MAX,
CFG_SSTR_IF_MIN,
CFG_TTHREADS,
+ CFG_MULTIMASTER,
CFG_LAST
};
#endif
"( OLcfgGlAt:31 NAME 'olcModulePath' "
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
+ { "multimaster", "on|off", 2, 2, 0, ARG_DB|ARG_ON_OFF|ARG_MAGIC|CFG_MULTIMASTER,
+ &config_generic, "( OLcfgDbAt:0.16 NAME 'olcMultiMaster' "
+ "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
{ "objectclass", "objectclass", 2, 0, 0, ARG_PAREN|ARG_MAGIC|CFG_OC|ARG_NO_DELETE|ARG_NO_INSERT,
&config_generic, "( OLcfgGlAt:32 NAME 'olcObjectClasses' "
"DESC 'OpenLDAP object classes' "
"olcReplicaArgsFile $ olcReplicaPidFile $ olcReplicationInterval $ "
"olcReplogFile $ olcRequires $ olcRestrict $ olcRootDN $ olcRootPW $ "
"olcSchemaDN $ olcSecurity $ olcSizeLimit $ olcSyncrepl $ "
- "olcTimeLimit $ olcUpdateDN $ olcUpdateRef ) )",
+ "olcTimeLimit $ olcUpdateDN $ olcUpdateRef $ olcMultiMaster ) )",
Cft_Database, NULL, cfAddDatabase },
{ "( OLcfgGlOc:5 "
"NAME 'olcOverlayConfig' "
case CFG_LASTMOD:
c->value_int = (SLAP_NOLASTMOD(c->be) == 0);
break;
+ case CFG_MULTIMASTER:
+ c->value_int = (SLAP_SINGLE_SHADOW(c->be) == 0);
+ break;
case CFG_SSTR_IF_MAX:
c->value_int = index_substr_if_maxlen;
break;
case CFG_AZPOLICY:
case CFG_DEPTH:
case CFG_LASTMOD:
+ case CFG_MULTIMASTER:
case CFG_SASLSECP:
case CFG_SSTR_IF_MAX:
case CFG_SSTR_IF_MIN:
SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_NOLASTMOD;
break;
+ case CFG_MULTIMASTER:
+ if(!SLAP_SHADOW(c->be)) {
+ snprintf( c->msg, sizeof( c->msg ), "<%s> database is not a shadow",
+ c->argv[0] );
+ Debug(LDAP_DEBUG_ANY, "%s: %s\n",
+ c->log, c->msg, 0 );
+ return(1);
+ }
+ if(c->value_int)
+ SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_SINGLE_SHADOW;
+ else
+ SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW;
+ break;
+
case CFG_SSTR_IF_MAX:
if (c->value_int < index_substr_if_minlen) {
snprintf( c->msg, sizeof( c->msg ), "<%s> invalid value", c->argv[0] );
return 1;
}
- SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | flag);
+ SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SINGLE_SHADOW | flag);
return 0;
}
if ( op->o_bd->be_delete ) {
/* do the update here */
int repl_user = be_isupdate( op );
-#ifndef SLAPD_MULTIMASTER
- if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif /* ! SLAPD_MULTIMASTER */
+ if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user )
{
struct berval org_req_dn = BER_BVNULL;
struct berval org_req_ndn = BER_BVNULL;
op->o_bd = op_be;
-#ifdef SLAPD_MULTIMASTER
if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
-#endif /* SLAPD_MULTIMASTER */
{
cb.sc_next = op->o_callback;
op->o_callback = &cb;
op->o_req_ndn = org_req_ndn;
op->o_delete_glue_parent = 0;
-#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif /* ! SLAPD_MULTIMASTER */
}
} else {
/* Multimaster slapd does not have to check for replicator dn
* because it accepts each modify request
*/
-#ifndef SLAPD_MULTIMASTER
- if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif /* ! SLAPD_MULTIMASTER */
+ if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user )
{
int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
}
}
-#ifdef SLAPD_MULTIMASTER
if ( !repl_user )
-#endif /* SLAPD_MULTIMASTER */
{
/* but multimaster slapd logs only the ones
* not from a replicator user */
}
op->o_bd->be_modify( op, rs );
-#ifndef SLAPD_MULTIMASTER
/* send a referral */
} else {
BerVarray defref = op->o_bd->be_update_refs
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif /* ! SLAPD_MULTIMASTER */
}
} else {
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
if ( op->o_bd->be_modrdn ) {
/* do the update here */
int repl_user = be_isupdate( op );
-#ifndef SLAPD_MULTIMASTER
- if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif /* ! SLAPD_MULTIMASTER */
+ if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user )
{
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
op->o_bd = op_be;
-#ifdef SLAPD_MULTIMASTER
if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
-#endif /* SLAPD_MULTIMASTER */
{
cb.sc_next = op->o_callback;
op->o_callback = &cb;
op->o_delete_glue_parent = 0;
}
-#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif /* ! SLAPD_MULTIMASTER */
}
} else {
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
goto error_return;
}
-#ifndef SLAPD_MULTIMASTER
/* This does not apply to multi-master case */
- if(!( !SLAP_SHADOW( op->o_bd ) || be_isupdate( op ))) {
+ if(!( !SLAP_SINGLE_SHADOW( op->o_bd ) || be_isupdate( op ))) {
/* we SHOULD return a referral in this case */
BerVarray defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
rc = LDAP_UNWILLING_TO_PERFORM;
goto error_return;
}
-#endif /* !SLAPD_MULTIMASTER */
/* generate a new password if none was provided */
if ( qpw->rs_new.bv_len == 0 ) {
#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_SHADOW 0x8000U /* a shadow */
+#define SLAP_DBFLAG_SINGLE_SHADOW 0x4000U /* a single-master shadow */
#define SLAP_DBFLAG_SYNC_SHADOW 0x1000U /* a sync shadow */
#define SLAP_DBFLAG_SLURP_SHADOW 0x2000U /* a slurp shadow */
slap_mask_t be_flags;
#define SLAP_SHADOW(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SHADOW)
#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_MULTIMASTER(be) (!SLAP_SINGLE_SHADOW(be))
slap_mask_t be_restrictops; /* restriction operations */
#define SLAP_RESTRICT_OP_ADD 0x0001U