mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-09 02:52:04 +08:00
Add multimaster replication support (ITS#170) based upon
updated patch submitted Philipp Klaus <ldapml@internet.access.ch> Can be enabled using --enable-multimaster. TODO: Replication test likely should be adjusted to test multimaster environment.
This commit is contained in:
parent
ecbb75f930
commit
ecb9c3b3fb
@ -99,6 +99,7 @@ OL_ARG_ENABLE(slapd,[ --enable-slapd enable building slapd], yes)dnl
|
||||
OL_ARG_ENABLE(cleartext,[ --enable-cleartext enable cleartext passwords], yes)dnl
|
||||
OL_ARG_ENABLE(crypt,[ --enable-crypt enable crypt(3) passwords], auto)dnl
|
||||
OL_ARG_ENABLE(modules,[ --enable-modules enable dynamic module support], no)dnl
|
||||
OL_ARG_ENABLE(multimaster,[ --enable-multimaster enable multimaster replication], no)dnl
|
||||
OL_ARG_ENABLE(phonetic,[ --enable-phonetic enable phonetic/soundex], no)dnl
|
||||
OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups], auto)dnl
|
||||
OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl
|
||||
@ -178,6 +179,9 @@ if test $ol_enable_slapd = no ; then
|
||||
if test $ol_enable_modules = yes ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --enable-modules argument])
|
||||
fi
|
||||
if test $ol_enable_multimaster = yes ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --enable-multimaster argument])
|
||||
fi
|
||||
if test $ol_enable_wrappers = yes ; then
|
||||
AC_MSG_WARN([slapd disabled, ignoring --enable-wrappers argument])
|
||||
fi
|
||||
@ -228,6 +232,7 @@ if test $ol_enable_slapd = no ; then
|
||||
ol_enable_tcl=no
|
||||
|
||||
ol_enable_modules=no
|
||||
ol_enable_multimaster=no
|
||||
ol_enable_phonetic=no
|
||||
ol_enable_rlookups=no
|
||||
ol_enable_wrappers=no
|
||||
@ -1903,6 +1908,9 @@ fi
|
||||
if test "$ol_enable_cleartext" != no ; then
|
||||
AC_DEFINE(SLAPD_CLEARTEXT,1,[define to support cleartext passwords])
|
||||
fi
|
||||
if test "$ol_enable_multimaster" != no ; then
|
||||
AC_DEFINE(SLAPD_MULTIMASTER,1,[define to support multimaster replication])
|
||||
fi
|
||||
if test "$ol_enable_phonetic" != no ; then
|
||||
AC_DEFINE(SLAPD_PHONETIC,1,[define to support phonetic])
|
||||
fi
|
||||
|
@ -771,6 +771,9 @@
|
||||
/* define to support cleartext passwords */
|
||||
#undef SLAPD_CLEARTEXT
|
||||
|
||||
/* define to support multimaster replication */
|
||||
#undef SLAPD_MULTIMASTER
|
||||
|
||||
/* define to support phonetic */
|
||||
#undef SLAPD_PHONETIC
|
||||
|
||||
|
@ -151,11 +151,19 @@ do_add( Connection *conn, Operation *op )
|
||||
*/
|
||||
if ( be->be_add ) {
|
||||
/* do the update here */
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && (be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn )) )
|
||||
#else
|
||||
if ( be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ) == 0 )
|
||||
#endif
|
||||
{
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && be->be_update_ndn == NULL )
|
||||
#endif
|
||||
{
|
||||
rc = add_created_attrs( op, e );
|
||||
|
||||
@ -169,14 +177,22 @@ do_add( Connection *conn, Operation *op )
|
||||
}
|
||||
|
||||
if ( (*be->be_add)( be, conn, op, e ) == 0 ) {
|
||||
replog( be, op, e->e_dn, e );
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
if (be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ))
|
||||
#endif
|
||||
{
|
||||
replog( be, op, e->e_dn, e );
|
||||
}
|
||||
be_entry_release_w( be, e );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
} else {
|
||||
entry_free( e );
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
be->be_update_refs ? be->be_update_refs : default_referral, NULL );
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
Debug( LDAP_DEBUG_ARGS, " do_add: HHH\n", 0, 0, 0 );
|
||||
|
@ -92,16 +92,27 @@ do_delete(
|
||||
*/
|
||||
if ( be->be_delete ) {
|
||||
/* do the update here */
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ) == 0 )
|
||||
#endif
|
||||
{
|
||||
if ( (*be->be_delete)( be, conn, op, ndn ) == 0 ) {
|
||||
replog( be, op, ndn, NULL );
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
if (be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ))
|
||||
#endif
|
||||
{
|
||||
replog( be, op, ndn, NULL );
|
||||
}
|
||||
}
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
be->be_update_refs ? be->be_update_refs : default_referral, NULL );
|
||||
#endif
|
||||
}
|
||||
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
|
||||
NULL, "Function not implemented", NULL, NULL );
|
||||
|
@ -185,8 +185,13 @@ do_modify(
|
||||
*/
|
||||
if ( be->be_modify ) {
|
||||
/* do the update here */
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
/* we don't have to check for replicator dn
|
||||
* because we accept each modify request
|
||||
*/
|
||||
if ( be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ) == 0 )
|
||||
#endif
|
||||
{
|
||||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && be->be_update_ndn == NULL )
|
||||
@ -203,14 +208,23 @@ do_modify(
|
||||
}
|
||||
}
|
||||
|
||||
if ( (*be->be_modify)( be, conn, op, ndn, modlist ) == 0 ) {
|
||||
if ( (*be->be_modify)( be, conn, op, ndn, modlist ) == 0
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
&& ( be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ) != 0 )
|
||||
#endif
|
||||
) {
|
||||
/* but we log only the ones not from a replicator user */
|
||||
replog( be, op, ndn, modlist );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
/* send a referral */
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
be->be_update_refs ? be->be_update_refs : default_referral, NULL );
|
||||
be->be_update_refs ? be->be_update_refs : default_referral,
|
||||
NULL );
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
|
||||
|
@ -223,21 +223,30 @@ do_modrdn(
|
||||
*/
|
||||
if ( be->be_modrdn ) {
|
||||
/* do the update here */
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ) == 0 )
|
||||
#endif
|
||||
{
|
||||
if ( (*be->be_modrdn)( be, conn, op, ndn, newrdn,
|
||||
deloldrdn, newSuperior ) == 0 )
|
||||
{
|
||||
deloldrdn, newSuperior ) == 0
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
&& ( be->be_update_ndn == NULL ||
|
||||
strcmp( be->be_update_ndn, op->o_ndn ) )
|
||||
#endif
|
||||
) {
|
||||
struct replog_moddn moddn;
|
||||
moddn.newrdn = newrdn;
|
||||
moddn.newrdn = newrdn;
|
||||
moddn.deloldrdn = deloldrdn;
|
||||
moddn.newsup = newSuperior;
|
||||
|
||||
replog( be, op, ndn, &moddn );
|
||||
}
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
be->be_update_refs ? be->be_update_refs : default_referral, NULL );
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
|
||||
|
Loading…
Reference in New Issue
Block a user