From: Howard Chu Date: Sun, 5 Jun 2011 20:59:19 +0000 (-0700) Subject: ITS#6948 fix ITS#6837 patch X-Git-Tag: OPENLDAP_REL_ENG_2_4_26~94 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=06f6814c57702f5a0536d50c65ed281acaa2b560;p=openldap ITS#6948 fix ITS#6837 patch --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index cec3d679d8..5800f40055 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -4565,6 +4565,7 @@ check_name_index( CfEntryInfo *parent, ConfigType ce_type, Entry *e, return rc; } +/* Insert all superior classes of the given class */ static int count_oc( ObjectClass *oc, ConfigOCs ***copp, int *nocs ) { @@ -4603,10 +4604,15 @@ count_oc( ObjectClass *oc, ConfigOCs ***copp, int *nocs ) return 0; } +/* Find all superior classes of the given objectclasses, + * return list in order of most-subordinate first. + * + * Special / auxiliary / Cft_Misc classes always take precedence. + */ static ConfigOCs ** count_ocs( Attribute *oc_at, int *nocs ) { - int i, j; + int i, j, misc = -1; ConfigOCs **colst = NULL; *nocs = 0; @@ -4628,8 +4634,17 @@ count_ocs( Attribute *oc_at, int *nocs ) ConfigOCs *tmp = colst[i]; colst[i] = colst[j]; colst[j] = tmp; + if (tmp->co_type == Cft_Misc) + misc = j; i++; j--; } + /* Move misc class to front of list */ + if (misc > 0) { + ConfigOCs *tmp = colst[misc]; + for (i=misc; i>0; i--) + colst[i] = colst[i-1]; + colst[0] = tmp; + } return colst; }