X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fschema_prep.c;h=040120759db672a086489a69b0c48f7ead09e271;hb=7fe91339dfd08d6c4168c8493f5c1f0faca6ba54;hp=5bc607d3f17d4bd8e3b1aae482b1d4f10d28ed66;hpb=9f054b648b337ff63b0aca19c59ed959672503b1;p=openldap diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 5bc607d3f1..040120759d 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2006 The OpenLDAP Foundation. + * Copyright 1998-2009 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,9 +85,9 @@ oidValidate( static int objectClassPretty( - struct slap_syntax *syntax, - struct berval * in, - struct berval * out, + Syntax *syntax, + struct berval *in, + struct berval *out, void *ctx ) { ObjectClass *oc; @@ -241,8 +241,8 @@ objectSubClassMatch( static int objectSubClassIndexer( slap_mask_t use, slap_mask_t mask, - struct slap_syntax *syntax, - struct slap_matching_rule *mr, + Syntax *syntax, + MatchingRule *mr, struct berval *prefix, BerVarray values, BerVarray *keysp, @@ -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, @@ -454,7 +449,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, SLAP_AT_MANAGEABLE, + NULL, 0, oidValidate, objectClassPretty, NULL, NULL, objectSubClassMatch, objectSubClassIndexer, objectSubClassFilter, @@ -537,12 +532,12 @@ static struct slap_schema_ad_map { offsetof(struct slap_internal_schema, si_ad_collectiveExclusions) }, #endif - { "entryDN", "( 1.3.6.1.4.1.4203.666.1.33 NAME 'entryDN' " + { "entryDN", "( 1.3.6.1.1.20 NAME 'entryDN' " "DESC 'DN of the entry' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, SLAP_AT_HIDE|SLAP_AT_DYNAMIC, + NULL, SLAP_AT_DYNAMIC, NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryDN) }, @@ -608,7 +603,7 @@ static struct slap_schema_ad_map { "EQUALITY CSNMatch " "ORDERING CSNOrderingMatch " "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1{64} " - "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", + "NO-USER-MODIFICATION USAGE dSAOperation )", NULL, SLAP_AT_HIDE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -689,16 +684,18 @@ static struct slap_schema_ad_map { "NAME 'monitorContext' " "DESC 'monitor context' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " + "EQUALITY distinguishedNameMatch " "SINGLE-VALUE NO-USER-MODIFICATION " "USAGE dSAOperation )", rootDseAttribute, SLAP_AT_HIDE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_monitorContext) }, - { "configContext", "( 1.3.6.1.4.1.4203.666.11.1.1 " + { "configContext", "( 1.3.6.1.4.1.4203.1.12.2.1 " "NAME 'configContext' " "DESC 'config context' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " + "EQUALITY distinguishedNameMatch " "SINGLE-VALUE NO-USER-MODIFICATION " "USAGE dSAOperation )", rootDseAttribute, SLAP_AT_HIDE, @@ -747,7 +744,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 +753,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 )", @@ -991,18 +988,6 @@ static struct slap_schema_ad_map { NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_authPasswordSchemes) }, #endif -#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND - { "krbName", "( 1.3.6.1.4.1.250.1.32 " - "NAME ( 'krbName' 'kerberosName' ) " - "DESC 'Kerberos principal associated with object' " - "EQUALITY caseIgnoreIA5Match " - "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 " - "SINGLE-VALUE )", - NULL, 0, - NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - offsetof(struct slap_internal_schema, si_ad_krbName) }, -#endif { "description", "( 2.5.4.13 NAME 'description' " "DESC 'RFC4519: descriptive information' " @@ -1036,6 +1021,7 @@ static AttributeType slap_at_undefined = { NULL, /* syntax (will be set later to "octetString") */ NULL, /* schema check function */ NULL, /* oidmacro */ + NULL, /* soidmacro */ SLAP_AT_ABSTRACT|SLAP_AT_FINAL, /* mask */ { NULL }, /* next */ NULL /* attribute description */ @@ -1053,6 +1039,7 @@ static AttributeType slap_at_proxied = { NULL, /* syntax (will be set later to "octetString") */ NULL, /* schema check function */ NULL, /* oidmacro */ + NULL, /* soidmacro */ SLAP_AT_ABSTRACT|SLAP_AT_FINAL, /* mask */ { NULL }, /* next */ NULL /* attribute description */ @@ -1087,6 +1074,10 @@ static struct slap_schema_mr_map { { "objectIdentifierFirstComponentMatch", offsetof(struct slap_internal_schema, si_mr_objectIdentifierFirstComponentMatch) }, + { "caseIgnoreMatch", + offsetof(struct slap_internal_schema, si_mr_caseIgnoreMatch) }, + { "caseIgnoreListMatch", + offsetof(struct slap_internal_schema, si_mr_caseIgnoreListMatch) }, { NULL, 0 } }; @@ -1281,7 +1272,6 @@ slap_schema_load( void ) mr->smr_filter = ad_map[i].ssam_mr_filter; } - /* FIXME: no-one will free this at exit */ (*adp)->ad_type->sat_equality = mr; } }