From: Howard Chu Date: Mon, 29 May 2006 06:03:43 +0000 (+0000) Subject: Add "hidden" database config, allow hidden DBs with redundant suffixes X-Git-Tag: OPENLDAP_REL_ENG_2_4_3ALPHA~9^2~204 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d2b27b156e7f07daf7af5b74d9235e7d7f62e86d;p=openldap Add "hidden" database config, allow hidden DBs with redundant suffixes --- diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 978f94649c..514a919a68 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -592,7 +592,7 @@ select_backend( Backend *be, *b2 = NULL; LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) { - if ( be->be_nsuffix == NULL ) { + if ( be->be_nsuffix == NULL || SLAP_DBHIDDEN( be )) { continue; } diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 2f45286450..254f6be7ba 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -162,6 +162,7 @@ enum { CFG_SSTR_IF_MIN, CFG_TTHREADS, CFG_MIRRORMODE, + CFG_HIDDEN, CFG_LAST }; @@ -319,6 +320,9 @@ static ConfigTable config_back_cf_table[] = { #endif "( OLcfgGlAt:17 NAME 'olcGentleHUP' " "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL }, + { "hidden", "on|off", 2, 2, 0, ARG_DB|ARG_ON_OFF|ARG_MAGIC|CFG_HIDDEN, + &config_generic, "( OLcfgDbAt:0.17 NAME 'olcHidden' " + "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL }, { "idletimeout", "timeout", 2, 2, 0, ARG_INT, &global_idletimeout, "( OLcfgGlAt:18 NAME 'olcIdleTimeout' " "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL }, @@ -693,7 +697,8 @@ static ConfigOCs cf_ocs[] = { "DESC 'OpenLDAP Database-specific options' " "SUP olcConfig STRUCTURAL " "MUST olcDatabase " - "MAY ( olcSuffix $ olcSubordinate $ olcAccess $ olcLastMod $ olcLimits $ " + "MAY ( olcHidden $ olcSuffix $ olcSubordinate $ olcAccess $ " + "olcLastMod $ olcLimits $ " "olcMaxDerefDepth $ olcPlugin $ olcReadOnly $ olcReplica $ " "olcReplicaArgsFile $ olcReplicaPidFile $ olcReplicationInterval $ " "olcReplogFile $ olcRequires $ olcRestrict $ olcRootDN $ olcRootPW $ " @@ -806,6 +811,13 @@ config_generic(ConfigArgs *c) { case CFG_DEPTH: c->value_int = c->be->be_max_deref_depth; break; + case CFG_HIDDEN: + if ( SLAP_DBHIDDEN( c->be )) { + c->value_int = 1; + } else { + rc = 1; + } + break; case CFG_OID: { ConfigFile *cf = c->private; if ( !cf ) @@ -1057,6 +1069,10 @@ config_generic(ConfigArgs *c) { logfileName = NULL; break; + case CFG_HIDDEN: + c->be->be_flags &= ~SLAP_DBFLAG_HIDDEN; + break; + case CFG_ACL: if ( c->valx < 0 ) { AccessControl *end; @@ -1401,6 +1417,13 @@ config_generic(ConfigArgs *c) { SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW; break; + case CFG_HIDDEN: + if (c->value_int) + SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_HIDDEN; + else + SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_HIDDEN; + break; + case CFG_SSTR_IF_MAX: if (c->value_int < index_substr_if_minlen) { snprintf( c->msg, sizeof( c->msg ), "<%s> invalid value", c->argv[0] ); @@ -1908,7 +1931,10 @@ config_suffix(ConfigArgs *c) pdn = c->value_dn; ndn = c->value_ndn; - tbe = select_backend(&ndn, 0, 0); + if (SLAP_DBHIDDEN( c->be )) + tbe = NULL; + else + tbe = select_backend(&ndn, 0, 0); if(tbe == c->be) { Debug( LDAP_DEBUG_ANY, "%s: suffix already served by this backend!.\n", c->log, 0, 0); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 95eac5c9a6..b40d913c52 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1698,6 +1698,7 @@ struct slap_backend_db { /* Database flags */ #define SLAP_DBFLAG_NOLASTMOD 0x0001U #define SLAP_DBFLAG_NO_SCHEMA_CHECK 0x0002U +#define SLAP_DBFLAG_HIDDEN 0x0004U #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 */ @@ -1713,6 +1714,7 @@ struct slap_backend_db { #define SLAP_DBFLAGS(be) ((be)->be_flags) #define SLAP_NOLASTMOD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD) #define SLAP_LASTMOD(be) (!SLAP_NOLASTMOD(be)) +#define SLAP_DBHIDDEN(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_HIDDEN) #define SLAP_ISOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_OVERLAY) #define SLAP_ISGLOBALOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLOBAL_OVERLAY) #define SLAP_NO_SCHEMA_CHECK(be) \