]> git.sur5r.net Git - openldap/commitdiff
import multi-master patch from devel
authorKurt Zeilenga <kurt@openldap.org>
Wed, 17 Jan 2001 02:44:12 +0000 (02:44 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 17 Jan 2001 02:44:12 +0000 (02:44 +0000)
servers/slapd/add.c
servers/slapd/modify.c

index 753603c8db1e9ec26e4069a3c05ca49c03b3f11b..67f1a02633f98145f4e0d364df9e03f3a997a24d 100644 (file)
@@ -187,13 +187,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;
@@ -205,10 +202,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;
@@ -235,8 +230,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 );
index 99e31fe033bec6a696287ce17a0da2fbde2dbb05..18a3067c9105dd9985354c5a489bb241a6085346 100644 (file)
@@ -204,12 +204,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;
@@ -223,7 +224,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;
@@ -244,8 +245,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 */