]> git.sur5r.net Git - openldap/commitdiff
Round one of subclass indexing for objectClass and structualObjectClasss.
authorKurt Zeilenga <kurt@openldap.org>
Thu, 29 Aug 2002 01:12:59 +0000 (01:12 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 29 Aug 2002 01:12:59 +0000 (01:12 +0000)
add soc_cname to ObjectClass structure

servers/slapd/oc.c
servers/slapd/proto-slap.h
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/slap.h

index 2d7c6ce097274af7dd4b5327a207e25eab7ddd23..1920762bc9c5c89420be899cc07bc5e496dafcce 100644 (file)
@@ -434,6 +434,13 @@ oc_add(
        soc = (ObjectClass *) ch_calloc( 1, sizeof(ObjectClass) );
        AC_MEMCPY( &soc->soc_oclass, oc, sizeof(LDAPObjectClass) );
 
+       if( oc->oc_names != NULL ) {
+               soc->soc_cname.bv_val = soc->soc_names[0];
+       } else {
+               soc->soc_cname.bv_val = soc->soc_oid;
+       }
+       soc->soc_cname.bv_len = strlen( soc->soc_cname.bv_val );
+
        if( soc->soc_sup_oids == NULL &&
                soc->soc_kind == LDAP_SCHEMA_STRUCTURAL )
        {
index e414844832b15f7754ee977de03f904c5a810eae..95720738d06d439a1ecb2cad4fa6906c52148f96 100644 (file)
@@ -893,6 +893,24 @@ LDAP_SLAPD_V( int ) schema_init_done;
 LDAP_SLAPD_F (int) slap_schema_init LDAP_P((void));
 LDAP_SLAPD_F (void) schema_destroy LDAP_P(( void ));
 
+LDAP_SLAPD_F( int ) octetStringIndexer(
+       slap_mask_t use,
+       slap_mask_t flags,
+       Syntax *syntax,
+       MatchingRule *mr,
+       struct berval *prefix,
+       BerVarray values,
+       BerVarray *keysp );
+
+LDAP_SLAPD_F( int ) octetStringFilter(
+       slap_mask_t use,
+       slap_mask_t flags,
+       Syntax *syntax,
+       MatchingRule *mr,
+       struct berval *prefix,
+       void * assertValue,
+       BerVarray *keysp );
+
 /*
  * schema_prep.c
  */
index eef80beb30279966ba231ff6d1af3911b2c07fa6..b8308d765451a434334ccd491948bc0a2658ea8c 100644 (file)
@@ -37,7 +37,7 @@
 /* recycled matching routines */
 #define bitStringMatch                                 octetStringMatch
 #define numericStringMatch                             caseIgnoreIA5Match
-#define objectIdentifierMatch                  caseIgnoreIA5Match
+#define objectIdentifierMatch                  octetStringMatch
 #define telephoneNumberMatch                   caseIgnoreIA5Match
 #define telephoneNumberSubstringsMatch caseIgnoreIA5SubstringsMatch
 #define generalizedTimeMatch                   caseIgnoreIA5Match
@@ -138,7 +138,7 @@ octetStringMatch(
 }
 
 /* Index generation function */
-static int octetStringIndexer(
+int octetStringIndexer(
        slap_mask_t use,
        slap_mask_t flags,
        Syntax *syntax,
@@ -186,6 +186,7 @@ static int octetStringIndexer(
        }
 
        keys[i].bv_val = NULL;
+       keys[i].bv_len = 0;
 
        *keysp = keys;
 
@@ -193,7 +194,7 @@ static int octetStringIndexer(
 }
 
 /* Index generation function */
-static int octetStringFilter(
+int octetStringFilter(
        slap_mask_t use,
        slap_mask_t flags,
        Syntax *syntax,
@@ -231,6 +232,7 @@ static int octetStringFilter(
 
        ber_dupbv( keys, &digest );
        keys[1].bv_val = NULL;
+       keys[1].bv_len = 0;
 
        *keysp = keys;
 
index 50dd5e94f8ff9209f115eb979555e733d8e6a559..406add538614b715b77b5c84ad95e08cbc0372bc 100644 (file)
@@ -21,8 +21,36 @@ 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,
+       struct berval * in,
+       struct berval * out )
+{
+       ObjectClass *oc = oc_bvfind( in );
+
+       if( oc != NULL ) {
+               ber_dupbv( out, &oc->soc_cname );
+       } else {
+               ber_dupbv( out, in );
+       }
+
+#if 0
+#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;
+}
+
 static int
-objectClassMatch(
+objectSubClassMatch(
        int *matchp,
        slap_mask_t flags,
        Syntax *syntax,
@@ -34,12 +62,12 @@ objectClassMatch(
        ObjectClass *oc = oc_bvfind( value );
        ObjectClass *asserted = oc_bvfind( a );
 
-#if 1
+#if 0
 #ifdef NEW_LOGGING
        LDAP_LOG( CONFIG, ENTRY, 
-               "> objectClassMatch(%s, %s)\n", value->bv_val, a->bv_val, 0 );
+               "> objectSubClassMatch(%s, %s)\n", value->bv_val, a->bv_val, 0 );
 #else
-       Debug( LDAP_DEBUG_TRACE, "> objectClassMatch(%s,%s)\n",
+       Debug( LDAP_DEBUG_TRACE, "> objectSubClassMatch(%s,%s)\n",
                value->bv_val, a->bv_val, 0 );
 #endif
 #endif
@@ -66,13 +94,13 @@ objectClassMatch(
                *matchp = !is_object_subclass( asserted, oc );
        }
 
-#if 1
+#if 0
 #ifdef NEW_LOGGING
        LDAP_LOG( CONFIG, ENTRY, 
-               "< objectClassMatch(%s, %s) = %d\n",
+               "< objectSubClassMatch(%s, %s) = %d\n",
                value->bv_val, a->bv_val, *matchp );
 #else
-       Debug( LDAP_DEBUG_TRACE, "< objectClassMatch(%s,%s) = %d\n",
+       Debug( LDAP_DEBUG_TRACE, "< objectSubClassMatch(%s,%s) = %d\n",
                value->bv_val, a->bv_val, *matchp );
 #endif
 #endif
@@ -80,64 +108,118 @@ objectClassMatch(
        return LDAP_SUCCESS;
 }
 
-#if 1
-#define structuralObjectClassMatch objectClassMatch
-#else
-static int
-structuralObjectClassMatch(
-       int *matchp,
-       slap_mask_t flags,
-       Syntax *syntax,
-       MatchingRule *mr,
-       struct berval *value,
-       void *assertedValue )
+static int objectSubClassIndexer( 
+       slap_mask_t use,
+       slap_mask_t mask,
+       struct slap_syntax *syntax,
+       struct slap_matching_rule *mr,
+       struct berval *prefix,
+       BerVarray values,
+       BerVarray *keysp )
 {
-       struct berval *a = (struct berval *) assertedValue;
-       ObjectClass *oc = oc_bvfind( value );
-       ObjectClass *asserted = oc_bvfind( a );
+       int rc, noc, i;
+       BerVarray ocvalues;
+       
+       for( noc=0; values[noc].bv_val != NULL; noc++ ) {
+#if 0
+#ifdef NEW_LOGGING
+               LDAP_LOG( CONFIG, ENTRY, 
+                       "> objectSubClassIndexer(%d, %s)\n",
+                       noc, values[noc].bv_val, 0 );
+#else
+               Debug( LDAP_DEBUG_TRACE,
+                       "> objectSubClassIndexer(%d, %s)\n",
+                       noc, values[noc].bv_val, 0 );
+#endif
+#endif
+               /* just count em */;
+       }
+
+       /* over allocate */
+       ocvalues = ch_malloc( sizeof( struct berval ) * (noc+16) );
 
-#if 1
+       /* copy listed values (and termination) */
+       AC_MEMCPY( ocvalues, values, sizeof( struct berval ) * noc+1 );
+
+       /* expand values */
+       for( i=0; i<noc; i++ ) {
+               int j;
+               ObjectClass *oc = oc_bvfind( &values[i] );
+               if( oc == NULL || oc->soc_sups == NULL ) continue;
+               
+               for( j=0; oc->soc_sups[j] != NULL; j++ ) {
+                       int found = 0;
+                       ObjectClass *sup = oc->soc_sups[j];
+                       int k;
+
+                       for( k=0; k<noc; k++ ) {
+
+#if 0
 #ifdef NEW_LOGGING
-       LDAP_LOG( CONFIG, ENTRY, 
-               "> structuralObjectClassMatch(%s, %s)\n", value->bv_val, a->bv_val, 0 );
+                               LDAP_LOG( CONFIG, ENTRY, 
+                                       "= objectSubClassIndexer(%d, %s, %s)\n",
+                                       k, ocvalues[k].bv_val, sup->soc_cname.bv_val );
 #else
-       Debug( LDAP_DEBUG_TRACE, "> structuralObjectClassMatch(%s,%s)\n",
-               value->bv_val, a->bv_val, 0 );
+                               Debug( LDAP_DEBUG_TRACE,
+                                       "= objectSubClassIndexer(%d, %s, %s)\n",
+                                       k, ocvalues[k].bv_val, sup->soc_cname.bv_val );
 #endif
 #endif
+                               if( ber_bvcmp( &ocvalues[k], &sup->soc_cname ) == 0 ) {
+                                       found++;
+                                       break;
+                               }
+                       }
 
-       if( asserted == NULL ) {
-               if( OID_LEADCHAR( *a->bv_val ) ) {
-                       /* OID form, return FALSE */
-                       *matchp = 1;
-                       return LDAP_SUCCESS;
-               }
+                       if( !found ) {
+                               ocvalues = ch_realloc( ocvalues,
+                                       sizeof( struct berval ) * (noc+2) );
 
-               /* desc form, return undefined */
-               return SLAPD_COMPARE_UNDEFINED;
-       }
+                               assert( k == noc );
 
-       if ( oc == NULL ) {
-               /* unrecognized stored value */
-               return SLAPD_COMPARE_UNDEFINED;
-       }
+                               ocvalues[noc] = sup->soc_cname;
+
+                               assert( ocvalues[noc].bv_val );
+                               assert( ocvalues[noc].bv_len );
 
-       *matchp = ( asserted != oc );
+                               noc++;
 
-#if 1
+                               ocvalues[noc].bv_len = 0;
+                               ocvalues[noc].bv_val = NULL;
+
+#if 0
+#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, 
-               "< structuralObjectClassMatch( %s, %s ) = %d\n",
-               value->bv_val, a->bv_val, *matchp );
+               "< objectSubClassIndexer(%d)\n", noc, 0, 0 );
 #else
-       Debug( LDAP_DEBUG_TRACE, "< structuralObjectClassMatch(%s,%s) = %d\n",
-               value->bv_val, a->bv_val, *matchp );
+       Debug( LDAP_DEBUG_TRACE, "< objectSubClassIndexer(%d)\n",
+               noc, 0, 0 );
 #endif
 #endif
 
-       return LDAP_SUCCESS;
+       rc = octetStringIndexer( use, mask, syntax, mr,
+               prefix, ocvalues, keysp );
+
+       ch_free( ocvalues );
+       return rc;
 }
-#endif
+
+#define objectSubClassFilter octetStringFilter
 
 static ObjectClassSchemaCheckFN rootDseObjectClass;
 static ObjectClassSchemaCheckFN aliasObjectClass;
@@ -225,6 +307,8 @@ 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;
@@ -234,7 +318,9 @@ static struct slap_schema_ad_map {
                        "DESC 'RFC2256: object classes of the entity' "
                        "EQUALITY objectIdentifierMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
-               NULL, SLAP_AT_FINAL, objectClassMatch, NULL, NULL,
+               NULL, SLAP_AT_FINAL,
+               NULL, objectClassNormalize, objectSubClassMatch,
+                       objectSubClassIndexer, NULL,
                offsetof(struct slap_internal_schema, si_ad_objectClass) },
 
        /* user entry operational attributes */
@@ -243,7 +329,9 @@ 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, 0, structuralObjectClassMatch, NULL, NULL,
+               NULL, 0,
+               NULL, objectClassNormalize, objectSubClassMatch,
+                       objectSubClassIndexer, NULL,
                offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) },
        { "createTimestamp", "( 2.5.18.1 NAME 'createTimestamp' "
                        "DESC 'RFC2252: time which object was created' "
@@ -251,7 +339,8 @@ static struct slap_schema_ad_map {
                        "ORDERING generalizedTimeOrderingMatch "
                        "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, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_createTimestamp) },
        { "modifyTimestamp", "( 2.5.18.2 NAME 'modifyTimestamp' "
                        "DESC 'RFC2252: time which object was last modified' "
@@ -259,48 +348,55 @@ static struct slap_schema_ad_map {
                        "ORDERING generalizedTimeOrderingMatch "
                        "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, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_modifyTimestamp) },
        { "creatorsName", "( 2.5.18.3 NAME 'creatorsName' "
                        "DESC 'RFC2252: name of creator' "
                        "EQUALITY distinguishedNameMatch "
                        "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, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_creatorsName) },
        { "modifiersName", "( 2.5.18.4 NAME 'modifiersName' "
                        "DESC 'RFC2252: name of last modifier' "
                        "EQUALITY distinguishedNameMatch "
                        "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, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_modifiersName) },
        { "hasSubordinates", "( 2.5.18.9 NAME 'hasSubordinates' "
                        "DESC 'X.501: entry has children' "
                        "EQUALITY booleanMatch "
                        "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, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_hasSubordinates) },
        { "subschemaSubentry", "( 2.5.18.10 NAME 'subschemaSubentry' "
                        "DESC 'RFC2252: name of controlling subschema entry' "
                        "EQUALITY distinguishedNameMatch "
                        "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, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) },
        { "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, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_collectiveSubentries) },
        { "collectiveExclusions", "( 2.5.18.7 NAME 'collectiveExclusions' "
                        "EQUALITY objectIdentifierMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
                        "USAGE directoryOperation )",
-               NULL, SLAP_AT_HIDE, NULL, NULL, NULL,
+               NULL, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_collectiveExclusions) },
 
        { "entryUUID", "( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID' "   
@@ -308,51 +404,59 @@ static struct slap_schema_ad_map {
                        "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, SLAP_AT_HIDE,
+               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' "
                        "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, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_entryCSN) },
 
        /* 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,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_altServer) },
        { "namingContexts", "( 1.3.6.1.4.1.1466.101.120.5 "
                        "NAME 'namingContexts' "
                        "DESC 'RFC2252: naming contexts' "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_namingContexts) },
        { "supportedControl", "( 1.3.6.1.4.1.1466.101.120.13 "
                        "NAME 'supportedControl' "
                        "DESC 'RFC2252: supported controls' "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_supportedControl) },
        { "supportedExtension", "( 1.3.6.1.4.1.1466.101.120.7 "
                        "NAME 'supportedExtension' "
                        "DESC 'RFC2252: supported extended operations' "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_supportedExtension) },
        { "supportedLDAPVersion", "( 1.3.6.1.4.1.1466.101.120.15 "
                        "NAME 'supportedLDAPVersion' "
                        "DESC 'RFC2252: supported LDAP versions' "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_supportedLDAPVersion) },
        { "supportedSASLMechanisms", "( 1.3.6.1.4.1.1466.101.120.14 "
                        "NAME 'supportedSASLMechanisms' "
                        "DESC 'RFC2252: supported SASL mechanisms'"
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_supportedSASLMechanisms) },
        { "supportedFeatures", "( 1.3.6.1.4.1.4203.1.3.5 "
                        "NAME 'supportedFeatures' "
@@ -360,7 +464,8 @@ static struct slap_schema_ad_map {
                        "EQUALITY objectIdentifierMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
                        "USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               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' "
@@ -369,7 +474,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 dSAOperation )",
-               rootDseAttribute, SLAP_AT_HIDE, NULL, NULL, NULL,
+               rootDseAttribute, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_monitorContext) },
        { "vendorName", "( 1.3.6.1.1.4 NAME 'vendorName' "
                        "DESC 'RFC3045: name of implementation vendor' "
@@ -377,7 +483,8 @@ static struct slap_schema_ad_map {
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
                        "SINGLE-VALUE NO-USER-MODIFICATION "
                        "USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_vendorName) },
        { "vendorVersion", "( 1.3.6.1.1.5 NAME 'vendorVersion' "
                        "DESC 'RFC3045: version of implementation' "
@@ -385,7 +492,8 @@ static struct slap_schema_ad_map {
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
                        "SINGLE-VALUE NO-USER-MODIFICATION "
                        "USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_vendorVersion) },
 
        /* subentry attributes */
@@ -393,13 +501,15 @@ static struct slap_schema_ad_map {
                        "EQUALITY objectIdentifierMatch "
                        "USAGE directoryOperation "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
-               administrativeRoleAttribute, SLAP_AT_HIDE, NULL, NULL, NULL,
+               administrativeRoleAttribute, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_administrativeRole) },
        { "subtreeSpecification", "( 2.5.18.6 NAME 'subtreeSpecification' "
                        "SINGLE-VALUE "
                        "USAGE directoryOperation "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.45 )",
-               subentryAttribute, SLAP_AT_HIDE, NULL, NULL, NULL,
+               subentryAttribute, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_subtreeSpecification) },
 
        /* subschema subentry attributes */
@@ -408,50 +518,58 @@ static struct slap_schema_ad_map {
                        "EQUALITY integerFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
                        "USAGE directoryOperation ) ",
-               subentryAttribute, SLAP_AT_HIDE, NULL, NULL, NULL,
+               subentryAttribute, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_ditStructureRules) },
        { "ditContentRules", "( 2.5.21.2 NAME 'dITContentRules' "
                        "DESC 'RFC2252: DIT content rules' "
                        "EQUALITY objectIdentifierFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation )",
-               subentryAttribute, SLAP_AT_HIDE, NULL, NULL, NULL,
+               subentryAttribute, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_ditContentRules) },
        { "matchingRules", "( 2.5.21.4 NAME 'matchingRules' "
                        "DESC 'RFC2252: matching rules' "
                        "EQUALITY objectIdentifierFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.30 USAGE directoryOperation )",
-               subentryAttribute, 0, NULL, NULL, NULL,
+               subentryAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_matchingRules) },
        { "attributeTypes", "( 2.5.21.5 NAME 'attributeTypes' "
                        "DESC 'RFC2252: attribute types' "
                        "EQUALITY objectIdentifierFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.3 USAGE directoryOperation )",
-               subentryAttribute, 0, NULL, NULL, NULL,
+               subentryAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_attributeTypes) },
        { "objectClasses", "( 2.5.21.6 NAME 'objectClasses' "
                        "DESC 'RFC2252: object classes' "
                        "EQUALITY objectIdentifierFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.37 USAGE directoryOperation )",
-               subentryAttribute, 0, NULL, NULL, NULL,
+               subentryAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_objectClasses) },
        { "nameForms", "( 2.5.21.7 NAME 'nameForms' "
                        "DESC 'RFC2252: name forms ' "
                        "EQUALITY objectIdentifierFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.35 USAGE directoryOperation )",
-               subentryAttribute, SLAP_AT_HIDE, NULL, NULL, NULL,
+               subentryAttribute, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_nameForms) },
        { "matchingRuleUse", "( 2.5.21.8 NAME 'matchingRuleUse' "
                        "DESC 'RFC2252: matching rule uses' "
                        "EQUALITY objectIdentifierFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.31 USAGE directoryOperation )",
-               subentryAttribute, SLAP_AT_HIDE, NULL, NULL, NULL,
+               subentryAttribute, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_matchingRuleUse) },
 
        { "ldapSyntaxes", "( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes' "
                        "DESC 'RFC2252: LDAP syntaxes' "
                        "EQUALITY objectIdentifierFirstComponentMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.54 USAGE directoryOperation )",
-               subentryAttribute, 0, NULL, NULL, NULL,
+               subentryAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_ldapSyntaxes) },
 
        /* knowledge information */
@@ -460,14 +578,16 @@ static struct slap_schema_ad_map {
                        "DESC 'RFC2256: name of aliased object' "
                        "EQUALITY distinguishedNameMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )",
-               aliasAttribute, SLAP_AT_FINAL, NULL, NULL, NULL,
+               aliasAttribute, SLAP_AT_FINAL,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_aliasedObjectName) },
        { "ref", "( 2.16.840.1.113730.3.1.34 NAME 'ref' "
                        "DESC 'namedref: subordinate referral URL' "
                        "EQUALITY caseExactMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
                        "USAGE distributedOperation )",
-               referralAttribute, 0, NULL, NULL, NULL,
+               referralAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_ref) },
 
        /* access control internals */
@@ -476,14 +596,16 @@ static struct slap_schema_ad_map {
                        "DESC 'OpenLDAP ACL entry pseudo-attribute' "
                        "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, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_entry) },
        { "children", "( 1.3.6.1.4.1.4203.1.3.2 "
                        "NAME 'children' "
                        "DESC 'OpenLDAP ACL children pseudo-attribute' "
                        "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, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_children) },
        { "saslAuthzTo", "( 1.3.6.1.4.1.4203.666.1.8 "
                        "NAME 'saslAuthzTo' "
@@ -491,7 +613,8 @@ static struct slap_schema_ad_map {
                        "EQUALITY caseExactMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
                        "USAGE distributedOperation )",
-               NULL, SLAP_AT_HIDE, NULL, NULL, NULL,
+               NULL, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_saslAuthzTo) },
        { "saslAuthzFrom", "( 1.3.6.1.4.1.4203.666.1.9 "
                        "NAME 'saslAuthzFrom' "
@@ -499,7 +622,8 @@ static struct slap_schema_ad_map {
                        "EQUALITY caseExactMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
                        "USAGE distributedOperation )",
-               NULL, SLAP_AT_HIDE, NULL, NULL, NULL,
+               NULL, SLAP_AT_HIDE,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_saslAuthzFrom) },
 #ifdef SLAPD_ACI_ENABLED
        { "OpenLDAPaci", "( 1.3.6.1.4.1.4203.666.1.5 "
@@ -508,7 +632,8 @@ static struct slap_schema_ad_map {
                        "EQUALITY OpenLDAPaciMatch "
                        "SYNTAX 1.3.6.1.4.1.4203.666.2.1 "
                        "USAGE directoryOperation )",
-               NULL, 0, NULL, NULL, NULL,
+               NULL, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_aci) },
 #endif
 
@@ -516,14 +641,16 @@ static struct slap_schema_ad_map {
                        "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,
+               dynamicAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_entryTtl) },
        { "dynamicSubtrees", "( 1.3.6.1.4.1.1466.101.119.4 "
                        "NAME 'dynamicSubtrees' "
                        "DESC 'RFC2589: dynamic subtrees' "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION "
                        "USAGE dSAOperation )",
-               rootDseAttribute, 0, NULL, NULL, NULL,
+               rootDseAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_dynamicSubtrees) },
 
        /* userApplication attributes (which system schema depends upon) */
@@ -531,25 +658,29 @@ static struct slap_schema_ad_map {
                        "DESC 'RFC2256: common supertype of DN attributes' "
                        "EQUALITY distinguishedNameMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
-               NULL, SLAP_AT_ABSTRACT, NULL, NULL, NULL,
+               NULL, SLAP_AT_ABSTRACT,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_distinguishedName) },
        { "name", "( 2.5.4.41 NAME 'name' "
                        "DESC 'RFC2256: common supertype of name attributes' "
                        "EQUALITY caseIgnoreMatch "
                        "SUBSTR caseIgnoreSubstringsMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )",
-               NULL, SLAP_AT_ABSTRACT, NULL, NULL, NULL,
+               NULL, SLAP_AT_ABSTRACT,
+               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, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_cn) },
        { "userPassword", "( 2.5.4.35 NAME 'userPassword' "
                        "DESC 'RFC2256/2307: password of user' "
                        "EQUALITY octetStringMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )",
-               NULL, 0, NULL, NULL, NULL,
+               NULL, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_userPassword) },
 
 #ifdef SLAPD_AUTHPASSWD
@@ -559,7 +690,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, NULL,
                offsetof(struct slap_internal_schema, si_ad_authPassword) },
        { "supportedAuthPasswordSchemes", "( 1.3.6.1.4.1.4203.1.3.3 "
                        "NAME 'supportedAuthPasswordSchemes' "
@@ -567,7 +698,8 @@ static struct slap_schema_ad_map {
                        "EQUALITY caseExactIA5Match "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} "
                        "USAGE dSAOperation )",
-               subschemaAttribute, 0, NULL, NULL, NULL,
+               subschemaAttribute, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_authPassword) },
 #endif
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
@@ -577,7 +709,8 @@ static struct slap_schema_ad_map {
                        "EQUALITY caseIgnoreIA5Match "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 "
                        "SINGLE-VALUE )",
-               NULL, 0, NULL, NULL, NULL,
+               NULL, 0,
+               NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_krbName) },
 #endif
 
@@ -717,9 +850,26 @@ 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 ) {
+                               (*adp)->ad_type->sat_equality->smr_convert
+                                       = ad_map[i].ssam_convert;
+                       }
+                       if( ad_map[i].ssam_normalize ) {
+                               (*adp)->ad_type->sat_equality->smr_normalize
+                                       = ad_map[i].ssam_normalize;
+                       }
                        if( ad_map[i].ssam_match ) {
-                               /* install custom matching routine */
-                               (*adp)->ad_type->sat_equality->smr_match = ad_map[i].ssam_match;
+                               (*adp)->ad_type->sat_equality->smr_match
+                                       = ad_map[i].ssam_match;
+                       }
+                       if( ad_map[i].ssam_indexer ) {
+                               (*adp)->ad_type->sat_equality->smr_indexer
+                                       = ad_map[i].ssam_indexer;
+                       }
+                       if( ad_map[i].ssam_filter ) {
+                               (*adp)->ad_type->sat_equality->smr_filter
+                                       = ad_map[i].ssam_filter;
                        }
                }
        }
index 847174e733166a6b32bbe10f6668ae42812c2229..92ac6fdd8f73b364f0ac344559ecc078b90e4a37 100644 (file)
@@ -505,7 +505,8 @@ typedef int (ObjectClassSchemaCheckFN)(
        char *textbuf, size_t textlen );
 
 typedef struct slap_object_class {
-       LDAPObjectClass         soc_oclass;
+       LDAPObjectClass                 soc_oclass;
+       struct berval                   soc_cname;
        struct slap_object_class        **soc_sups;
        AttributeType                           **soc_required;
        AttributeType                           **soc_allowed;