]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_prep.c
Use AC_STRERROR_R
[openldap] / servers / slapd / schema_prep.c
index 5add2b243caf2e2ed944eebea6045197e3a389d4..1baba5dcfb55d660d51a5e1c27854a9fcd33b6d5 100644 (file)
@@ -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 <http://www.openldap.org/>.
+ *
+ * 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
+ * <http://www.OpenLDAP.org/license.html>.
  */
 
 #include "portable.h"
@@ -23,6 +32,20 @@ int schema_init_done = 0;
 
 struct slap_internal_schema slap_schema;
 
+static int objectClassValidate(
+       Syntax *syntax,
+       struct berval *in )
+{
+       ObjectClass *oc;
+       int rc = numericoidValidate( syntax, in );
+       if ( rc ) return rc;
+
+       oc = oc_bvfind( in );
+       if( oc == NULL ) return LDAP_INVALID_SYNTAX;
+
+       return LDAP_SUCCESS;
+}
+
 static int objectClassPretty(
        struct slap_syntax *syntax,
        struct berval * in,
@@ -30,13 +53,9 @@ static int objectClassPretty(
        void *ctx )
 {
        ObjectClass *oc = oc_bvfind( in );
+       if( oc == NULL ) return LDAP_INVALID_SYNTAX;
 
-       if( oc != NULL ) {
-               ber_dupbv_x( out, &oc->soc_cname, ctx );
-       } else {
-               ber_dupbv_x( out, in, ctx );
-       }
-
+       ber_dupbv_x( out, &oc->soc_cname, ctx );
        return LDAP_SUCCESS;
 }
 
@@ -61,12 +80,12 @@ objectSubClassMatch(
                }
 
                /* desc form, return undefined */
-               return SLAPD_COMPARE_UNDEFINED;
+               return LDAP_INVALID_SYNTAX;
        }
 
        if ( oc == NULL ) {
                /* unrecognized stored value */
-               return SLAPD_COMPARE_UNDEFINED;
+               return LDAP_INVALID_SYNTAX;
        }
 
        if( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( flags ) ) {
@@ -96,7 +115,7 @@ static int objectSubClassIndexer(
        }
 
        /* over allocate */
-       ocvalues = sl_malloc( sizeof( struct berval ) * (noc+16), ctx );
+       ocvalues = slap_sl_malloc( sizeof( struct berval ) * (noc+16), ctx );
 
        /* copy listed values (and termination) */
        for( i=0; i<noc; i++ ) {
@@ -130,7 +149,7 @@ static int objectSubClassIndexer(
                        }
 
                        if( !found ) {
-                               ocvalues = sl_realloc( ocvalues,
+                               ocvalues = slap_sl_realloc( ocvalues,
                                        sizeof( struct berval ) * (noc+2), ctx );
 
                                assert( k == noc );
@@ -151,7 +170,7 @@ static int objectSubClassIndexer(
        rc = octetStringIndexer( use, mask, syntax, mr,
                prefix, ocvalues, keysp, ctx );
 
-       sl_free( ocvalues, ctx );
+       slap_sl_free( ocvalues, ctx );
        return rc;
 }
 
@@ -224,29 +243,26 @@ static struct slap_schema_oc_map {
                dynamicObjectClass, SLAP_OC_DYNAMICOBJECT,
                offsetof(struct slap_internal_schema, si_oc_dynamicObject) },
 #endif
-#ifdef LDAP_SYNCREPL
-               { "glue", "( 1.3.6.1.4.1.4203.666.3.4 "
-                               "NAME 'glue' "
-                               "DESC 'Glue Entry' "
-                               "SUP top STRUCTURAL )",
-                       0, SLAP_OC_OPERATIONAL,
-                       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_OPERATIONAL,
-                       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 syncreplCookie )",
-                       0, SLAP_OC_OPERATIONAL,
-                       offsetof(struct slap_internal_schema, si_oc_syncProviderSubentry) },
-#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 }
 };
@@ -277,7 +293,7 @@ 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, objectClassPretty,
+               objectClassValidate, objectClassPretty,
                NULL, NULL, objectSubClassMatch,
                        objectSubClassIndexer, objectSubClassFilter,
                offsetof(struct slap_internal_schema, si_ad_objectClass) },
@@ -289,7 +305,7 @@ 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, objectClassPretty,
+               objectClassValidate, objectClassPretty,
                NULL, NULL, objectSubClassMatch,
                        objectSubClassIndexer, objectSubClassFilter,
                offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) },
@@ -370,16 +386,17 @@ static struct slap_schema_ad_map {
 #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 content' "
+                       "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} "
@@ -389,7 +406,7 @@ static struct slap_schema_ad_map {
                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)' "
+                       "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} "
@@ -400,7 +417,7 @@ static struct slap_schema_ad_map {
                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 )",
@@ -409,31 +426,41 @@ 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, NULL, NULL, 
-               offsetof(struct slap_internal_schema, si_ad_queryid) },
-#endif /* LDAP_CACHING */
-
-#ifdef LDAP_SYNCREPL
        { "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{64} "
-                       "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
+                       "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 */
@@ -650,9 +677,9 @@ static struct slap_schema_ad_map {
                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 "
-                       "NAME 'saslAuthzTo' "
-                       "DESC 'SASL proxy authorization targets' "
+       { "authzTo", "( 1.3.6.1.4.1.4203.666.1.8 "
+                       "NAME ( 'authzTo' 'saslAuthzTo' ) "
+                       "DESC 'proxy authorization targets' "
                        "EQUALITY caseExactMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
                        "USAGE distributedOperation )",
@@ -660,9 +687,9 @@ static struct slap_schema_ad_map {
                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 "
-                       "NAME 'saslAuthzFrom' "
-                       "DESC 'SASL proxy authorization sources' "
+       { "authzFrom", "( 1.3.6.1.4.1.4203.666.1.9 "
+                       "NAME ( 'authzFrom' 'saslAuthzFrom' ) "
+                       "DESC 'proxy authorization sources' "
                        "EQUALITY caseExactMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
                        "USAGE distributedOperation )",
@@ -677,7 +704,7 @@ 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) },
@@ -737,6 +764,15 @@ static struct slap_schema_ad_map {
                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' "
@@ -770,7 +806,7 @@ 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, NULL, NULL, 0 }
+       { NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 }
 };
 
 static AttributeType slap_at_undefined = {