X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fschema_prep.c;h=7c6b0defa30fe3e8a076151e806c53dbe8a4ed81;hb=5747896ba081ff998fd97863de26d2f4af59bbd2;hp=85717e2c04a70fd006ed89ea1381f4c85dcd6e44;hpb=423a93019f9ecf3ccf0630398dc220af86ae57f9;p=openldap diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 85717e2c04..7c6b0defa3 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -250,31 +250,24 @@ static int objectSubClassIndexer( { int rc, noc, i; BerVarray ocvalues; + ObjectClass **socs; for( noc=0; values[noc].bv_val != NULL; noc++ ) { /* just count em */; } /* over allocate */ - ocvalues = slap_sl_malloc( sizeof( struct berval ) * (noc+16), ctx ); + socs = slap_sl_malloc( (noc+16) * sizeof( ObjectClass * ), ctx ); - /* copy listed values (and termination) */ + /* initialize */ for( i=0; isoc_cname; - } else { - ocvalues[i] = values[i]; - } + socs[i] = oc_bvfind( &values[i] ); } - ocvalues[i].bv_val = NULL; - ocvalues[i].bv_len = 0; - /* expand values */ for( i=0; isoc_sups == NULL ) continue; for( j=0; oc->soc_sups[j] != NULL; j++ ) { @@ -283,35 +276,37 @@ static int objectSubClassIndexer( int k; for( k=0; ksoc_cname ) ) { + if( sup == socs[k] ) { found++; break; } } if( !found ) { - ocvalues = slap_sl_realloc( ocvalues, - sizeof( struct berval ) * (noc+2), ctx ); + socs = slap_sl_realloc( socs, + sizeof( ObjectClass * ) * (noc+2), ctx ); assert( k == noc ); - - ocvalues[noc] = sup->soc_cname; - - assert( ocvalues[noc].bv_val != NULL ); - assert( ocvalues[noc].bv_len != 0 ); - - noc++; - - ocvalues[noc].bv_len = 0; - ocvalues[noc].bv_val = NULL; + socs[noc++] = sup; } } } + ocvalues = slap_sl_malloc( sizeof( struct berval ) * (noc+1), ctx ); + /* copy values */ + for( i=0; isoc_cname; + else + ocvalues[i] = values[i]; + } + BER_BVZERO( &ocvalues[i] ); + rc = octetStringIndexer( use, mask, syntax, mr, prefix, ocvalues, keysp, ctx ); slap_sl_free( ocvalues, ctx ); + slap_sl_free( socs, ctx ); return rc; } @@ -368,7 +363,7 @@ static struct slap_schema_oc_map { { "subschema", "( 2.5.20.1 NAME 'subschema' " "DESC 'RFC4512: controlling subschema (sub)entry' " "AUXILIARY " - "MAY ( dITStructureRules $ nameForms $ ditContentRules $ " + "MAY ( dITStructureRules $ nameForms $ dITContentRules $ " "objectClasses $ attributeTypes $ matchingRules $ " "matchingRuleUse ) )", subentryObjectClass, SLAP_OC_OPERATIONAL, @@ -747,7 +742,7 @@ static struct slap_schema_ad_map { offsetof(struct slap_internal_schema, si_ad_subtreeSpecification) }, /* subschema subentry attributes */ - { "ditStructureRules", "( 2.5.21.1 NAME 'dITStructureRules' " + { "dITStructureRules", "( 2.5.21.1 NAME 'dITStructureRules' " "DESC 'RFC4512: DIT structure rules' " "EQUALITY integerFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 " @@ -756,7 +751,7 @@ static struct slap_schema_ad_map { NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ditStructureRules) }, - { "ditContentRules", "( 2.5.21.2 NAME 'dITContentRules' " + { "dITContentRules", "( 2.5.21.2 NAME 'dITContentRules' " "DESC 'RFC4512: DIT content rules' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation )", @@ -1195,7 +1190,7 @@ slap_schema_load( void ) return LDAP_OTHER; } - code = at_add( at, 0, NULL, &err ); + code = at_add( at, 0, NULL, NULL, &err ); if ( code ) { ldap_attributetype_free( at ); fprintf( stderr, "slap_schema_load: AttributeType " @@ -1311,7 +1306,7 @@ slap_schema_load( void ) return LDAP_OTHER; } - code = oc_add(oc,0,NULL,&err); + code = oc_add(oc,0,NULL,NULL,&err); if ( code ) { ldap_objectclass_free( oc ); fprintf( stderr, "slap_schema_load: ObjectClass "