From: Howard Chu Date: Sat, 19 Feb 2011 02:48:47 +0000 (+0000) Subject: ITS#6837 make sure objectclasses are processed in correct X-Git-Tag: MIGRATION_CVS2GIT~65 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6005349cbcb5083979fd2ea1b147856a32b4c83a;p=openldap ITS#6837 make sure objectclasses are processed in correct inheritance order --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 0ab97d98b3..1710f8e0d1 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -4760,6 +4760,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 ) { @@ -4783,27 +4789,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 ); @@ -4813,6 +4810,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; }