1 /* schema_prep.c - load builtin schema */
2 /* $OpenLDAP: pkg/ldap/servers/slapd/schema_prep.c,v 1.169.2.8 2008/07/09 23:43:08 quanah Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2008 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
22 #include <ac/string.h>
23 #include <ac/socket.h>
29 int schema_init_done
= 0;
31 struct slap_internal_schema slap_schema
;
38 struct berval val
= *in
;
40 if( val
.bv_len
== 0 ) {
41 /* disallow empty strings */
42 return LDAP_INVALID_SYNTAX
;
45 if( DESC_LEADCHAR( val
.bv_val
[0] ) ) {
48 if ( val
.bv_len
== 0 ) return LDAP_SUCCESS
;
50 while( DESC_CHAR( val
.bv_val
[0] ) ) {
54 if ( val
.bv_len
== 0 ) return LDAP_SUCCESS
;
59 while( OID_LEADCHAR( val
.bv_val
[0] ) ) {
63 if ( val
.bv_val
[-1] != '0' ) {
64 while ( OID_LEADCHAR( val
.bv_val
[0] )) {
70 if( val
.bv_len
== 0 ) {
75 if( !OID_SEPARATOR( val
.bv_val
[0] )) break;
83 return LDAP_INVALID_SYNTAX
;
87 static int objectClassPretty(
95 if( oidValidate( NULL
, in
)) return LDAP_INVALID_SYNTAX
;
98 if( oc
== NULL
) return LDAP_INVALID_SYNTAX
;
100 ber_dupbv_x( out
, &oc
->soc_cname
, ctx
);
110 struct berval
*value
,
111 void *assertedValue
)
113 struct berval
*a
= (struct berval
*) assertedValue
;
114 AttributeType
*at
= at_bvfind( value
);
115 AttributeType
*asserted
= at_bvfind( a
);
117 if( asserted
== NULL
) {
118 if( OID_LEADCHAR( *a
->bv_val
) ) {
119 /* OID form, return FALSE */
124 /* desc form, return undefined */
125 return LDAP_INVALID_SYNTAX
;
129 /* unrecognized stored value */
130 return LDAP_INVALID_SYNTAX
;
133 *matchp
= ( asserted
!= at
);
143 struct berval
*value
,
144 void *assertedValue
)
146 struct berval
*a
= (struct berval
*) assertedValue
;
147 MatchingRule
*mrv
= mr_bvfind( value
);
148 MatchingRule
*asserted
= mr_bvfind( a
);
150 if( asserted
== NULL
) {
151 if( OID_LEADCHAR( *a
->bv_val
) ) {
152 /* OID form, return FALSE */
157 /* desc form, return undefined */
158 return LDAP_INVALID_SYNTAX
;
162 /* unrecognized stored value */
163 return LDAP_INVALID_SYNTAX
;
166 *matchp
= ( asserted
!= mrv
);
176 struct berval
*value
,
177 void *assertedValue
)
179 struct berval
*a
= (struct berval
*) assertedValue
;
180 ObjectClass
*oc
= oc_bvfind( value
);
181 ObjectClass
*asserted
= oc_bvfind( a
);
183 if( asserted
== NULL
) {
184 if( OID_LEADCHAR( *a
->bv_val
) ) {
185 /* OID form, return FALSE */
190 /* desc form, return undefined */
191 return LDAP_INVALID_SYNTAX
;
195 /* unrecognized stored value */
196 return LDAP_INVALID_SYNTAX
;
199 *matchp
= ( asserted
!= oc
);
209 struct berval
*value
,
210 void *assertedValue
)
212 struct berval
*a
= (struct berval
*) assertedValue
;
213 ObjectClass
*oc
= oc_bvfind( value
);
214 ObjectClass
*asserted
= oc_bvfind( a
);
216 if( asserted
== NULL
) {
217 if( OID_LEADCHAR( *a
->bv_val
) ) {
218 /* OID form, return FALSE */
223 /* desc form, return undefined */
224 return LDAP_INVALID_SYNTAX
;
228 /* unrecognized stored value */
229 return LDAP_INVALID_SYNTAX
;
232 if( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( flags
) ) {
233 *matchp
= ( asserted
!= oc
);
235 *matchp
= !is_object_subclass( asserted
, oc
);
241 static int objectSubClassIndexer(
246 struct berval
*prefix
,
255 for( noc
=0; values
[noc
].bv_val
!= NULL
; noc
++ ) {
260 socs
= slap_sl_malloc( (noc
+16) * sizeof( ObjectClass
* ), ctx
);
263 for( i
=0; i
<noc
; i
++ ) {
264 socs
[i
] = oc_bvfind( &values
[i
] );
268 for( i
=0; i
<noc
; i
++ ) {
270 ObjectClass
*oc
= socs
[i
];
271 if( oc
== NULL
|| oc
->soc_sups
== NULL
) continue;
273 for( j
=0; oc
->soc_sups
[j
] != NULL
; j
++ ) {
275 ObjectClass
*sup
= oc
->soc_sups
[j
];
278 for( k
=0; k
<noc
; k
++ ) {
279 if( sup
== socs
[k
] ) {
286 socs
= slap_sl_realloc( socs
,
287 sizeof( ObjectClass
* ) * (noc
+2), ctx
);
295 ocvalues
= slap_sl_malloc( sizeof( struct berval
) * (noc
+1), ctx
);
297 for( i
=0; i
<noc
; i
++ ) {
299 ocvalues
[i
] = socs
[i
]->soc_cname
;
301 ocvalues
[i
] = values
[i
];
303 BER_BVZERO( &ocvalues
[i
] );
305 rc
= octetStringIndexer( use
, mask
, syntax
, mr
,
306 prefix
, ocvalues
, keysp
, ctx
);
308 slap_sl_free( ocvalues
, ctx
);
309 slap_sl_free( socs
, ctx
);
313 #define objectSubClassFilter octetStringFilter
315 static ObjectClassSchemaCheckFN rootDseObjectClass
;
316 static ObjectClassSchemaCheckFN aliasObjectClass
;
317 static ObjectClassSchemaCheckFN referralObjectClass
;
318 static ObjectClassSchemaCheckFN subentryObjectClass
;
319 #ifdef LDAP_DYNAMIC_OBJECTS
320 static ObjectClassSchemaCheckFN dynamicObjectClass
;
323 static struct slap_schema_oc_map
{
326 ObjectClassSchemaCheckFN
*ssom_check
;
327 slap_mask_t ssom_flags
;
330 { "top", "( 2.5.6.0 NAME 'top' "
331 "DESC 'top of the superclass chain' "
332 "ABSTRACT MUST objectClass )",
333 0, 0, offsetof(struct slap_internal_schema
, si_oc_top
) },
334 { "extensibleObject", "( 1.3.6.1.4.1.1466.101.120.111 "
335 "NAME 'extensibleObject' "
336 "DESC 'RFC4512: extensible object' "
337 "SUP top AUXILIARY )",
338 0, SLAP_OC_OPERATIONAL
,
339 offsetof(struct slap_internal_schema
, si_oc_extensibleObject
) },
340 { "alias", "( 2.5.6.1 NAME 'alias' "
341 "DESC 'RFC4512: an alias' "
342 "SUP top STRUCTURAL "
343 "MUST aliasedObjectName )",
344 aliasObjectClass
, SLAP_OC_ALIAS
|SLAP_OC_OPERATIONAL
,
345 offsetof(struct slap_internal_schema
, si_oc_alias
) },
346 { "referral", "( 2.16.840.1.113730.3.2.6 NAME 'referral' "
347 "DESC 'namedref: named subordinate referral' "
348 "SUP top STRUCTURAL MUST ref )",
349 referralObjectClass
, SLAP_OC_REFERRAL
|SLAP_OC_OPERATIONAL
,
350 offsetof(struct slap_internal_schema
, si_oc_referral
) },
351 { "LDAProotDSE", "( 1.3.6.1.4.1.4203.1.4.1 "
352 "NAME ( 'OpenLDAProotDSE' 'LDAProotDSE' ) "
353 "DESC 'OpenLDAP Root DSE object' "
354 "SUP top STRUCTURAL MAY cn )",
355 rootDseObjectClass
, SLAP_OC_OPERATIONAL
,
356 offsetof(struct slap_internal_schema
, si_oc_rootdse
) },
357 { "subentry", "( 2.5.17.0 NAME 'subentry' "
358 "DESC 'RFC3672: subentry' "
359 "SUP top STRUCTURAL "
360 "MUST ( cn $ subtreeSpecification ) )",
361 subentryObjectClass
, SLAP_OC_SUBENTRY
|SLAP_OC_OPERATIONAL
,
362 offsetof(struct slap_internal_schema
, si_oc_subentry
) },
363 { "subschema", "( 2.5.20.1 NAME 'subschema' "
364 "DESC 'RFC4512: controlling subschema (sub)entry' "
366 "MAY ( dITStructureRules $ nameForms $ dITContentRules $ "
367 "objectClasses $ attributeTypes $ matchingRules $ "
368 "matchingRuleUse ) )",
369 subentryObjectClass
, SLAP_OC_OPERATIONAL
,
370 offsetof(struct slap_internal_schema
, si_oc_subschema
) },
371 #ifdef LDAP_COLLECTIVE_ATTRIBUTES
372 { "collectiveAttributeSubentry", "( 2.5.17.2 "
373 "NAME 'collectiveAttributeSubentry' "
374 "DESC 'RFC3671: collective attribute subentry' "
377 SLAP_OC_COLLECTIVEATTRIBUTESUBENTRY
|SLAP_OC_OPERATIONAL
|SLAP_OC_HIDE
,
378 offsetof( struct slap_internal_schema
,
379 si_oc_collectiveAttributeSubentry
) },
381 #ifdef LDAP_DYNAMIC_OBJECTS
382 { "dynamicObject", "( 1.3.6.1.4.1.1466.101.119.2 "
383 "NAME 'dynamicObject' "
384 "DESC 'RFC2589: Dynamic Object' "
385 "SUP top AUXILIARY )",
386 dynamicObjectClass
, SLAP_OC_DYNAMICOBJECT
,
387 offsetof(struct slap_internal_schema
, si_oc_dynamicObject
) },
389 { "glue", "( 1.3.6.1.4.1.4203.666.3.4 "
392 "SUP top STRUCTURAL )",
393 0, SLAP_OC_GLUE
|SLAP_OC_OPERATIONAL
|SLAP_OC_HIDE
,
394 offsetof(struct slap_internal_schema
, si_oc_glue
) },
395 { "syncConsumerSubentry", "( 1.3.6.1.4.1.4203.666.3.5 "
396 "NAME 'syncConsumerSubentry' "
397 "DESC 'Persistent Info for SyncRepl Consumer' "
399 "MAY syncreplCookie )",
400 0, SLAP_OC_SYNCCONSUMERSUBENTRY
|SLAP_OC_OPERATIONAL
|SLAP_OC_HIDE
,
401 offsetof(struct slap_internal_schema
, si_oc_syncConsumerSubentry
) },
402 { "syncProviderSubentry", "( 1.3.6.1.4.1.4203.666.3.6 "
403 "NAME 'syncProviderSubentry' "
404 "DESC 'Persistent Info for SyncRepl Producer' "
407 0, SLAP_OC_SYNCPROVIDERSUBENTRY
|SLAP_OC_OPERATIONAL
|SLAP_OC_HIDE
,
408 offsetof(struct slap_internal_schema
, si_oc_syncProviderSubentry
) },
410 { NULL
, NULL
, NULL
, 0, 0 }
413 static AttributeTypeSchemaCheckFN rootDseAttribute
;
414 static AttributeTypeSchemaCheckFN aliasAttribute
;
415 static AttributeTypeSchemaCheckFN referralAttribute
;
416 static AttributeTypeSchemaCheckFN subentryAttribute
;
417 static AttributeTypeSchemaCheckFN administrativeRoleAttribute
;
418 #ifdef LDAP_DYNAMIC_OBJECTS
419 static AttributeTypeSchemaCheckFN dynamicAttribute
;
422 static struct slap_schema_ad_map
{
425 AttributeTypeSchemaCheckFN
*ssam_check
;
426 slap_mask_t ssam_flags
;
427 slap_syntax_validate_func
*ssam_syn_validate
;
428 slap_syntax_transform_func
*ssam_syn_pretty
;
429 slap_mr_convert_func
*ssam_mr_convert
;
430 slap_mr_normalize_func
*ssam_mr_normalize
;
431 slap_mr_match_func
*ssam_mr_match
;
432 slap_mr_indexer_func
*ssam_mr_indexer
;
433 slap_mr_filter_func
*ssam_mr_filter
;
436 { "objectClass", "( 2.5.4.0 NAME 'objectClass' "
437 "DESC 'RFC4512: object classes of the entity' "
438 "EQUALITY objectIdentifierMatch "
439 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
441 oidValidate
, objectClassPretty
,
442 NULL
, NULL
, objectSubClassMatch
,
443 objectSubClassIndexer
, objectSubClassFilter
,
444 offsetof(struct slap_internal_schema
, si_ad_objectClass
) },
446 /* user entry operational attributes */
447 { "structuralObjectClass", "( 2.5.21.9 NAME 'structuralObjectClass' "
448 "DESC 'RFC4512: structural object class of entry' "
449 "EQUALITY objectIdentifierMatch "
450 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
451 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
452 NULL
, SLAP_AT_MANAGEABLE
,
453 oidValidate
, objectClassPretty
,
454 NULL
, NULL
, objectSubClassMatch
,
455 objectSubClassIndexer
, objectSubClassFilter
,
456 offsetof(struct slap_internal_schema
, si_ad_structuralObjectClass
) },
457 { "createTimestamp", "( 2.5.18.1 NAME 'createTimestamp' "
458 "DESC 'RFC4512: time which object was created' "
459 "EQUALITY generalizedTimeMatch "
460 "ORDERING generalizedTimeOrderingMatch "
461 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 "
462 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
463 NULL
, SLAP_AT_MANAGEABLE
,
465 NULL
, NULL
, NULL
, NULL
, NULL
,
466 offsetof(struct slap_internal_schema
, si_ad_createTimestamp
) },
467 { "modifyTimestamp", "( 2.5.18.2 NAME 'modifyTimestamp' "
468 "DESC 'RFC4512: time which object was last modified' "
469 "EQUALITY generalizedTimeMatch "
470 "ORDERING generalizedTimeOrderingMatch "
471 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 "
472 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
473 NULL
, SLAP_AT_MANAGEABLE
,
475 NULL
, NULL
, NULL
, NULL
, NULL
,
476 offsetof(struct slap_internal_schema
, si_ad_modifyTimestamp
) },
477 { "creatorsName", "( 2.5.18.3 NAME 'creatorsName' "
478 "DESC 'RFC4512: name of creator' "
479 "EQUALITY distinguishedNameMatch "
480 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
481 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
482 NULL
, SLAP_AT_MANAGEABLE
,
484 NULL
, NULL
, NULL
, NULL
, NULL
,
485 offsetof(struct slap_internal_schema
, si_ad_creatorsName
) },
486 { "modifiersName", "( 2.5.18.4 NAME 'modifiersName' "
487 "DESC 'RFC4512: name of last modifier' "
488 "EQUALITY distinguishedNameMatch "
489 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
490 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
491 NULL
, SLAP_AT_MANAGEABLE
,
493 NULL
, NULL
, NULL
, NULL
, NULL
,
494 offsetof(struct slap_internal_schema
, si_ad_modifiersName
) },
495 { "hasSubordinates", "( 2.5.18.9 NAME 'hasSubordinates' "
496 "DESC 'X.501: entry has children' "
497 "EQUALITY booleanMatch "
498 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 "
499 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
500 NULL
, SLAP_AT_DYNAMIC
,
502 NULL
, NULL
, NULL
, NULL
, NULL
,
503 offsetof(struct slap_internal_schema
, si_ad_hasSubordinates
) },
504 { "subschemaSubentry", "( 2.5.18.10 NAME 'subschemaSubentry' "
505 "DESC 'RFC4512: name of controlling subschema entry' "
506 "EQUALITY distinguishedNameMatch "
507 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE "
508 "NO-USER-MODIFICATION USAGE directoryOperation )",
509 NULL
, SLAP_AT_DYNAMIC
,
511 NULL
, NULL
, NULL
, NULL
, NULL
,
512 offsetof(struct slap_internal_schema
, si_ad_subschemaSubentry
) },
513 #ifdef LDAP_COLLECTIVE_ATTRIBUTES
514 { "collectiveAttributeSubentries", "( 2.5.18.12 "
515 "NAME 'collectiveAttributeSubentries' "
516 "DESC 'RFC3671: collective attribute subentries' "
517 "EQUALITY distinguishedNameMatch "
518 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
519 "NO-USER-MODIFICATION USAGE directoryOperation )",
522 NULL
, NULL
, NULL
, NULL
, NULL
,
523 offsetof(struct slap_internal_schema
, si_ad_collectiveSubentries
) },
524 { "collectiveExclusions", "( 2.5.18.7 NAME 'collectiveExclusions' "
525 "DESC 'RFC3671: collective attribute exclusions' "
526 "EQUALITY objectIdentifierMatch "
527 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
528 "USAGE directoryOperation )",
531 NULL
, NULL
, NULL
, NULL
, NULL
,
532 offsetof(struct slap_internal_schema
, si_ad_collectiveExclusions
) },
535 { "entryDN", "( 1.3.6.1.1.20 NAME 'entryDN' "
536 "DESC 'DN of the entry' "
537 "EQUALITY distinguishedNameMatch "
538 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
539 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
540 NULL
, SLAP_AT_DYNAMIC
,
542 NULL
, NULL
, NULL
, NULL
, NULL
,
543 offsetof(struct slap_internal_schema
, si_ad_entryDN
) },
544 { "entryUUID", "( 1.3.6.1.1.16.4 NAME 'entryUUID' "
545 "DESC 'UUID of the entry' "
546 "EQUALITY UUIDMatch "
547 "ORDERING UUIDOrderingMatch "
548 "SYNTAX 1.3.6.1.1.16.1 "
549 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
550 NULL
, SLAP_AT_MANAGEABLE
,
552 NULL
, NULL
, NULL
, NULL
, NULL
,
553 offsetof(struct slap_internal_schema
, si_ad_entryUUID
) },
554 { "entryCSN", "( 1.3.6.1.4.1.4203.666.1.7 NAME 'entryCSN' "
555 "DESC 'change sequence number of the entry content' "
557 "ORDERING CSNOrderingMatch "
558 "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1{64} "
559 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
562 NULL
, NULL
, NULL
, NULL
, NULL
,
563 offsetof(struct slap_internal_schema
, si_ad_entryCSN
) },
564 { "namingCSN", "( 1.3.6.1.4.1.4203.666.1.13 NAME 'namingCSN' "
565 "DESC 'change sequence number of the entry naming (RDN)' "
567 "ORDERING CSNOrderingMatch "
568 "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1{64} "
569 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
572 NULL
, NULL
, NULL
, NULL
, NULL
,
573 offsetof(struct slap_internal_schema
, si_ad_namingCSN
) },
575 #ifdef LDAP_SUPERIOR_UUID
576 { "superiorUUID", "( 1.3.6.1.4.1.4203.666.1.11 NAME 'superiorUUID' "
577 "DESC 'UUID of the superior entry' "
578 "EQUALITY UUIDMatch "
579 "ORDERING UUIDOrderingMatch "
580 "SYNTAX 1.3.6.1.1.16.1 "
581 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
584 NULL
, NULL
, NULL
, NULL
, NULL
,
585 offsetof(struct slap_internal_schema
, si_ad_superiorUUID
) },
588 { "syncreplCookie", "( 1.3.6.1.4.1.4203.666.1.23 "
589 "NAME 'syncreplCookie' "
590 "DESC 'syncrepl Cookie for shadow copy' "
591 "EQUALITY octetStringMatch "
592 "ORDERING octetStringOrderingMatch "
593 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 "
594 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
597 NULL
, NULL
, NULL
, NULL
, NULL
,
598 offsetof(struct slap_internal_schema
, si_ad_syncreplCookie
) },
600 { "contextCSN", "( 1.3.6.1.4.1.4203.666.1.25 "
602 "DESC 'the largest committed CSN of a context' "
604 "ORDERING CSNOrderingMatch "
605 "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1{64} "
606 "NO-USER-MODIFICATION USAGE dSAOperation )",
609 NULL
, NULL
, NULL
, NULL
, NULL
,
610 offsetof(struct slap_internal_schema
, si_ad_contextCSN
) },
612 #ifdef LDAP_SYNC_TIMESTAMP
613 { "syncTimestamp", "( 1.3.6.1.4.1.4203.666.1.26 NAME 'syncTimestamp' "
614 "DESC 'Time which object was replicated' "
615 "EQUALITY generalizedTimeMatch "
616 "ORDERING generalizedTimeOrderingMatch "
617 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 "
618 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
621 NULL
, NULL
, NULL
, NULL
, NULL
,
622 offsetof(struct slap_internal_schema
, si_ad_syncTimestamp
) },
625 /* root DSE attributes */
626 { "altServer", "( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' "
627 "DESC 'RFC4512: alternative servers' "
628 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE dSAOperation )",
631 NULL
, NULL
, NULL
, NULL
, NULL
,
632 offsetof(struct slap_internal_schema
, si_ad_altServer
) },
633 { "namingContexts", "( 1.3.6.1.4.1.1466.101.120.5 "
634 "NAME 'namingContexts' "
635 "DESC 'RFC4512: naming contexts' "
636 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation )",
639 NULL
, NULL
, NULL
, NULL
, NULL
,
640 offsetof(struct slap_internal_schema
, si_ad_namingContexts
) },
641 { "supportedControl", "( 1.3.6.1.4.1.1466.101.120.13 "
642 "NAME 'supportedControl' "
643 "DESC 'RFC4512: supported controls' "
644 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )",
647 NULL
, NULL
, NULL
, NULL
, NULL
,
648 offsetof(struct slap_internal_schema
, si_ad_supportedControl
) },
649 { "supportedExtension", "( 1.3.6.1.4.1.1466.101.120.7 "
650 "NAME 'supportedExtension' "
651 "DESC 'RFC4512: supported extended operations' "
652 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )",
655 NULL
, NULL
, NULL
, NULL
, NULL
,
656 offsetof(struct slap_internal_schema
, si_ad_supportedExtension
) },
657 { "supportedLDAPVersion", "( 1.3.6.1.4.1.1466.101.120.15 "
658 "NAME 'supportedLDAPVersion' "
659 "DESC 'RFC4512: supported LDAP versions' "
660 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation )",
663 NULL
, NULL
, NULL
, NULL
, NULL
,
664 offsetof(struct slap_internal_schema
, si_ad_supportedLDAPVersion
) },
665 { "supportedSASLMechanisms", "( 1.3.6.1.4.1.1466.101.120.14 "
666 "NAME 'supportedSASLMechanisms' "
667 "DESC 'RFC4512: supported SASL mechanisms'"
668 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation )",
671 NULL
, NULL
, NULL
, NULL
, NULL
,
672 offsetof(struct slap_internal_schema
, si_ad_supportedSASLMechanisms
) },
673 { "supportedFeatures", "( 1.3.6.1.4.1.4203.1.3.5 "
674 "NAME 'supportedFeatures' "
675 "DESC 'RFC4512: features supported by the server' "
676 "EQUALITY objectIdentifierMatch "
677 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
678 "USAGE dSAOperation )",
681 NULL
, NULL
, NULL
, NULL
, NULL
,
682 offsetof(struct slap_internal_schema
, si_ad_supportedFeatures
) },
683 { "monitorContext", "( 1.3.6.1.4.1.4203.666.1.10 "
684 "NAME 'monitorContext' "
685 "DESC 'monitor context' "
686 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
687 "SINGLE-VALUE NO-USER-MODIFICATION "
688 "USAGE dSAOperation )",
689 rootDseAttribute
, SLAP_AT_HIDE
,
691 NULL
, NULL
, NULL
, NULL
, NULL
,
692 offsetof(struct slap_internal_schema
, si_ad_monitorContext
) },
693 { "configContext", "( 1.3.6.1.4.1.4203.1.12.2.1 "
694 "NAME 'configContext' "
695 "DESC 'config context' "
696 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
697 "SINGLE-VALUE NO-USER-MODIFICATION "
698 "USAGE dSAOperation )",
699 rootDseAttribute
, SLAP_AT_HIDE
,
701 NULL
, NULL
, NULL
, NULL
, NULL
,
702 offsetof(struct slap_internal_schema
, si_ad_configContext
) },
703 { "vendorName", "( 1.3.6.1.1.4 NAME 'vendorName' "
704 "DESC 'RFC3045: name of implementation vendor' "
705 "EQUALITY caseExactMatch "
706 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
707 "SINGLE-VALUE NO-USER-MODIFICATION "
708 "USAGE dSAOperation )",
711 NULL
, NULL
, NULL
, NULL
, NULL
,
712 offsetof(struct slap_internal_schema
, si_ad_vendorName
) },
713 { "vendorVersion", "( 1.3.6.1.1.5 NAME 'vendorVersion' "
714 "DESC 'RFC3045: version of implementation' "
715 "EQUALITY caseExactMatch "
716 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
717 "SINGLE-VALUE NO-USER-MODIFICATION "
718 "USAGE dSAOperation )",
721 NULL
, NULL
, NULL
, NULL
, NULL
,
722 offsetof(struct slap_internal_schema
, si_ad_vendorVersion
) },
724 /* subentry attributes */
725 { "administrativeRole", "( 2.5.18.5 NAME 'administrativeRole' "
726 "DESC 'RFC3672: administrative role' "
727 "EQUALITY objectIdentifierMatch "
728 "USAGE directoryOperation "
729 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
730 administrativeRoleAttribute
, SLAP_AT_HIDE
,
732 NULL
, NULL
, NULL
, NULL
, NULL
,
733 offsetof(struct slap_internal_schema
, si_ad_administrativeRole
) },
734 { "subtreeSpecification", "( 2.5.18.6 NAME 'subtreeSpecification' "
735 "DESC 'RFC3672: subtree specification' "
737 "USAGE directoryOperation "
738 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.45 )",
739 subentryAttribute
, SLAP_AT_HIDE
,
741 NULL
, NULL
, NULL
, NULL
, NULL
,
742 offsetof(struct slap_internal_schema
, si_ad_subtreeSpecification
) },
744 /* subschema subentry attributes */
745 { "dITStructureRules", "( 2.5.21.1 NAME 'dITStructureRules' "
746 "DESC 'RFC4512: DIT structure rules' "
747 "EQUALITY integerFirstComponentMatch "
748 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
749 "USAGE directoryOperation ) ",
750 subentryAttribute
, SLAP_AT_HIDE
,
752 NULL
, NULL
, NULL
, NULL
, NULL
,
753 offsetof(struct slap_internal_schema
, si_ad_ditStructureRules
) },
754 { "dITContentRules", "( 2.5.21.2 NAME 'dITContentRules' "
755 "DESC 'RFC4512: DIT content rules' "
756 "EQUALITY objectIdentifierFirstComponentMatch "
757 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation )",
758 subentryAttribute
, SLAP_AT_HIDE
,
760 NULL
, NULL
, objectClassMatch
, NULL
, NULL
,
761 offsetof(struct slap_internal_schema
, si_ad_ditContentRules
) },
762 { "matchingRules", "( 2.5.21.4 NAME 'matchingRules' "
763 "DESC 'RFC4512: matching rules' "
764 "EQUALITY objectIdentifierFirstComponentMatch "
765 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.30 USAGE directoryOperation )",
766 subentryAttribute
, 0,
768 NULL
, NULL
, matchingRuleMatch
, NULL
, NULL
,
769 offsetof(struct slap_internal_schema
, si_ad_matchingRules
) },
770 { "attributeTypes", "( 2.5.21.5 NAME 'attributeTypes' "
771 "DESC 'RFC4512: attribute types' "
772 "EQUALITY objectIdentifierFirstComponentMatch "
773 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.3 USAGE directoryOperation )",
774 subentryAttribute
, 0,
776 NULL
, NULL
, attributeTypeMatch
, NULL
, NULL
,
777 offsetof(struct slap_internal_schema
, si_ad_attributeTypes
) },
778 { "objectClasses", "( 2.5.21.6 NAME 'objectClasses' "
779 "DESC 'RFC4512: object classes' "
780 "EQUALITY objectIdentifierFirstComponentMatch "
781 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.37 USAGE directoryOperation )",
782 subentryAttribute
, 0,
784 NULL
, NULL
, objectClassMatch
, NULL
, NULL
,
785 offsetof(struct slap_internal_schema
, si_ad_objectClasses
) },
786 { "nameForms", "( 2.5.21.7 NAME 'nameForms' "
787 "DESC 'RFC4512: name forms ' "
788 "EQUALITY objectIdentifierFirstComponentMatch "
789 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.35 USAGE directoryOperation )",
790 subentryAttribute
, SLAP_AT_HIDE
,
792 NULL
, NULL
, NULL
, NULL
, NULL
,
793 offsetof(struct slap_internal_schema
, si_ad_nameForms
) },
794 { "matchingRuleUse", "( 2.5.21.8 NAME 'matchingRuleUse' "
795 "DESC 'RFC4512: matching rule uses' "
796 "EQUALITY objectIdentifierFirstComponentMatch "
797 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.31 USAGE directoryOperation )",
798 subentryAttribute
, 0,
800 NULL
, NULL
, matchingRuleMatch
, NULL
, NULL
,
801 offsetof(struct slap_internal_schema
, si_ad_matchingRuleUse
) },
803 { "ldapSyntaxes", "( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes' "
804 "DESC 'RFC4512: LDAP syntaxes' "
805 "EQUALITY objectIdentifierFirstComponentMatch "
806 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.54 USAGE directoryOperation )",
807 subentryAttribute
, 0,
809 NULL
, NULL
, NULL
, NULL
, NULL
,
810 offsetof(struct slap_internal_schema
, si_ad_ldapSyntaxes
) },
812 /* knowledge information */
813 { "aliasedObjectName", "( 2.5.4.1 "
814 "NAME ( 'aliasedObjectName' 'aliasedEntryName' ) "
815 "DESC 'RFC4512: name of aliased object' "
816 "EQUALITY distinguishedNameMatch "
817 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )",
818 aliasAttribute
, SLAP_AT_FINAL
,
820 NULL
, NULL
, NULL
, NULL
, NULL
,
821 offsetof(struct slap_internal_schema
, si_ad_aliasedObjectName
) },
822 { "ref", "( 2.16.840.1.113730.3.1.34 NAME 'ref' "
823 "DESC 'RFC3296: subordinate referral URL' "
824 "EQUALITY caseExactMatch "
825 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
826 "USAGE distributedOperation )",
827 referralAttribute
, 0,
829 NULL
, NULL
, NULL
, NULL
, NULL
,
830 offsetof(struct slap_internal_schema
, si_ad_ref
) },
832 /* access control internals */
833 { "entry", "( 1.3.6.1.4.1.4203.1.3.1 "
835 "DESC 'OpenLDAP ACL entry pseudo-attribute' "
836 "SYNTAX 1.3.6.1.4.1.4203.1.1.1 "
837 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
840 NULL
, NULL
, NULL
, NULL
, NULL
,
841 offsetof(struct slap_internal_schema
, si_ad_entry
) },
842 { "children", "( 1.3.6.1.4.1.4203.1.3.2 "
844 "DESC 'OpenLDAP ACL children pseudo-attribute' "
845 "SYNTAX 1.3.6.1.4.1.4203.1.1.1 "
846 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
849 NULL
, NULL
, NULL
, NULL
, NULL
,
850 offsetof(struct slap_internal_schema
, si_ad_children
) },
852 /* access control externals */
853 { "authzTo", "( 1.3.6.1.4.1.4203.666.1.8 "
854 "NAME ( 'authzTo' 'saslAuthzTo' ) "
855 "DESC 'proxy authorization targets' "
856 "EQUALITY authzMatch "
857 "SYNTAX 1.3.6.1.4.1.4203.666.2.7 "
858 "X-ORDERED 'VALUES' "
859 "USAGE distributedOperation )",
862 NULL
, NULL
, NULL
, NULL
, NULL
,
863 offsetof(struct slap_internal_schema
, si_ad_saslAuthzTo
) },
864 { "authzFrom", "( 1.3.6.1.4.1.4203.666.1.9 "
865 "NAME ( 'authzFrom' 'saslAuthzFrom' ) "
866 "DESC 'proxy authorization sources' "
867 "EQUALITY authzMatch "
868 "SYNTAX 1.3.6.1.4.1.4203.666.2.7 "
869 "X-ORDERED 'VALUES' "
870 "USAGE distributedOperation )",
873 NULL
, NULL
, NULL
, NULL
, NULL
,
874 offsetof(struct slap_internal_schema
, si_ad_saslAuthzFrom
) },
876 #ifdef LDAP_DYNAMIC_OBJECTS
877 { "entryTtl", "( 1.3.6.1.4.1.1466.101.119.3 NAME 'entryTtl' "
878 "DESC 'RFC2589: entry time-to-live' "
879 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE "
880 "NO-USER-MODIFICATION USAGE dSAOperation )",
881 dynamicAttribute
, SLAP_AT_MANAGEABLE
,
883 NULL
, NULL
, NULL
, NULL
, NULL
,
884 offsetof(struct slap_internal_schema
, si_ad_entryTtl
) },
885 { "dynamicSubtrees", "( 1.3.6.1.4.1.1466.101.119.4 "
886 "NAME 'dynamicSubtrees' "
887 "DESC 'RFC2589: dynamic subtrees' "
888 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION "
889 "USAGE dSAOperation )",
892 NULL
, NULL
, NULL
, NULL
, NULL
,
893 offsetof(struct slap_internal_schema
, si_ad_dynamicSubtrees
) },
896 /* userApplication attributes (which system schema depends upon) */
897 { "distinguishedName", "( 2.5.4.49 NAME 'distinguishedName' "
898 "DESC 'RFC4519: common supertype of DN attributes' "
899 "EQUALITY distinguishedNameMatch "
900 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
901 NULL
, SLAP_AT_ABSTRACT
,
903 NULL
, NULL
, NULL
, NULL
, NULL
,
904 offsetof(struct slap_internal_schema
, si_ad_distinguishedName
) },
905 { "name", "( 2.5.4.41 NAME 'name' "
906 "DESC 'RFC4519: common supertype of name attributes' "
907 "EQUALITY caseIgnoreMatch "
908 "SUBSTR caseIgnoreSubstringsMatch "
909 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )",
910 NULL
, SLAP_AT_ABSTRACT
,
912 NULL
, NULL
, NULL
, NULL
, NULL
,
913 offsetof(struct slap_internal_schema
, si_ad_name
) },
914 { "cn", "( 2.5.4.3 NAME ( 'cn' 'commonName' ) "
915 "DESC 'RFC4519: common name(s) for which the entity is known by' "
919 NULL
, NULL
, NULL
, NULL
, NULL
,
920 offsetof(struct slap_internal_schema
, si_ad_cn
) },
921 { "uid", "( 0.9.2342.19200300.100.1.1 NAME ( 'uid' 'userid' ) "
922 "DESC 'RFC4519: user identifier' "
923 "EQUALITY caseIgnoreMatch "
924 "SUBSTR caseIgnoreSubstringsMatch "
925 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )",
928 NULL
, NULL
, NULL
, NULL
, NULL
,
929 offsetof(struct slap_internal_schema
, si_ad_uid
) },
930 { "uidNumber", /* for ldapi:// */
931 "( 1.3.6.1.1.1.1.0 NAME 'uidNumber' "
932 "DESC 'RFC2307: An integer uniquely identifying a user "
933 "in an administrative domain' "
934 "EQUALITY integerMatch "
935 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )",
938 NULL
, NULL
, NULL
, NULL
, NULL
,
939 offsetof(struct slap_internal_schema
, si_ad_uidNumber
) },
940 { "gidNumber", /* for ldapi:// */
941 "( 1.3.6.1.1.1.1.1 NAME 'gidNumber' "
942 "DESC 'RFC2307: An integer uniquely identifying a group "
943 "in an administrative domain' "
944 "EQUALITY integerMatch "
945 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )",
948 NULL
, NULL
, NULL
, NULL
, NULL
,
949 offsetof(struct slap_internal_schema
, si_ad_gidNumber
) },
950 { "userPassword", "( 2.5.4.35 NAME 'userPassword' "
951 "DESC 'RFC4519/2307: password of user' "
952 "EQUALITY octetStringMatch "
953 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )",
956 NULL
, NULL
, NULL
, NULL
, NULL
,
957 offsetof(struct slap_internal_schema
, si_ad_userPassword
) },
959 { "labeledURI", "( 1.3.6.1.4.1.250.1.57 NAME 'labeledURI' "
960 "DESC 'RFC2079: Uniform Resource Identifier with optional label' "
961 "EQUALITY caseExactMatch "
962 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
965 NULL
, NULL
, NULL
, NULL
, NULL
,
966 offsetof(struct slap_internal_schema
, si_ad_labeledURI
) },
968 #ifdef SLAPD_AUTHPASSWD
969 { "authPassword", "( 1.3.6.1.4.1.4203.1.3.4 "
970 "NAME 'authPassword' "
971 "DESC 'RFC3112: authentication password attribute' "
972 "EQUALITY 1.3.6.1.4.1.4203.1.2.2 "
973 "SYNTAX 1.3.6.1.4.1.4203.1.1.2 )",
976 NULL
, NULL
, NULL
, NULL
, NULL
,
977 offsetof(struct slap_internal_schema
, si_ad_authPassword
) },
978 { "supportedAuthPasswordSchemes", "( 1.3.6.1.4.1.4203.1.3.3 "
979 "NAME 'supportedAuthPasswordSchemes' "
980 "DESC 'RFC3112: supported authPassword schemes' "
981 "EQUALITY caseExactIA5Match "
982 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} "
983 "USAGE dSAOperation )",
984 subschemaAttribute
, 0,
986 NULL
, NULL
, NULL
, NULL
, NULL
,
987 offsetof(struct slap_internal_schema
, si_ad_authPasswordSchemes
) },
990 { "description", "( 2.5.4.13 NAME 'description' "
991 "DESC 'RFC4519: descriptive information' "
992 "EQUALITY caseIgnoreMatch "
993 "SUBSTR caseIgnoreSubstringsMatch "
994 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )",
997 NULL
, NULL
, NULL
, NULL
, NULL
,
998 offsetof(struct slap_internal_schema
, si_ad_description
) },
1000 { "seeAlso", "( 2.5.4.34 NAME 'seeAlso' "
1001 "DESC 'RFC4519: DN of related object' "
1002 "SUP distinguishedName )",
1005 NULL
, NULL
, NULL
, NULL
, NULL
,
1006 offsetof(struct slap_internal_schema
, si_ad_seeAlso
) },
1008 { NULL
, NULL
, NULL
, 0, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, 0 }
1011 static AttributeType slap_at_undefined
= {
1012 { "1.1.1", NULL
, "Catchall for undefined attribute types", 1, NULL
,
1013 NULL
, NULL
, NULL
, NULL
,
1014 0, 0, 0, 1, LDAP_SCHEMA_DSA_OPERATION
, NULL
}, /* LDAPAttributeType */
1015 BER_BVC("UNDEFINED"), /* cname */
1017 NULL
, /* subtypes */
1018 NULL
, NULL
, NULL
, NULL
, /* matching rules routines */
1019 NULL
, /* syntax (will be set later to "octetString") */
1020 NULL
, /* schema check function */
1021 NULL
, /* oidmacro */
1022 NULL
, /* soidmacro */
1023 SLAP_AT_ABSTRACT
|SLAP_AT_FINAL
, /* mask */
1024 { NULL
}, /* next */
1025 NULL
/* attribute description */
1026 /* mutex (don't know how to initialize it :) */
1029 static AttributeType slap_at_proxied
= {
1030 { "1.1.1", NULL
, "Catchall for undefined proxied attribute types", 1, NULL
,
1031 NULL
, NULL
, NULL
, NULL
,
1032 0, 0, 0, 0, LDAP_SCHEMA_USER_APPLICATIONS
, NULL
}, /* LDAPAttributeType */
1033 BER_BVC("PROXIED"), /* cname */
1035 NULL
, /* subtypes */
1036 NULL
, NULL
, NULL
, NULL
, /* matching rules routines (will be set later) */
1037 NULL
, /* syntax (will be set later to "octetString") */
1038 NULL
, /* schema check function */
1039 NULL
, /* oidmacro */
1040 NULL
, /* soidmacro */
1041 SLAP_AT_ABSTRACT
|SLAP_AT_FINAL
, /* mask */
1042 { NULL
}, /* next */
1043 NULL
/* attribute description */
1044 /* mutex (don't know how to initialize it :) */
1047 static struct slap_schema_mr_map
{
1051 { "caseExactIA5Match",
1052 offsetof(struct slap_internal_schema
, si_mr_caseExactIA5Match
) },
1054 offsetof(struct slap_internal_schema
, si_mr_caseExactMatch
) },
1055 { "caseExactSubstringsMatch",
1056 offsetof(struct slap_internal_schema
, si_mr_caseExactSubstringsMatch
) },
1057 { "distinguishedNameMatch",
1058 offsetof(struct slap_internal_schema
, si_mr_distinguishedNameMatch
) },
1060 offsetof(struct slap_internal_schema
, si_mr_dnSubtreeMatch
) },
1061 { "dnOneLevelMatch",
1062 offsetof(struct slap_internal_schema
, si_mr_dnOneLevelMatch
) },
1063 { "dnSubordinateMatch",
1064 offsetof(struct slap_internal_schema
, si_mr_dnSubordinateMatch
) },
1065 { "dnSuperiorMatch",
1066 offsetof(struct slap_internal_schema
, si_mr_dnSuperiorMatch
) },
1068 offsetof(struct slap_internal_schema
, si_mr_integerMatch
) },
1069 { "integerFirstComponentMatch",
1070 offsetof(struct slap_internal_schema
,
1071 si_mr_integerFirstComponentMatch
) },
1072 { "objectIdentifierFirstComponentMatch",
1073 offsetof(struct slap_internal_schema
,
1074 si_mr_objectIdentifierFirstComponentMatch
) },
1078 static struct slap_schema_syn_map
{
1082 { "1.3.6.1.4.1.1466.115.121.1.15",
1083 offsetof(struct slap_internal_schema
, si_syn_directoryString
) },
1084 { "1.3.6.1.4.1.1466.115.121.1.12",
1085 offsetof(struct slap_internal_schema
, si_syn_distinguishedName
) },
1086 { "1.3.6.1.4.1.1466.115.121.1.27",
1087 offsetof(struct slap_internal_schema
, si_syn_integer
) },
1088 { "1.3.6.1.4.1.1466.115.121.1.40",
1089 offsetof(struct slap_internal_schema
, si_syn_octetString
) },
1090 { "1.3.6.1.4.1.1466.115.121.1.3",
1091 offsetof(struct slap_internal_schema
, si_syn_attributeTypeDesc
) },
1092 { "1.3.6.1.4.1.1466.115.121.1.16",
1093 offsetof(struct slap_internal_schema
, si_syn_ditContentRuleDesc
) },
1094 { "1.3.6.1.4.1.1466.115.121.1.54",
1095 offsetof(struct slap_internal_schema
, si_syn_ldapSyntaxDesc
) },
1096 { "1.3.6.1.4.1.1466.115.121.1.30",
1097 offsetof(struct slap_internal_schema
, si_syn_matchingRuleDesc
) },
1098 { "1.3.6.1.4.1.1466.115.121.1.31",
1099 offsetof(struct slap_internal_schema
, si_syn_matchingRuleUseDesc
) },
1100 { "1.3.6.1.4.1.1466.115.121.1.35",
1101 offsetof(struct slap_internal_schema
, si_syn_nameFormDesc
) },
1102 { "1.3.6.1.4.1.1466.115.121.1.37",
1103 offsetof(struct slap_internal_schema
, si_syn_objectClassDesc
) },
1104 { "1.3.6.1.4.1.1466.115.121.1.17",
1105 offsetof(struct slap_internal_schema
, si_syn_ditStructureRuleDesc
) },
1110 slap_schema_load( void )
1114 for( i
=0; syn_map
[i
].sssm_name
; i
++ ) {
1115 Syntax
** synp
= (Syntax
**)
1116 &(((char *) &slap_schema
)[syn_map
[i
].sssm_offset
]);
1118 assert( *synp
== NULL
);
1120 *synp
= syn_find( syn_map
[i
].sssm_name
);
1122 if( *synp
== NULL
) {
1123 fprintf( stderr
, "slap_schema_load: Syntax: "
1124 "No syntax \"%s\" defined in schema\n",
1125 syn_map
[i
].sssm_name
);
1126 return LDAP_INVALID_SYNTAX
;
1130 for( i
=0; mr_map
[i
].ssmm_name
; i
++ ) {
1131 MatchingRule
** mrp
= (MatchingRule
**)
1132 &(((char *) &slap_schema
)[mr_map
[i
].ssmm_offset
]);
1134 assert( *mrp
== NULL
);
1136 *mrp
= mr_find( mr_map
[i
].ssmm_name
);
1138 if( *mrp
== NULL
) {
1139 fprintf( stderr
, "slap_schema_load: MatchingRule: "
1140 "No matching rule \"%s\" defined in schema\n",
1141 mr_map
[i
].ssmm_name
);
1142 return LDAP_INAPPROPRIATE_MATCHING
;
1146 slap_at_undefined
.sat_syntax
= slap_schema
.si_syn_octetString
;
1147 slap_schema
.si_at_undefined
= &slap_at_undefined
;
1149 slap_at_proxied
.sat_equality
= mr_find( "octetStringMatch" );
1150 slap_at_proxied
.sat_approx
= mr_find( "octetStringMatch" );
1151 slap_at_proxied
.sat_ordering
= mr_find( "octetStringOrderingMatch" );
1152 slap_at_proxied
.sat_substr
= mr_find( "octetStringSubstringsMatch" );
1153 slap_at_proxied
.sat_syntax
= slap_schema
.si_syn_octetString
;
1154 slap_schema
.si_at_proxied
= &slap_at_proxied
;
1156 ldap_pvt_thread_mutex_init( &ad_undef_mutex
);
1157 ldap_pvt_thread_mutex_init( &oc_undef_mutex
);
1159 for( i
=0; ad_map
[i
].ssam_name
; i
++ ) {
1160 assert( ad_map
[i
].ssam_defn
!= NULL
);
1162 LDAPAttributeType
*at
;
1166 at
= ldap_str2attributetype( ad_map
[i
].ssam_defn
,
1167 &code
, &err
, LDAP_SCHEMA_ALLOW_ALL
);
1170 "slap_schema_load: AttributeType \"%s\": %s before %s\n",
1171 ad_map
[i
].ssam_name
, ldap_scherr2str(code
), err
);
1175 if ( at
->at_oid
== NULL
) {
1176 fprintf( stderr
, "slap_schema_load: "
1177 "AttributeType \"%s\": no OID\n",
1178 ad_map
[i
].ssam_name
);
1179 ldap_attributetype_free( at
);
1183 code
= at_add( at
, 0, NULL
, NULL
, &err
);
1185 ldap_attributetype_free( at
);
1186 fprintf( stderr
, "slap_schema_load: AttributeType "
1187 "\"%s\": %s: \"%s\"\n",
1188 ad_map
[i
].ssam_name
, scherr2str(code
), err
);
1196 Syntax
*syntax
= NULL
;
1198 AttributeDescription
** adp
= (AttributeDescription
**)
1199 &(((char *) &slap_schema
)[ad_map
[i
].ssam_offset
]);
1201 assert( *adp
== NULL
);
1203 rc
= slap_str2ad( ad_map
[i
].ssam_name
, adp
, &text
);
1204 if( rc
!= LDAP_SUCCESS
) {
1205 fprintf( stderr
, "slap_schema_load: AttributeType \"%s\": "
1206 "not defined in schema\n",
1207 ad_map
[i
].ssam_name
);
1211 if( ad_map
[i
].ssam_check
) {
1212 /* install check routine */
1213 (*adp
)->ad_type
->sat_check
= ad_map
[i
].ssam_check
;
1216 (*adp
)->ad_type
->sat_flags
|= ad_map
[i
].ssam_flags
;
1218 /* install custom syntax routines */
1219 if( ad_map
[i
].ssam_syn_validate
||
1220 ad_map
[i
].ssam_syn_pretty
)
1224 syntax
= (*adp
)->ad_type
->sat_syntax
;
1226 syn
= ch_malloc( sizeof( Syntax
) );
1229 if( ad_map
[i
].ssam_syn_validate
) {
1230 syn
->ssyn_validate
= ad_map
[i
].ssam_syn_validate
;
1232 if( ad_map
[i
].ssam_syn_pretty
) {
1233 syn
->ssyn_pretty
= ad_map
[i
].ssam_syn_pretty
;
1236 (*adp
)->ad_type
->sat_syntax
= syn
;
1239 /* install custom rule routines */
1240 if( syntax
!= NULL
||
1241 ad_map
[i
].ssam_mr_convert
||
1242 ad_map
[i
].ssam_mr_normalize
||
1243 ad_map
[i
].ssam_mr_match
||
1244 ad_map
[i
].ssam_mr_indexer
||
1245 ad_map
[i
].ssam_mr_filter
)
1247 MatchingRule
*mr
= ch_malloc( sizeof( MatchingRule
) );
1248 *mr
= *(*adp
)->ad_type
->sat_equality
;
1250 if ( syntax
!= NULL
) {
1251 mr
->smr_syntax
= (*adp
)->ad_type
->sat_syntax
;
1253 if ( ad_map
[i
].ssam_mr_convert
) {
1254 mr
->smr_convert
= ad_map
[i
].ssam_mr_convert
;
1256 if ( ad_map
[i
].ssam_mr_normalize
) {
1257 mr
->smr_normalize
= ad_map
[i
].ssam_mr_normalize
;
1259 if ( ad_map
[i
].ssam_mr_match
) {
1260 mr
->smr_match
= ad_map
[i
].ssam_mr_match
;
1262 if ( ad_map
[i
].ssam_mr_indexer
) {
1263 mr
->smr_indexer
= ad_map
[i
].ssam_mr_indexer
;
1265 if ( ad_map
[i
].ssam_mr_filter
) {
1266 mr
->smr_filter
= ad_map
[i
].ssam_mr_filter
;
1269 /* FIXME: no-one will free this at exit */
1270 (*adp
)->ad_type
->sat_equality
= mr
;
1275 for( i
=0; oc_map
[i
].ssom_name
; i
++ ) {
1276 assert( oc_map
[i
].ssom_defn
!= NULL
);
1278 LDAPObjectClass
*oc
;
1282 oc
= ldap_str2objectclass( oc_map
[i
].ssom_defn
, &code
, &err
,
1283 LDAP_SCHEMA_ALLOW_ALL
);
1285 fprintf( stderr
, "slap_schema_load: ObjectClass "
1286 "\"%s\": %s before %s\n",
1287 oc_map
[i
].ssom_name
, ldap_scherr2str(code
), err
);
1291 if ( oc
->oc_oid
== NULL
) {
1292 fprintf( stderr
, "slap_schema_load: ObjectClass "
1294 oc_map
[i
].ssom_name
);
1295 ldap_objectclass_free( oc
);
1299 code
= oc_add(oc
,0,NULL
,NULL
,&err
);
1301 ldap_objectclass_free( oc
);
1302 fprintf( stderr
, "slap_schema_load: ObjectClass "
1303 "\"%s\": %s: \"%s\"\n",
1304 oc_map
[i
].ssom_name
, scherr2str(code
), err
);
1311 ObjectClass
** ocp
= (ObjectClass
**)
1312 &(((char *) &slap_schema
)[oc_map
[i
].ssom_offset
]);
1314 assert( *ocp
== NULL
);
1316 *ocp
= oc_find( oc_map
[i
].ssom_name
);
1317 if( *ocp
== NULL
) {
1318 fprintf( stderr
, "slap_schema_load: "
1319 "ObjectClass \"%s\": not defined in schema\n",
1320 oc_map
[i
].ssom_name
);
1321 return LDAP_OBJECT_CLASS_VIOLATION
;
1324 if( oc_map
[i
].ssom_check
) {
1325 /* install check routine */
1326 (*ocp
)->soc_check
= oc_map
[i
].ssom_check
;
1329 (*ocp
)->soc_flags
|= oc_map
[i
].ssom_flags
;
1333 return LDAP_SUCCESS
;
1337 slap_schema_check( void )
1339 /* we should only be called once after schema_init() was called */
1340 assert( schema_init_done
== 1 );
1343 * cycle thru attributeTypes to build matchingRuleUse
1345 if ( matching_rule_use_init() ) {
1350 return LDAP_SUCCESS
;
1353 static int rootDseObjectClass (
1358 char *textbuf
, size_t textlen
)
1362 if( e
->e_nname
.bv_len
) {
1363 snprintf( textbuf
, textlen
,
1364 "objectClass \"%s\" only allowed in the root DSE",
1366 return LDAP_OBJECT_CLASS_VIOLATION
;
1369 /* we should not be called for the root DSE */
1371 return LDAP_SUCCESS
;
1374 static int aliasObjectClass (
1379 char *textbuf
, size_t textlen
)
1383 if( !SLAP_ALIASES(be
) ) {
1384 snprintf( textbuf
, textlen
,
1385 "objectClass \"%s\" not supported in context",
1387 return LDAP_OBJECT_CLASS_VIOLATION
;
1390 return LDAP_SUCCESS
;
1393 static int referralObjectClass (
1398 char *textbuf
, size_t textlen
)
1402 if( !SLAP_REFERRALS(be
) ) {
1403 snprintf( textbuf
, textlen
,
1404 "objectClass \"%s\" not supported in context",
1406 return LDAP_OBJECT_CLASS_VIOLATION
;
1409 return LDAP_SUCCESS
;
1412 static int subentryObjectClass (
1417 char *textbuf
, size_t textlen
)
1421 if( !SLAP_SUBENTRIES(be
) ) {
1422 snprintf( textbuf
, textlen
,
1423 "objectClass \"%s\" not supported in context",
1425 return LDAP_OBJECT_CLASS_VIOLATION
;
1428 if( oc
!= slap_schema
.si_oc_subentry
&& !is_entry_subentry( e
) ) {
1429 snprintf( textbuf
, textlen
,
1430 "objectClass \"%s\" only allowed in subentries",
1432 return LDAP_OBJECT_CLASS_VIOLATION
;
1435 return LDAP_SUCCESS
;
1438 #ifdef LDAP_DYNAMIC_OBJECTS
1439 static int dynamicObjectClass (
1444 char *textbuf
, size_t textlen
)
1448 if( !SLAP_DYNAMIC(be
) ) {
1449 snprintf( textbuf
, textlen
,
1450 "objectClass \"%s\" not supported in context",
1452 return LDAP_OBJECT_CLASS_VIOLATION
;
1455 return LDAP_SUCCESS
;
1457 #endif /* LDAP_DYNAMIC_OBJECTS */
1459 static int rootDseAttribute (
1464 char *textbuf
, size_t textlen
)
1468 if( e
->e_nname
.bv_len
) {
1469 snprintf( textbuf
, textlen
,
1470 "attribute \"%s\" only allowed in the root DSE",
1471 attr
->a_desc
->ad_cname
.bv_val
);
1472 return LDAP_OBJECT_CLASS_VIOLATION
;
1475 /* we should not be called for the root DSE */
1477 return LDAP_SUCCESS
;
1480 static int aliasAttribute (
1485 char *textbuf
, size_t textlen
)
1489 if( !SLAP_ALIASES(be
) ) {
1490 snprintf( textbuf
, textlen
,
1491 "attribute \"%s\" not supported in context",
1492 attr
->a_desc
->ad_cname
.bv_val
);
1493 return LDAP_OBJECT_CLASS_VIOLATION
;
1496 if( !is_entry_alias( e
) ) {
1497 snprintf( textbuf
, textlen
,
1498 "attribute \"%s\" only allowed in the alias",
1499 attr
->a_desc
->ad_cname
.bv_val
);
1500 return LDAP_OBJECT_CLASS_VIOLATION
;
1503 return LDAP_SUCCESS
;
1506 static int referralAttribute (
1511 char *textbuf
, size_t textlen
)
1515 if( !SLAP_REFERRALS(be
) ) {
1516 snprintf( textbuf
, textlen
,
1517 "attribute \"%s\" not supported in context",
1518 attr
->a_desc
->ad_cname
.bv_val
);
1519 return LDAP_OBJECT_CLASS_VIOLATION
;
1522 if( !is_entry_referral( e
) ) {
1523 snprintf( textbuf
, textlen
,
1524 "attribute \"%s\" only allowed in the referral",
1525 attr
->a_desc
->ad_cname
.bv_val
);
1526 return LDAP_OBJECT_CLASS_VIOLATION
;
1529 return LDAP_SUCCESS
;
1532 static int subentryAttribute (
1537 char *textbuf
, size_t textlen
)
1541 if( !SLAP_SUBENTRIES(be
) ) {
1542 snprintf( textbuf
, textlen
,
1543 "attribute \"%s\" not supported in context",
1544 attr
->a_desc
->ad_cname
.bv_val
);
1545 return LDAP_OBJECT_CLASS_VIOLATION
;
1548 if( !is_entry_subentry( e
) ) {
1549 snprintf( textbuf
, textlen
,
1550 "attribute \"%s\" only allowed in the subentry",
1551 attr
->a_desc
->ad_cname
.bv_val
);
1552 return LDAP_OBJECT_CLASS_VIOLATION
;
1555 return LDAP_SUCCESS
;
1558 static int administrativeRoleAttribute (
1563 char *textbuf
, size_t textlen
)
1567 if( !SLAP_SUBENTRIES(be
) ) {
1568 snprintf( textbuf
, textlen
,
1569 "attribute \"%s\" not supported in context",
1570 attr
->a_desc
->ad_cname
.bv_val
);
1571 return LDAP_OBJECT_CLASS_VIOLATION
;
1574 snprintf( textbuf
, textlen
,
1575 "attribute \"%s\" not supported!",
1576 attr
->a_desc
->ad_cname
.bv_val
);
1577 return LDAP_OBJECT_CLASS_VIOLATION
;
1580 #ifdef LDAP_DYNAMIC_OBJECTS
1581 static int dynamicAttribute (
1586 char *textbuf
, size_t textlen
)
1590 if( !SLAP_DYNAMIC(be
) ) {
1591 snprintf( textbuf
, textlen
,
1592 "attribute \"%s\" not supported in context",
1593 attr
->a_desc
->ad_cname
.bv_val
);
1594 return LDAP_OBJECT_CLASS_VIOLATION
;
1597 if( !is_entry_dynamicObject( e
) ) {
1598 snprintf( textbuf
, textlen
,
1599 "attribute \"%s\" only allowed in dynamic object",
1600 attr
->a_desc
->ad_cname
.bv_val
);
1601 return LDAP_OBJECT_CLASS_VIOLATION
;
1604 return LDAP_SUCCESS
;
1606 #endif /* LDAP_DYNAMIC_OBJECTS */