diff --git a/CHANGES b/CHANGES index d456ff0a106aebde9570e701b3dd4867619117ed..f6cdc8d7e246cef372febd248f0a24edbfc06069 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ OpenLDAP 2.4.7 Engineering Fixed slapd paged results control handling (ITS#5191) Fixed slapd sasl-host parsing (ITS#5209) Fixed slapd filter normalization (ITS#5212) + Fixed slapd multiple sufix checking (ITS#5186) Fixed slapo-syncprov refresh and persist cookie sending (ITS#5210) Fixed slapo-syncprov ignore invalid cookies (ITS#5211) Documentation diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index ff7957f2377e5ac974fbff73b27327ccb389fde0..bca81d8f50907696a1b813a5ae5181847f12f705 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -87,6 +87,10 @@ bdb_db_init( BackendDB *be, ConfigReply *cr ) be->be_private = bdb; be->be_cf_ocs = be->bd_info->bi_cf_ocs; +#ifndef BDB_MULTIPLE_SUFFIXES + SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_ONE_SUFFIX; +#endif + rc = bdb_monitor_db_init( be ); return rc; @@ -119,19 +123,6 @@ bdb_db_open( BackendDB *be, ConfigReply *cr ) LDAP_XSTRING(bdb_db_open) ": \"%s\"\n", be->be_suffix[0].bv_val, 0, 0 ); -#ifndef BDB_MULTIPLE_SUFFIXES - if ( be->be_suffix[1].bv_val ) { - if (cr) { - snprintf(cr->msg, sizeof(cr->msg), - "database \"%s\": only one suffix allowed.", - be->be_suffix[0].bv_val); - Debug( LDAP_DEBUG_ANY, - LDAP_XSTRING(bdb_db_open) ": %s\n", cr->msg, 0, 0 ); - } - return -1; - } -#endif - /* Check existence of dbenv_home. Any error means trouble */ rc = stat( bdb->bi_dbenv_home, &stat1 ); if( rc != 0 ) { diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index d76ac9b1afad190ccbf24ce3c98583d6c3573db5..a0fa91525988b6a48573f802fe0097b4ee19c653 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -2244,8 +2244,17 @@ config_suffix(ConfigArgs *c) } #endif + if (SLAP_DB_ONE_SUFFIX( c->be ) && c->be->be_suffix ) { + snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> Only one suffix is allowed on this %s backend", + c->argv[0], c->be->bd_info->bi_type ); + Debug(LDAP_DEBUG_ANY, "%s: %s\n", + c->log, c->cr_msg, 0); + return(1); + } + pdn = c->value_dn; ndn = c->value_ndn; + if (SLAP_DBHIDDEN( c->be )) tbe = NULL; else diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index eb387104e632df0c88035b0af03875a6f901dfe7..abafe18bdd85d27afde73cbfb5656c4d51566d24 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1764,6 +1764,7 @@ struct BackendDB { #define SLAP_DBFLAG_NOLASTMOD 0x0001U #define SLAP_DBFLAG_NO_SCHEMA_CHECK 0x0002U #define SLAP_DBFLAG_HIDDEN 0x0004U +#define SLAP_DBFLAG_ONE_SUFFIX 0x0008U #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 */ @@ -1781,6 +1782,7 @@ struct BackendDB { #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_DB_ONE_SUFFIX(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_ONE_SUFFIX) #define SLAP_ISOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_OVERLAY) #define SLAP_ISGLOBALOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLOBAL_OVERLAY) #define SLAP_DBMONITORING(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_MONITORING)