From: Kurt Zeilenga Date: Tue, 16 Jan 2001 06:49:49 +0000 (+0000) Subject: ITS#963: Multimaster patch X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1593 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2a7036e5b0278568f59a5d88b9542fed0d37cf3f;p=openldap ITS#963: Multimaster patch --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index bb549fba39..f20a62c4f0 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -227,13 +227,10 @@ 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 ) + int repl_user = (be->be_update_ndn != NULL && + strcmp( be->be_update_ndn, op->o_ndn ) == 0); +#ifndef SLAPD_MULTIMASTER + if ( be->be_update_ndn == NULL || repl_user ) #endif { int update = be->be_update_ndn != NULL; @@ -245,10 +242,8 @@ do_add( Connection *conn, Operation *op ) goto done; } -#ifndef SLAPD_MULTIMASTER if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED && - global_lastmod == ON)) && !update ) -#endif + global_lastmod == ON)) && !repl_user ) { Modifications **modstail; for( modstail = &mods; @@ -275,8 +270,7 @@ do_add( Connection *conn, Operation *op ) if ( (*be->be_add)( be, conn, op, e ) == 0 ) { #ifdef SLAPD_MULTIMASTER - if (be->be_update_ndn == NULL || - strcmp( be->be_update_ndn, op->o_ndn )) + if ( !repl_user ) #endif { replog( be, op, e->e_dn, e ); diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index fe11260bfd..6925de3ef5 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -268,12 +268,13 @@ do_modify( */ if ( be->be_modify ) { /* do the update here */ + int repl_user = (be->be_update_ndn != NULL && + strcmp( be->be_update_ndn, op->o_ndn ) == 0); #ifndef SLAPD_MULTIMASTER - /* we don't have to check for replicator dn - * because we accept each modify request + /* Multimaster slapd does not have to check for replicator dn + * because it accepts each modify request */ - if ( be->be_update_ndn == NULL || - strcmp( be->be_update_ndn, op->o_ndn ) == 0 ) + if ( be->be_update_ndn == NULL || repl_user ) #endif { int update = be->be_update_ndn != NULL; @@ -287,7 +288,7 @@ do_modify( } if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED && - global_lastmod == ON)) && !update ) + global_lastmod == ON)) && !repl_user ) { Modifications **modstail; for( modstail = &mods; @@ -308,8 +309,7 @@ do_modify( if ( (*be->be_modify)( be, conn, op, dn, ndn, mods ) == 0 #ifdef SLAPD_MULTIMASTER - && ( be->be_update_ndn == NULL || - strcmp( be->be_update_ndn, op->o_ndn ) != 0 ) + && !repl_user #endif ) { /* but we log only the ones not from a replicator user */