From 5c0c1c7902ccd3718c9a3ff252a7e07c5e2466d6 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Thu, 24 Mar 2011 01:37:45 +0000 Subject: [PATCH] ITS#6837 --- CHANGES | 2 ++ servers/slapd/back-ldap/chain.c | 2 +- servers/slapd/back-ldap/init.c | 8 ++++++-- servers/slapd/bconfig.c | 29 ++++++++++++++++++----------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 2e3b1cd57f..8910b4d2f3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ OpenLDAP 2.4 Change Log OpenLDAP 2.4.25 Engineering + Fixed slapd add objectclasses in order (ITS#6837) + Fixed slapd-ldap chain cn=config support (ITS#6837) Build Environment Fixed libldap/lberl/util if/else usage (ITS#6832) Fixed Windows odbc32 detection (ITS#6125) diff --git a/servers/slapd/back-ldap/chain.c b/servers/slapd/back-ldap/chain.c index 759fb53157..f9e3ac157c 100644 --- a/servers/slapd/back-ldap/chain.c +++ b/servers/slapd/back-ldap/chain.c @@ -1269,7 +1269,7 @@ static ConfigOCs chainocs[] = { { "( OLcfgOvOc:3.2 " "NAME 'olcChainDatabase' " "DESC 'Chain remote server configuration' " - "AUXILIARY )", + "SUP olcLDAPConfig )", Cft_Misc, olcDatabaseDummy, chain_ldadd }, { NULL, 0, NULL } }; diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c index bb05dd5d1c..60e60c5fe9 100644 --- a/servers/slapd/back-ldap/init.c +++ b/servers/slapd/back-ldap/init.c @@ -100,6 +100,11 @@ ldap_back_initialize( BackendInfo *bi ) bi->bi_extra = (void *)&ldap_extra; + rc = ldap_back_init_cf( bi ); + if ( rc ) { + return rc; + } + rc = chain_initialize(); if ( rc ) { return rc; @@ -116,8 +121,7 @@ ldap_back_initialize( BackendInfo *bi ) return rc; } #endif - - return ldap_back_init_cf( bi ); + return rc; } int diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index f7154b5124..c657ed0fd9 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -4568,6 +4568,12 @@ count_oc( ObjectClass *oc, ConfigOCs ***copp, int *nocs ) ConfigOCs co, *cop; ObjectClass **sups; + for ( sups = oc->soc_sups; sups && *sups; sups++ ) { + if ( count_oc( *sups, copp, nocs ) ) { + return -1; + } + } + co.co_name = &oc->soc_cname; cop = avl_find( CfOcTree, &co, CfOc_cmp ); if ( cop ) { @@ -4591,27 +4597,18 @@ count_oc( ObjectClass *oc, ConfigOCs ***copp, int *nocs ) } } - for ( sups = oc->soc_sups; sups && *sups; sups++ ) { - if ( count_oc( *sups, copp, nocs ) ) { - return -1; - } - } - return 0; } static ConfigOCs ** count_ocs( Attribute *oc_at, int *nocs ) { - int i; + int i, j; ConfigOCs **colst = NULL; *nocs = 0; - for ( i = 0; !BER_BVISNULL( &oc_at->a_nvals[i] ); i++ ) - /* count attrs */ ; - - for ( ; i--; ) { + for ( i = oc_at->a_numvals; i--; ) { ObjectClass *oc = oc_bvfind( &oc_at->a_nvals[i] ); assert( oc != NULL ); @@ -4621,6 +4618,16 @@ count_ocs( Attribute *oc_at, int *nocs ) } } + /* invert order */ + i = 0; + j = *nocs - 1; + while ( i < j ) { + ConfigOCs *tmp = colst[i]; + colst[i] = colst[j]; + colst[j] = tmp; + i++; j--; + } + return colst; } -- 2.39.5