]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_prep.c
ITS#3538: improved substrings matching (spaces handled
[openldap] / servers / slapd / schema_prep.c
index e1c09e1daa8a757e951e77b2688e381324e7781d..e05f5d63c5eede6a5753359cc07ca41078f41bc2 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,8 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
-#include "ldap_pvt_uc.h"
 
 #define OCDEBUG 0
 
@@ -372,13 +370,17 @@ static struct slap_schema_oc_map {
                        "matchingRuleUse ) )",
                subentryObjectClass, SLAP_OC_OPERATIONAL,
                offsetof(struct slap_internal_schema, si_oc_subschema) },
-#ifdef LDAP_DEVEL
+#ifdef LDAP_COLLECTIVE_ATTRIBUTES
        { "collectiveAttributeSubentry", "( 2.5.17.2 "
                        "NAME 'collectiveAttributeSubentry' "
+                       "DESC 'RFC3671: collective attribute subentry' "
                        "AUXILIARY )",
                subentryObjectClass,
                SLAP_OC_COLLECTIVEATTRIBUTESUBENTRY|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
-               offsetof(struct slap_internal_schema, si_oc_collectiveAttributeSubentry) },
+               offsetof( struct slap_internal_schema,
+                       si_oc_collectiveAttributeSubentry) },
+#endif
+#ifdef LDAP_DYNAMIC_OBJECTS
        { "dynamicObject", "( 1.3.6.1.4.1.1466.101.119.2 "
                        "NAME 'dynamicObject' "
                        "DESC 'RFC2589: Dynamic Object' "
@@ -508,9 +510,10 @@ static struct slap_schema_ad_map {
                NULL, NULL,
                NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) },
