Commit d2b27b15 authored by Howard Chu's avatar Howard Chu
Browse files

Add "hidden" database config, allow hidden DBs with redundant suffixes

parent 09c26b03
......@@ -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;
}
......
......@@ -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);
......
......@@ -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) \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment