]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/repl.c
Added bdb_attribute and bdb_group ACL support routines
[openldap] / servers / slapd / repl.c
index e5eddcfb8b05d437f77c5588572800578acfa5c8..dff5b5c82bc7b741aebb3f0f16d6ba4f0b5e9e65 100644 (file)
@@ -18,6 +18,7 @@
 #endif
 
 #include "slap.h"
+#include "ldif.h"
 
 int
 add_replica_info(
@@ -45,6 +46,30 @@ add_replica_info(
        return( i );
 }
 
+int
+add_replica_suffix(
+    Backend     *be,
+    int                nr,
+    const char  *suffix
+)
+{
+       char    *nsuffix = ch_strdup( suffix );
+       int     rc = 0;
+
+       if ( dn_normalize( nsuffix ) != NULL ) {
+               if ( select_backend( nsuffix, 0 ) == be ) {
+                       charray_add( &be->be_replica[nr]->ri_nsuffix, nsuffix );
+               } else {
+                       rc = 1;
+               }
+       } else {
+               rc = 2;
+       }
+       free( nsuffix );
+
+       return( rc );
+}
+
 void
 replog(
     Backend    *be,
@@ -58,7 +83,11 @@ replog(
        struct replog_moddn *moddn;
        char *tmp;
        FILE    *fp, *lfp;
-       int     len, i, count = 0;
+       int     len, i;
+/* undef NO_LOG_WHEN_NO_REPLICAS */
+#ifdef NO_LOG_WHEN_NO_REPLICAS
+       int     count = 0;
+#endif
 
        if ( be->be_replogfile == NULL && replogfile == NULL ) {
                return;
@@ -100,10 +129,13 @@ replog(
                }
 
                fprintf( fp, "replica: %s\n", be->be_replica[i]->ri_host );
+#ifdef NO_LOG_WHEN_NO_REPLICAS
                ++count;
+#endif
        }
 
        ch_free( tmp );
+#ifdef NO_LOG_WHEN_NO_REPLICAS
        if ( count == 0 ) {
                /* if no replicas matched, drop the log 
                 * (should we log it anyway?) */
@@ -112,6 +144,7 @@ replog(
 
                return;
        }
+#endif
 
        fprintf( fp, "time: %ld\n", (long) slap_get_time() );
        fprintf( fp, "dn: %s\n", dn );
@@ -127,7 +160,7 @@ replog(
                ml = change;
                for ( ; ml != NULL; ml = ml->sml_next ) {
                        char *type;
-                       type = ml->sml_desc->ad_cname->bv_val;
+                       type = ml->sml_desc->ad_cname.bv_val;
                        switch ( ml->sml_op ) {
                        case LDAP_MOD_ADD:
                                fprintf( fp, "add: %s\n", type );