From: Kurt Zeilenga Date: Mon, 5 Apr 2004 21:54:40 +0000 (+0000) Subject: Add SLAP_SHADOW(be): true if be is a shadow database (via any mech) X-Git-Tag: OPENLDAP_REL_ENG_2_2_BP~139 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=843400deb72291593dde0dee32d000e1aab09593;p=openldap Add SLAP_SHADOW(be): true if be is a shadow database (via any mech) --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index e1b65a1404..6bc90dcf46 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -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 ) { diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index bdc3f83a02..0edeca7d2b 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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 */