-#ifdef LDAP_DEVEL
+#ifdef LDAP_COLLECTIVE_ATTRIBUTES
        { "collectiveAttributeSubentries", "( 2.5.18.12 "
                        "NAME 'collectiveAttributeSubentries' "
+                       "DESC 'RFC3671: collective attribute subentries' "
                        "EQUALITY distinguishedNameMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
                        "NO-USER-MODIFICATION USAGE directoryOperation )",
@@ -519,6 +522,7 @@ static struct slap_schema_ad_map {
                NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_collectiveSubentries) },
        { "collectiveExclusions", "( 2.5.18.7 NAME 'collectiveExclusions' "
+                       "DESC 'RFC3671: collective attribute exclusions' "
                        "EQUALITY objectIdentifierMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
                        "USAGE directoryOperation )",
@@ -528,6 +532,15 @@ 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' "   
+                       "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, NULL,
+               NULL, NULL, NULL, NULL, NULL,
+               offsetof(struct slap_internal_schema, si_ad_entryDN) },
        { "entryUUID", "( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID' "   
                        "DESC 'UUID of the entry' "
                        "EQUALITY UUIDMatch "
@@ -540,9 +553,9 @@ static struct slap_schema_ad_map {
                offsetof(struct slap_internal_schema, si_ad_entryUUID) },
        { "entryCSN", "( 1.3.6.1.4.1.4203.666.1.7 NAME 'entryCSN' "
                        "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} "
+                       "EQUALITY CSNMatch "
+                       "ORDERING CSNOrderingMatch "
+                       "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1{64} "
                        "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
                NULL, SLAP_AT_HIDE,
                NULL, NULL,
@@ -550,15 +563,16 @@ static struct slap_schema_ad_map {
                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} "
+                       "EQUALITY CSNMatch "
+                       "ORDERING CSNOrderingMatch "
+                       "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1{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) },
 
+#ifdef LDAP_SUPERIOR_UUID
        { "superiorUUID", "( 1.3.6.1.4.1.4203.666.1.11 NAME 'superiorUUID' "   
                        "DESC 'UUID of the superior entry' "
                        "EQUALITY octetStringMatch "
@@ -568,6 +582,7 @@ static struct slap_schema_ad_map {
                NULL, NULL,
                NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_superiorUUID) },
+#endif
 
        { "syncreplCookie", "( 1.3.6.1.4.1.4203.666.1.23 "
                        "NAME 'syncreplCookie' "
@@ -584,16 +599,16 @@ static struct slap_schema_ad_map {
        { "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 "
+                       "EQUALITY CSNMatch "
+                       "ORDERING CSNOrderingMatch "
+                       "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1{64} "
                        "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
+#ifdef LDAP_SYNC_TIMESTAMP
        { "syncTimestamp", "( 1.3.6.1.4.1.4203.666.1.26 NAME 'syncTimestamp' "
                        "DESC 'Time which object was replicated' "
                        "EQUALITY generalizedTimeMatch "
@@ -674,6 +689,16 @@ static struct slap_schema_ad_map {
                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 "
+                       "NAME 'configContext' "
+                       "DESC 'config context' "
+                       "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_configContext) },
        { "vendorName", "( 1.3.6.1.1.4 NAME 'vendorName' "
                        "DESC 'RFC3045: name of implementation vendor' "
                        "EQUALITY caseExactMatch "
@@ -853,7 +878,7 @@ static struct slap_schema_ad_map {
                offsetof(struct slap_internal_schema, si_ad_aci) },
 #endif
 
-#ifdef LDAP_DEVEL
+#ifdef LDAP_DYNAMIC_OBJECTS
        { "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 "
@@ -898,6 +923,15 @@ static struct slap_schema_ad_map {
                NULL, NULL,
                NULL, NULL, NULL, NULL, NULL,
                offsetof(struct slap_internal_schema, si_ad_cn) },
+       { "uid", "( 0.9.2342.19200300.100.1.1 NAME ( 'uid' 'userid' ) "
+                       "DESC 'RFC1274: user identifier' "
+                       "EQUALITY caseIgnoreMatch "
+                       "SUBSTR caseIgnoreSubstringsMatch "
+                       "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )",
+               NULL, 0,
+               NULL, NULL,
+               NULL, NULL, NULL, NULL, NULL,
+               offsetof(struct slap_internal_schema, si_ad_uid) },
        { "userPassword", "( 2.5.4.35 NAME 'userPassword' "
                        "DESC 'RFC2256/2307: password of user' "
                        "EQUALITY octetStringMatch "
@@ -980,6 +1014,14 @@ static struct slap_schema_mr_map {
                offsetof(struct slap_internal_schema, si_mr_caseExactSubstringsMatch) },
        { "distinguishedNameMatch",
                offsetof(struct slap_internal_schema, si_mr_distinguishedNameMatch) },
+       { "dnSubtreeMatch",
+               offsetof(struct slap_internal_schema, si_mr_dnSubtreeMatch) },
+       { "dnOneLevelMatch",
+               offsetof(struct slap_internal_schema, si_mr_dnOneLevelMatch) },
+       { "dnSubordinateMatch",
+               offsetof(struct slap_internal_schema, si_mr_dnSubordinateMatch) },
+       { "dnSuperiorMatch",
+               offsetof(struct slap_internal_schema, si_mr_dnSuperiorMatch) },
        { "integerMatch",
                offsetof(struct slap_internal_schema, si_mr_integerMatch) },
        { "integerFirstComponentMatch",
@@ -1003,7 +1045,6 @@ static struct slap_schema_syn_map {
                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) },
-
        { "1.3.6.1.4.1.1466.115.121.1.3",
                offsetof(struct slap_internal_schema, si_syn_attributeTypeDesc) },
        { "1.3.6.1.4.1.1466.115.121.1.16",
@@ -1018,10 +1059,8 @@ static struct slap_schema_syn_map {
                offsetof(struct slap_internal_schema, si_syn_nameFormDesc) },
        { "1.3.6.1.4.1.1466.115.121.1.37",
                offsetof(struct slap_internal_schema, si_syn_objectClassDesc) },
-
        { "1.3.6.1.4.1.1466.115.121.1.17",
                offsetof(struct slap_internal_schema, si_syn_ditStructureRuleDesc) },
-
        { NULL, 0 }
 };
 
@@ -1085,7 +1124,7 @@ slap_schema_load( void )
                                return LDAP_OTHER;
                        }
 
-                       code = at_add( at, &err );
+                       code = at_add( at, 0, NULL, &err );
                        if ( code ) {
                                fprintf( stderr, "slap_schema_load: AttributeType "
                                        "\"%s\": %s: \"%s\"\n",
@@ -1198,7 +1237,7 @@ slap_schema_load( void )
                                return LDAP_OTHER;
                        }
 
-                       code = oc_add(oc,0,&err);
+                       code = oc_add(oc,0,NULL,&err);
                        if ( code ) {
                                fprintf( stderr, "slap_schema_load: ObjectClass "
                                        "\"%s\": %s: \"%s\"\n",
@@ -1231,7 +1270,7 @@ slap_schema_load( void )
                }
        }
 
-       slap_at_undefined.sat_syntax = slap_schema.si_syn_distinguishedName;
+       slap_at_undefined.sat_syntax = slap_schema.si_syn_octetString;
        slap_schema.si_at_undefined = &slap_at_undefined;
 
        return LDAP_SUCCESS;