]> git.sur5r.net Git - openldap/commitdiff
Add "hidden" database config, allow hidden DBs with redundant suffixes
authorHoward Chu <hyc@openldap.org>
Mon, 29 May 2006 06:03:43 +0000 (06:03 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 29 May 2006 06:03:43 +0000 (06:03 +0000)
servers/slapd/backend.c
servers/slapd/bconfig.c
servers/slapd/slap.h

index 978f94649c77ca0df27b387b06f25d63adc0e2fc..514a919a68d06f316a38a4c9dd9c85e3d3c02a74 100644 (file)
@@ -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;
                }
 
index 2f4528645074d32f1169648bda14ca298587098f..254f6be7ba6e098b08506fb9379e3b74f9d7dcc7 100644 (file)
@@ -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);
index 95eac5c9a657f6adf87e4e18b7d9f145ddd5319b..b40d913c521f04b1e99ad44fe6f8bda6c0653d89 100644 (file)
@@ -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)       \