]> git.sur5r.net Git - openldap/commitdiff
Add SLAP_SHADOW(be): true if be is a shadow database (via any mech)
authorKurt Zeilenga <kurt@openldap.org>
Mon, 5 Apr 2004 21:54:40 +0000 (21:54 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 5 Apr 2004 21:54:40 +0000 (21:54 +0000)
servers/slapd/config.c
servers/slapd/slap.h

index e1b65a14049b6b18d8acfa8e33334055ecddfd6d..6bc90dcf46ee4a2ec8bcbd0880f9c556add80f84 100644 (file)
@@ -1801,12 +1801,25 @@ read_config( const char *fname, int depth )
                                            "a database definition.\n", fname, lineno, 0);
 #endif
                                return 1;
-                       } else {
-                               if ( add_syncrepl( be, cargv, cargc )) {
-                                       return 1;
-                               }
+
+                       } else if ( SLAP_SHADOW( be )) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG( CONFIG, INFO, 
+                                       "%s: line %d: syncrepl: database already shadowed.\n",
+                                       fname, lineno, 0);
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: syncrepl: database already shadowed.\n",
+                                       fname, lineno, 0);
+#endif
+                               return 1;
+
+                       } else if ( add_syncrepl( be, cargv, cargc )) {
+                               return 1;
                        }
 
+                       SLAP_DBFLAGS(be) |= SLAP_DBFLAG_SHADOW;
+
                /* list of replicas of the data in this backend (master only) */
                } else if ( strcasecmp( cargv[0], "replica" ) == 0 ) {
                        if ( cargc < 2 ) {
@@ -2010,6 +2023,18 @@ read_config( const char *fname, int depth )
 #endif
                                return 1;
 
+                       } else if ( SLAP_SHADOW(be) ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG( CONFIG, INFO, 
+                                       "%s: line %d: updatedn: database already shadowed.\n",
+                                       fname, lineno, 0);
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: updatedn: database already shadowed.\n",
+                                       fname, lineno, 0);
+#endif
+                               return 1;
+
                        } else {
                                struct berval dn;
 
@@ -2031,7 +2056,9 @@ read_config( const char *fname, int depth )
 #endif
                                        return 1;
                                }
+
                        }
+                       SLAP_DBFLAGS(be) |= SLAP_DBFLAG_SHADOW;
 
                } else if ( strcasecmp( cargv[0], "updateref" ) == 0 ) {
                        if ( cargc < 2 ) {
@@ -2087,8 +2114,9 @@ read_config( const char *fname, int depth )
 
                        vals[0].bv_val = cargv[1];
                        vals[0].bv_len = strlen( vals[0].bv_val );
-                       if( value_add( &be->be_update_refs, vals ) )
+                       if( value_add( &be->be_update_refs, vals ) ) {
                                return LDAP_OTHER;
+                       }
 
                /* replication log file to which changes are appended */
                } else if ( strcasecmp( cargv[0], "replogfile" ) == 0 ) {
index bdc3f83a023b725f346fdc0787eb9d85d562a6ac..0edeca7d2bd111a894cc5411511ff1c15fb50656 100644 (file)
@@ -1395,6 +1395,9 @@ typedef struct syncinfo_s {
 struct slap_backend_db {
        BackendInfo     *bd_info;       /* pointer to shared backend info */
 
+       /* fields in this structure (and routines acting on this structure)
+          should be renamed from be_ to bd_ */
+
        /* BackendInfo accessors */
 #define                be_config       bd_info->bi_db_config
 #define                be_type         bd_info->bi_type
@@ -1451,6 +1454,7 @@ struct slap_backend_db {
 #define        SLAP_DBFLAG_GLUE_INSTANCE       0x0010U /* a glue backend */
 #define        SLAP_DBFLAG_GLUE_SUBORDINATE 0x0020U    /* child of a glue hierarchy */
 #define        SLAP_DBFLAG_GLUE_LINKED         0x0040U /* child is connected to parent */
+#define SLAP_DBFLAG_SHADOW                     0x8000U /* a shadow */
        slap_mask_t     be_flags;
 #define SLAP_DBFLAGS(be)                       ((be)->be_flags)
 #define SLAP_NOLASTMOD(be)                     (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD)
@@ -1463,6 +1467,7 @@ struct slap_backend_db {
        (SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_SUBORDINATE)
 #define        SLAP_GLUE_LINKED(be)            \
        (SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_LINKED)
+#define SLAP_SHADOW(be)                                (SLAP_DBFLAGS(be) & SLAP_DBFLAG_SHADOW)
 
        slap_mask_t     be_restrictops;         /* restriction operations */
 #define SLAP_RESTRICT_OP_ADD           0x0001U
@@ -1508,7 +1513,6 @@ struct slap_backend_db {
        /* Required Security Strength Factor */
        slap_ssf_set_t be_ssf_set;
 
-       /* these should be renamed from be_ to bd_ */
        BerVarray       be_suffix;      /* the DN suffixes of data in this backend */
        BerVarray       be_nsuffix;     /* the normalized DN suffixes in this backend */
        struct berval be_schemadn;      /* per-backend subschema subentry DN */