]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_prep.c
Free IDL_CACHE locks
[openldap] / servers / slapd / schema_prep.c
index 1df9e8e3aa9a28807aa93b0d06e935ef635ea12d..7c145bf148ab728f7c46855cba01436d9a9969d4 100644 (file)
@@ -28,14 +28,15 @@ static int objectClassNormalize(
        struct slap_syntax *syntax, /* NULL if in is asserted value */
        struct slap_matching_rule *mr,
        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
@@ -90,7 +91,8 @@ 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 );
@@ -117,7 +119,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 +130,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<noc; i++ ) {
@@ -184,8 +187,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 );
 
@@ -225,9 +228,9 @@ static int objectSubClassIndexer(
 #endif
 
        rc = octetStringIndexer( use, mask, syntax, mr,
-               prefix, ocvalues, keysp );
+               prefix, ocvalues, keysp, ctx );
 
-       ch_free( ocvalues );
+       sl_free( ocvalues, ctx );
        return rc;
 }
 
@@ -239,7 +242,8 @@ static int objectSubClassFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertedValue,
-       BerVarray *keysp )
+       BerVarray *keysp,
+       void *ctx )
 {
 #if OCDEBUG
        struct berval *bv = (struct berval *) assertedValue;
@@ -258,7 +262,7 @@ static int objectSubClassFilter(
 #endif
 
        return octetStringFilter( use, flags, syntax, mr,
-               prefix, assertedValue, keysp );
+               prefix, assertedValue, keysp, ctx );
 }
 
 static ObjectClassSchemaCheckFN rootDseObjectClass;
@@ -314,12 +318,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 +331,7 @@ static struct slap_schema_oc_map {
                        "SUP top AUXILIARY )",
                dynamicObjectClass, SLAP_OC_DYNAMICOBJECT,
                offsetof(struct slap_internal_schema, si_oc_dynamicObject) },
+#endif
        { NULL, NULL, NULL, 0, 0 }
 };
 
@@ -423,6 +423,7 @@ static struct slap_schema_ad_map {
                NULL, 0,
                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 "
@@ -438,6 +439,7 @@ static struct slap_schema_ad_map {
                NULL, SLAP_AT_HIDE,
                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' "
@@ -448,7 +450,7 @@ static struct slap_schema_ad_map {
                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 'LCUP/LDUP: change sequence number of the entry content' "
                        "EQUALITY octetStringMatch "
                        "ORDERING octetStringOrderingMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} "
@@ -456,6 +458,15 @@ static struct slap_schema_ad_map {
                NULL, SLAP_AT_HIDE,
                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 'LCUP/LDUP: 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,
+               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' "
@@ -466,6 +477,18 @@ static struct slap_schema_ad_map {
                NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_superiorUUID) },
 
+#ifdef LDAP_CACHING 
+       /* LDAP cache specific operational attribute */
+       { "queryid", "( 1.3.6.1.4.1.4203.666.1.12 NAME 'queryid' "
+                       "DESC 'list of queries the entry belongs to' "
+                       "EQUALITY octetStringMatch "
+                       "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} "
+                       "NO-USER-MODIFICATION USAGE directoryOperation )",
+               NULL, 0, /* SLAP_AT_HIDE or SLAP_AT_NONE ? */
+               NULL, NULL, NULL, NULL, NULL, 
+               offsetof(struct slap_internal_schema, si_ad_queryid) },
+#endif /* LDAP_CACHING */
+
        /* root DSE attributes */
        { "altServer", "( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' "
                        "DESC 'RFC2252: alternative servers' "
@@ -520,8 +543,7 @@ static struct slap_schema_ad_map {
        { "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,
@@ -687,6 +709,7 @@ static struct slap_schema_ad_map {
                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 "
@@ -702,6 +725,7 @@ static struct slap_schema_ad_map {
                rootDseAttribute, 0,
                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' "
@@ -763,14 +787,13 @@ static struct slap_schema_ad_map {
                NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_krbName) },
 #endif
-
-       { NULL, NULL, NULL, 0, NULL, NULL, NULL, 0 }
+       { NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0 }
 };
 
 static AttributeType slap_at_undefined = {
        { "1.1.1", NULL, NULL, 1, NULL,
                NULL, NULL, NULL, NULL,
-               0, 0, 0, 1, 3 }, /* LDAPAttributeType */
+               0, 0, 0, 1, 3, NULL }, /* LDAPAttributeType */
        { sizeof("UNDEFINED")-1, "UNDEFINED" }, /* cname */
        NULL, /* sup */
        NULL, /* subtypes */
@@ -778,7 +801,7 @@ static AttributeType slap_at_undefined = {
        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 +810,18 @@ 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) },
        { NULL, 0 }
 };
 
@@ -798,12 +829,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 }
 };