X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fschema_prep.c;h=8c91a702a1450c811a2becae6da5f13327d1808c;hb=fa856463fe9a5577bb992affca98d27db90487d2;hp=907ddd3777f6df8025bcb9e869bbe83d8c00e983;hpb=265b7e22c6d756d4ff723a06812c598e4ecf55df;p=openldap diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 907ddd3777..8c91a702a1 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -1,8 +1,17 @@ -/* schema_init.c - init builtin schema */ +/* schema_prep.c - load builtin schema */ /* $OpenLDAP$ */ -/* - * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2004 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . */ #include "portable.h" @@ -23,31 +32,20 @@ int schema_init_done = 0; struct slap_internal_schema slap_schema; -static int objectClassNormalize( - slap_mask_t use, - struct slap_syntax *syntax, /* NULL if in is asserted value */ - struct slap_matching_rule *mr, +static int objectClassPretty( + struct slap_syntax *syntax, struct berval * in, - struct berval * out ) + struct berval * out, + void *ctx ) { ObjectClass *oc = oc_bvfind( in ); if( oc != NULL ) { - ber_dupbv( out, &oc->soc_cname ); + ber_dupbv_x( out, &oc->soc_cname, ctx ); } else { - ber_dupbv( out, in ); + ber_dupbv_x( out, in, ctx ); } -#if OCDEBUG -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, ENTRY, - "< objectClassNormalize(%s, %s)\n", in->bv_val, out->bv_val, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, "< objectClassNormalize(%s,%s)\n", - in->bv_val, out->bv_val, 0 ); -#endif -#endif - return LDAP_SUCCESS; } @@ -64,16 +62,6 @@ objectSubClassMatch( ObjectClass *oc = oc_bvfind( value ); ObjectClass *asserted = oc_bvfind( a ); -#if OCDEBUG -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, ENTRY, - "> objectSubClassMatch(%s, %s)\n", value->bv_val, a->bv_val, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, "> objectSubClassMatch(%s,%s)\n", - value->bv_val, a->bv_val, 0 ); -#endif -#endif - if( asserted == NULL ) { if( OID_LEADCHAR( *a->bv_val ) ) { /* OID form, return FALSE */ @@ -90,23 +78,12 @@ objectSubClassMatch( return SLAPD_COMPARE_UNDEFINED; } - if( SLAP_IS_MR_VALUE_SYNTAX_MATCH( flags ) ) { + if( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( flags ) ) { *matchp = ( asserted != oc ); } else { *matchp = !is_object_subclass( asserted, oc ); } -#if OCDEBUG -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, ENTRY, - "< objectSubClassMatch(%s, %s) = %d\n", - value->bv_val, a->bv_val, *matchp ); -#else - Debug( LDAP_DEBUG_TRACE, "< objectSubClassMatch(%s,%s) = %d\n", - value->bv_val, a->bv_val, *matchp ); -#endif -#endif - return LDAP_SUCCESS; } @@ -117,7 +94,8 @@ static int objectSubClassIndexer( struct slap_matching_rule *mr, struct berval *prefix, BerVarray values, - BerVarray *keysp ) + BerVarray *keysp, + void *ctx ) { int rc, noc, i; BerVarray ocvalues; @@ -127,7 +105,7 @@ static int objectSubClassIndexer( } /* over allocate */ - ocvalues = ch_malloc( sizeof( struct berval ) * (noc+16) ); + ocvalues = sl_malloc( sizeof( struct berval ) * (noc+16), ctx ); /* copy listed values (and termination) */ for( i=0; i objectSubClassIndexer(%d, %s)\n", - i, ocvalues[i].bv_val, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, - "> objectSubClassIndexer(%d, %s)\n", - i, ocvalues[i].bv_val, 0 ); -#endif -#endif } ocvalues[i].bv_val = NULL; @@ -165,18 +132,6 @@ static int objectSubClassIndexer( int k; for( k=0; ksoc_cname.bv_val ); -#else - Debug( LDAP_DEBUG_TRACE, - "= objectSubClassIndexer(%d, %s, %s)\n", - k, ocvalues[k].bv_val, sup->soc_cname.bv_val ); -#endif -#endif if( bvmatch( &ocvalues[k], &sup->soc_cname ) ) { found++; break; @@ -184,8 +139,8 @@ static int objectSubClassIndexer( } if( !found ) { - ocvalues = ch_realloc( ocvalues, - sizeof( struct berval ) * (noc+2) ); + ocvalues = sl_realloc( ocvalues, + sizeof( struct berval ) * (noc+2), ctx ); assert( k == noc ); @@ -198,68 +153,18 @@ static int objectSubClassIndexer( ocvalues[noc].bv_len = 0; ocvalues[noc].bv_val = NULL; - -#if OCDEBUG -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, ENTRY, - "< objectSubClassIndexer(%d, %d, %s)\n", - i, k, sup->soc_cname.bv_val ); -#else - Debug( LDAP_DEBUG_TRACE, - "< objectSubClassIndexer(%d, %d, %s)\n", - i, k, sup->soc_cname.bv_val ); -#endif -#endif } } } -#if 0 -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, ENTRY, - "< objectSubClassIndexer(%d)\n", noc, 0, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, "< objectSubClassIndexer(%d)\n", - noc, 0, 0 ); -#endif -#endif - rc = octetStringIndexer( use, mask, syntax, mr, - prefix, ocvalues, keysp ); + prefix, ocvalues, keysp, ctx ); - ch_free( ocvalues ); + sl_free( ocvalues, ctx ); return rc; } -/* Index generation function */ -static int objectSubClassFilter( - slap_mask_t use, - slap_mask_t flags, - Syntax *syntax, - MatchingRule *mr, - struct berval *prefix, - void * assertedValue, - BerVarray *keysp ) -{ -#if OCDEBUG - struct berval *bv = (struct berval *) assertedValue; - ObjectClass *oc = oc_bvfind( bv ); - if( oc ) { - bv = &oc->soc_cname; - } - -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, ENTRY, - "< objectSubClassFilter(%s)\n", bv->bv_val, 0, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, "< objectSubClassFilter(%s)\n", - bv->bv_val, 0, 0 ); -#endif -#endif - - return octetStringFilter( use, flags, syntax, mr, - prefix, assertedValue, keysp ); -} +#define objectSubClassFilter octetStringFilter static ObjectClassSchemaCheckFN rootDseObjectClass; static ObjectClassSchemaCheckFN aliasObjectClass; @@ -314,12 +219,7 @@ static struct slap_schema_oc_map { "matchingRuleUse ) )", subentryObjectClass, SLAP_OC_OPERATIONAL, offsetof(struct slap_internal_schema, si_oc_subschema) }, - { "monitor", "( 1.3.6.1.4.1.4203.666.3.2 NAME 'monitor' " - "DESC 'OpenLDAP system monitoring' " - "STRUCTURAL " - "MUST cn )", - 0, SLAP_OC_OPERATIONAL, - offsetof(struct slap_internal_schema, si_oc_monitor) }, +#ifdef LDAP_DEVEL { "collectiveAttributeSubentry", "( 2.5.17.2 " "NAME 'collectiveAttributeSubentry' " "AUXILIARY )", @@ -332,6 +232,28 @@ static struct slap_schema_oc_map { "SUP top AUXILIARY )", dynamicObjectClass, SLAP_OC_DYNAMICOBJECT, offsetof(struct slap_internal_schema, si_oc_dynamicObject) }, +#endif + { "glue", "( 1.3.6.1.4.1.4203.666.3.4 " + "NAME 'glue' " + "DESC 'Glue Entry' " + "SUP top STRUCTURAL )", + 0, SLAP_OC_GLUE|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE, + offsetof(struct slap_internal_schema, si_oc_glue) }, + { "syncConsumerSubentry", "( 1.3.6.1.4.1.4203.666.3.5 " + "NAME 'syncConsumerSubentry' " + "DESC 'Persistent Info for SyncRepl Consumer' " + "AUXILIARY " + "MAY syncreplCookie )", + 0, SLAP_OC_SYNCCONSUMERSUBENTRY|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE, + offsetof(struct slap_internal_schema, si_oc_syncConsumerSubentry) }, + { "syncProviderSubentry", "( 1.3.6.1.4.1.4203.666.3.6 " + "NAME 'syncProviderSubentry' " + "DESC 'Persistent Info for SyncRepl Producer' " + "AUXILIARY " + "MAY contextCSN )", + 0, SLAP_OC_SYNCPROVIDERSUBENTRY|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE, + offsetof(struct slap_internal_schema, si_oc_syncProviderSubentry) }, + { NULL, NULL, NULL, 0, 0 } }; @@ -347,11 +269,13 @@ static struct slap_schema_ad_map { char *ssam_defn; AttributeTypeSchemaCheckFN *ssam_check; slap_mask_t ssam_flags; - slap_mr_convert_func *ssam_convert; - slap_mr_normalize_func *ssam_normalize; - slap_mr_match_func *ssam_match; - slap_mr_indexer_func *ssam_indexer; - slap_mr_filter_func *ssam_filter; + slap_syntax_validate_func *ssam_syn_validate; + slap_syntax_transform_func *ssam_syn_pretty; + slap_mr_convert_func *ssam_mr_convert; + slap_mr_normalize_func *ssam_mr_normalize; + slap_mr_match_func *ssam_mr_match; + slap_mr_indexer_func *ssam_mr_indexer; + slap_mr_filter_func *ssam_mr_filter; size_t ssam_offset; } ad_map[] = { { "objectClass", "( 2.5.4.0 NAME 'objectClass' " @@ -359,7 +283,8 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )", NULL, SLAP_AT_FINAL, - NULL, objectClassNormalize, objectSubClassMatch, + NULL, objectClassPretty, + NULL, NULL, objectSubClassMatch, objectSubClassIndexer, objectSubClassFilter, offsetof(struct slap_internal_schema, si_ad_objectClass) }, @@ -370,7 +295,8 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, 0, - NULL, objectClassNormalize, objectSubClassMatch, + NULL, objectClassPretty, + NULL, NULL, objectSubClassMatch, objectSubClassIndexer, objectSubClassFilter, offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) }, { "createTimestamp", "( 2.5.18.1 NAME 'createTimestamp' " @@ -380,6 +306,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_createTimestamp) }, { "modifyTimestamp", "( 2.5.18.2 NAME 'modifyTimestamp' " @@ -389,6 +316,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_modifyTimestamp) }, { "creatorsName", "( 2.5.18.3 NAME 'creatorsName' " @@ -397,6 +325,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_creatorsName) }, { "modifiersName", "( 2.5.18.4 NAME 'modifiersName' " @@ -405,6 +334,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_modifiersName) }, { "hasSubordinates", "( 2.5.18.9 NAME 'hasSubordinates' " @@ -413,6 +343,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_hasSubordinates) }, { "subschemaSubentry", "( 2.5.18.10 NAME 'subschemaSubentry' " @@ -421,14 +352,17 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE " "NO-USER-MODIFICATION USAGE directoryOperation )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) }, +#ifdef LDAP_DEVEL { "collectiveAttributeSubentries", "( 2.5.18.12 " "NAME 'collectiveAttributeSubentries' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "NO-USER-MODIFICATION USAGE directoryOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_collectiveSubentries) }, { "collectiveExclusions", "( 2.5.18.7 NAME 'collectiveExclusions' " @@ -436,41 +370,95 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " "USAGE directoryOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_collectiveExclusions) }, +#endif { "entryUUID", "( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID' " - "DESC 'LCUP/LDUP: UUID of the entry' " - "EQUALITY octetStringMatch " - "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " + "DESC 'UUID of the entry' " + "EQUALITY UUIDMatch " + "ORDERING UUIDOrderingMatch " + "SYNTAX 1.3.6.1.4.1.4203.666.2.6 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryUUID) }, { "entryCSN", "( 1.3.6.1.4.1.4203.666.1.7 NAME 'entryCSN' " - "DESC 'LCUP/LDUP: change sequence number of the entry' " + "DESC 'change sequence number of the entry content' " "EQUALITY octetStringMatch " "ORDERING octetStringOrderingMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryCSN) }, + { "namingCSN", "( 1.3.6.1.4.1.4203.666.1.13 NAME 'namingCSN' " + "DESC 'change sequence number of the entry naming (RDN)' " + "EQUALITY octetStringMatch " + "ORDERING octetStringOrderingMatch " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " + "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", + NULL, SLAP_AT_HIDE, + NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + offsetof(struct slap_internal_schema, si_ad_namingCSN) }, { "superiorUUID", "( 1.3.6.1.4.1.4203.666.1.11 NAME 'superiorUUID' " - "DESC 'LCUP/LDUP: UUID of the superior entry' " + "DESC 'UUID of the superior entry' " "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_superiorUUID) }, + { "syncreplCookie", "( 1.3.6.1.4.1.4203.666.1.23 " + "NAME 'syncreplCookie' " + "DESC 'syncrepl Cookie for shadow copy' " + "EQUALITY octetStringMatch " + "ORDERING octetStringOrderingMatch " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 " + "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", + NULL, SLAP_AT_HIDE, + NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + offsetof(struct slap_internal_schema, si_ad_syncreplCookie) }, + + { "contextCSN", "( 1.3.6.1.4.1.4203.666.1.25 " + "NAME 'contextCSN' " + "DESC 'the largest committed CSN of a context' " + "EQUALITY octetStringMatch " + "ORDERING octetStringOrderingMatch " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 " + "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", + NULL, SLAP_AT_HIDE, + NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + offsetof(struct slap_internal_schema, si_ad_contextCSN) }, + +#ifdef LDAP_DEVEL + { "syncTimestamp", "( 1.3.6.1.4.1.4203.666.1.26 NAME 'syncTimestamp' " + "DESC 'Time which object was replicated' " + "EQUALITY generalizedTimeMatch " + "ORDERING generalizedTimeOrderingMatch " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 " + "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", + NULL, 0, + NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + offsetof(struct slap_internal_schema, si_ad_syncTimestamp) }, +#endif + /* root DSE attributes */ { "altServer", "( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' " "DESC 'RFC2252: alternative servers' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_altServer) }, { "namingContexts", "( 1.3.6.1.4.1.1466.101.120.5 " @@ -478,6 +466,7 @@ static struct slap_schema_ad_map { "DESC 'RFC2252: naming contexts' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_namingContexts) }, { "supportedControl", "( 1.3.6.1.4.1.1466.101.120.13 " @@ -485,6 +474,7 @@ static struct slap_schema_ad_map { "DESC 'RFC2252: supported controls' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedControl) }, { "supportedExtension", "( 1.3.6.1.4.1.1466.101.120.7 " @@ -492,6 +482,7 @@ static struct slap_schema_ad_map { "DESC 'RFC2252: supported extended operations' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedExtension) }, { "supportedLDAPVersion", "( 1.3.6.1.4.1.1466.101.120.15 " @@ -499,6 +490,7 @@ static struct slap_schema_ad_map { "DESC 'RFC2252: supported LDAP versions' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedLDAPVersion) }, { "supportedSASLMechanisms", "( 1.3.6.1.4.1.1466.101.120.14 " @@ -506,6 +498,7 @@ static struct slap_schema_ad_map { "DESC 'RFC2252: supported SASL mechanisms'" "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedSASLMechanisms) }, { "supportedFeatures", "( 1.3.6.1.4.1.4203.1.3.5 " @@ -515,16 +508,17 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " "USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedFeatures) }, { "monitorContext", "( 1.3.6.1.4.1.4203.666.1.10 " "NAME 'monitorContext' " "DESC 'monitor context' " - "EQUALITY objectIdentifierMatch " - "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "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) }, { "vendorName", "( 1.3.6.1.1.4 NAME 'vendorName' " @@ -534,6 +528,7 @@ static struct slap_schema_ad_map { "SINGLE-VALUE NO-USER-MODIFICATION " "USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_vendorName) }, { "vendorVersion", "( 1.3.6.1.1.5 NAME 'vendorVersion' " @@ -543,6 +538,7 @@ static struct slap_schema_ad_map { "SINGLE-VALUE NO-USER-MODIFICATION " "USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_vendorVersion) }, @@ -552,6 +548,7 @@ static struct slap_schema_ad_map { "USAGE directoryOperation " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )", administrativeRoleAttribute, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_administrativeRole) }, { "subtreeSpecification", "( 2.5.18.6 NAME 'subtreeSpecification' " @@ -559,6 +556,7 @@ static struct slap_schema_ad_map { "USAGE directoryOperation " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.45 )", subentryAttribute, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_subtreeSpecification) }, @@ -569,6 +567,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 " "USAGE directoryOperation ) ", subentryAttribute, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ditStructureRules) }, { "ditContentRules", "( 2.5.21.2 NAME 'dITContentRules' " @@ -576,6 +575,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation )", subentryAttribute, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ditContentRules) }, { "matchingRules", "( 2.5.21.4 NAME 'matchingRules' " @@ -583,6 +583,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.30 USAGE directoryOperation )", subentryAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_matchingRules) }, { "attributeTypes", "( 2.5.21.5 NAME 'attributeTypes' " @@ -590,6 +591,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.3 USAGE directoryOperation )", subentryAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_attributeTypes) }, { "objectClasses", "( 2.5.21.6 NAME 'objectClasses' " @@ -597,6 +599,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.37 USAGE directoryOperation )", subentryAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_objectClasses) }, { "nameForms", "( 2.5.21.7 NAME 'nameForms' " @@ -604,6 +607,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.35 USAGE directoryOperation )", subentryAttribute, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_nameForms) }, { "matchingRuleUse", "( 2.5.21.8 NAME 'matchingRuleUse' " @@ -611,6 +615,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.31 USAGE directoryOperation )", subentryAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_matchingRuleUse) }, @@ -619,6 +624,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.54 USAGE directoryOperation )", subentryAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ldapSyntaxes) }, @@ -629,6 +635,7 @@ static struct slap_schema_ad_map { "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )", aliasAttribute, SLAP_AT_FINAL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_aliasedObjectName) }, { "ref", "( 2.16.840.1.113730.3.1.34 NAME 'ref' " @@ -637,6 +644,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " "USAGE distributedOperation )", referralAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ref) }, @@ -647,6 +655,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.4203.1.1.1 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entry) }, { "children", "( 1.3.6.1.4.1.4203.1.3.2 " @@ -655,6 +664,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.4203.1.1.1 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_children) }, { "saslAuthzTo", "( 1.3.6.1.4.1.4203.666.1.8 " @@ -664,6 +674,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " "USAGE distributedOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_saslAuthzTo) }, { "saslAuthzFrom", "( 1.3.6.1.4.1.4203.666.1.9 " @@ -673,6 +684,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " "USAGE distributedOperation )", NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_saslAuthzFrom) }, #ifdef SLAPD_ACI_ENABLED @@ -682,16 +694,19 @@ static struct slap_schema_ad_map { "EQUALITY OpenLDAPaciMatch " "SYNTAX 1.3.6.1.4.1.4203.666.2.1 " "USAGE directoryOperation )", - NULL, 0, + NULL, SLAP_AT_HIDE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_aci) }, #endif +#ifdef LDAP_DEVEL { "entryTtl", "( 1.3.6.1.4.1.1466.101.119.3 NAME 'entryTtl' " "DESC 'RFC2589: entry time-to-live' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE " "NO-USER-MODIFICATION USAGE dSAOperation )", dynamicAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryTtl) }, { "dynamicSubtrees", "( 1.3.6.1.4.1.1466.101.119.4 " @@ -700,8 +715,10 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION " "USAGE dSAOperation )", rootDseAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_dynamicSubtrees) }, +#endif /* userApplication attributes (which system schema depends upon) */ { "distinguishedName", "( 2.5.4.49 NAME 'distinguishedName' " @@ -709,6 +726,7 @@ static struct slap_schema_ad_map { "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )", NULL, SLAP_AT_ABSTRACT, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_distinguishedName) }, { "name", "( 2.5.4.41 NAME 'name' " @@ -717,12 +735,14 @@ static struct slap_schema_ad_map { "SUBSTR caseIgnoreSubstringsMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )", NULL, SLAP_AT_ABSTRACT, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_name) }, { "cn", "( 2.5.4.3 NAME ( 'cn' 'commonName' ) " "DESC 'RFC2256: common name(s) for which the entity is known by' " "SUP name )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_cn) }, { "userPassword", "( 2.5.4.35 NAME 'userPassword' " @@ -730,9 +750,19 @@ static struct slap_schema_ad_map { "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_userPassword) }, + { "labeledURI", "( 1.3.6.1.4.1.250.1.57 NAME 'labeledURI' " + "DESC 'RFC2079: Uniform Resource Identifier with optional label' " + "EQUALITY caseExactMatch " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )", + NULL, 0, + NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + offsetof(struct slap_internal_schema, si_ad_labeledURI) }, + #ifdef SLAPD_AUTHPASSWD { "authPassword", "( 1.3.6.1.4.1.4203.1.3.4 " "NAME 'authPassword' " @@ -740,6 +770,7 @@ static struct slap_schema_ad_map { "EQUALITY 1.3.6.1.4.1.4203.1.2.2 " "SYNTAX 1.3.6.1.4.1.4203.1.1.2 )", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_authPassword) }, { "supportedAuthPasswordSchemes", "( 1.3.6.1.4.1.4203.1.3.3 " @@ -749,6 +780,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} " "USAGE dSAOperation )", subschemaAttribute, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_authPassword) }, #endif @@ -760,11 +792,11 @@ static struct slap_schema_ad_map { "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 - - { NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0 } + { NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 } }; static AttributeType slap_at_undefined = { @@ -774,11 +806,11 @@ static AttributeType slap_at_undefined = { { sizeof("UNDEFINED")-1, "UNDEFINED" }, /* cname */ NULL, /* sup */ NULL, /* subtypes */ - NULL, NULL, NULL, NULL, /* matching rules */ + NULL, NULL, NULL, NULL, /* matching rules routines */ NULL, /* syntax (this may need to be defined) */ (AttributeTypeSchemaCheckFN *) 0, /* schema check function */ SLAP_AT_ABSTRACT|SLAP_AT_FINAL, /* mask */ - NULL, /* next */ + { NULL }, /* next */ NULL /* attribute description */ /* mutex (don't know how to initialize it :) */ }; @@ -787,10 +819,22 @@ static struct slap_schema_mr_map { char *ssmm_name; size_t ssmm_offset; } mr_map[] = { + { "caseExactIA5Match", + offsetof(struct slap_internal_schema, si_mr_caseExactIA5Match) }, + { "caseExactMatch", + offsetof(struct slap_internal_schema, si_mr_caseExactMatch) }, + { "caseExactSubstringsMatch", + offsetof(struct slap_internal_schema, si_mr_caseExactSubstringsMatch) }, { "distinguishedNameMatch", offsetof(struct slap_internal_schema, si_mr_distinguishedNameMatch) }, { "integerMatch", offsetof(struct slap_internal_schema, si_mr_integerMatch) }, + { "integerFirstComponentMatch", + offsetof(struct slap_internal_schema, + si_mr_integerFirstComponentMatch) }, + { "objectIdentifierFirstComponentMatch", + offsetof(struct slap_internal_schema, + si_mr_objectIdentifierFirstComponentMatch) }, { NULL, 0 } }; @@ -798,12 +842,14 @@ static struct slap_schema_syn_map { char *sssm_name; size_t sssm_offset; } syn_map[] = { - { "1.3.6.1.4.1.1466.115.121.1.40", - offsetof(struct slap_internal_schema, si_syn_octetString) }, + { "1.3.6.1.4.1.1466.115.121.1.15", + offsetof(struct slap_internal_schema, si_syn_directoryString) }, { "1.3.6.1.4.1.1466.115.121.1.12", offsetof(struct slap_internal_schema, si_syn_distinguishedName) }, { "1.3.6.1.4.1.1466.115.121.1.27", offsetof(struct slap_internal_schema, si_syn_integer) }, + { "1.3.6.1.4.1.1466.115.121.1.40", + offsetof(struct slap_internal_schema, si_syn_octetString) }, { NULL, 0 } }; @@ -879,6 +925,7 @@ slap_schema_load( void ) { int rc; const char *text; + Syntax *syntax = NULL; AttributeDescription ** adp = (AttributeDescription **) &(((char *) &slap_schema)[ad_map[i].ssam_offset]); @@ -900,32 +947,59 @@ slap_schema_load( void ) /* install flags */ (*adp)->ad_type->sat_flags |= ad_map[i].ssam_flags; - /* install custom rule routine */ - if( ad_map[i].ssam_convert || - ad_map[i].ssam_normalize || - ad_map[i].ssam_match || - ad_map[i].ssam_indexer || - ad_map[i].ssam_filter ) + /* install custom syntax routines */ + if( ad_map[i].ssam_syn_validate || + ad_map[i].ssam_syn_pretty ) + { + Syntax *syn; + + syntax = (*adp)->ad_type->sat_syntax; + + syn = ch_malloc( sizeof( Syntax ) ); + *syn = *syntax; + + if( ad_map[i].ssam_syn_validate ) { + syn->ssyn_validate = ad_map[i].ssam_syn_validate; + } + if( ad_map[i].ssam_syn_pretty ) { + syn->ssyn_pretty = ad_map[i].ssam_syn_pretty; + } + + (*adp)->ad_type->sat_syntax = syn; + } + + /* install custom rule routines */ + if( ( (*adp)->ad_type->sat_equality != NULL && + syntax == (*adp)->ad_type->sat_equality->smr_syntax ) || + ad_map[i].ssam_mr_convert || + ad_map[i].ssam_mr_normalize || + ad_map[i].ssam_mr_match || + ad_map[i].ssam_mr_indexer || + ad_map[i].ssam_mr_filter ) { MatchingRule *mr = ch_malloc( sizeof( MatchingRule ) ); *mr = *(*adp)->ad_type->sat_equality; - (*adp)->ad_type->sat_equality = mr; - - if( ad_map[i].ssam_convert ) { - mr->smr_convert = ad_map[i].ssam_convert; + + if ( syntax == mr->smr_syntax ) { + mr->smr_syntax = (*adp)->ad_type->sat_syntax; } - if( ad_map[i].ssam_normalize ) { - mr->smr_normalize = ad_map[i].ssam_normalize; + if ( ad_map[i].ssam_mr_convert ) { + mr->smr_convert = ad_map[i].ssam_mr_convert; } - if( ad_map[i].ssam_match ) { - mr->smr_match = ad_map[i].ssam_match; + if ( ad_map[i].ssam_mr_normalize ) { + mr->smr_normalize = ad_map[i].ssam_mr_normalize; } - if( ad_map[i].ssam_indexer ) { - mr->smr_indexer = ad_map[i].ssam_indexer; + if ( ad_map[i].ssam_mr_match ) { + mr->smr_match = ad_map[i].ssam_mr_match; } - if( ad_map[i].ssam_filter ) { - mr->smr_filter = ad_map[i].ssam_filter; + if ( ad_map[i].ssam_mr_indexer ) { + mr->smr_indexer = ad_map[i].ssam_mr_indexer; } + if ( ad_map[i].ssam_mr_filter ) { + mr->smr_filter = ad_map[i].ssam_mr_filter; + } + + (*adp)->ad_type->sat_equality = mr; } } }