1 /* schema_prep.c - load builtin schema */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2004 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>
27 #include "ldap_pvt_uc.h"
31 int schema_init_done = 0;
33 struct slap_internal_schema slap_schema;
35 static int objectClassPretty(
36 struct slap_syntax *syntax,
41 ObjectClass *oc = oc_bvfind( in );
44 ber_dupbv_x( out, &oc->soc_cname, ctx );
46 ber_dupbv_x( out, in, ctx );
61 struct berval *a = (struct berval *) assertedValue;
62 ObjectClass *oc = oc_bvfind( value );
63 ObjectClass *asserted = oc_bvfind( a );
65 if( asserted == NULL ) {
66 if( OID_LEADCHAR( *a->bv_val ) ) {
67 /* OID form, return FALSE */
72 /* desc form, return undefined */
73 return SLAPD_COMPARE_UNDEFINED;
77 /* unrecognized stored value */
78 return SLAPD_COMPARE_UNDEFINED;
81 if( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( flags ) ) {
82 *matchp = ( asserted != oc );
84 *matchp = !is_object_subclass( asserted, oc );
90 static int objectSubClassIndexer(
93 struct slap_syntax *syntax,
94 struct slap_matching_rule *mr,
95 struct berval *prefix,
103 for( noc=0; values[noc].bv_val != NULL; noc++ ) {
108 ocvalues = sl_malloc( sizeof( struct berval ) * (noc+16), ctx );
110 /* copy listed values (and termination) */
111 for( i=0; i<noc; i++ ) {
112 ObjectClass *oc = oc_bvfind( &values[i] );
114 ocvalues[i] = oc->soc_cname;
116 ocvalues[i] = values[i];
120 ocvalues[i].bv_val = NULL;
121 ocvalues[i].bv_len = 0;
124 for( i=0; i<noc; i++ ) {
126 ObjectClass *oc = oc_bvfind( &ocvalues[i] );
127 if( oc == NULL || oc->soc_sups == NULL ) continue;
129 for( j=0; oc->soc_sups[j] != NULL; j++ ) {
131 ObjectClass *sup = oc->soc_sups[j];
134 for( k=0; k<noc; k++ ) {
135 if( bvmatch( &ocvalues[k], &sup->soc_cname ) ) {
142 ocvalues = sl_realloc( ocvalues,
143 sizeof( struct berval ) * (noc+2), ctx );
147 ocvalues[noc] = sup->soc_cname;
149 assert( ocvalues[noc].bv_val );
150 assert( ocvalues[noc].bv_len );
154 ocvalues[noc].bv_len = 0;
155 ocvalues[noc].bv_val = NULL;
160 rc = octetStringIndexer( use, mask, syntax, mr,
161 prefix, ocvalues, keysp, ctx );
163 sl_free( ocvalues, ctx );
167 #define objectSubClassFilter octetStringFilter
169 static ObjectClassSchemaCheckFN rootDseObjectClass;
170 static ObjectClassSchemaCheckFN aliasObjectClass;
171 static ObjectClassSchemaCheckFN referralObjectClass;
172 static ObjectClassSchemaCheckFN subentryObjectClass;
173 static ObjectClassSchemaCheckFN dynamicObjectClass;
175 static struct slap_schema_oc_map {
178 ObjectClassSchemaCheckFN *ssom_check;
179 slap_mask_t ssom_flags;
182 { "top", "( 2.5.6.0 NAME 'top' "
183 "DESC 'top of the superclass chain' "
184 "ABSTRACT MUST objectClass )",
185 0, 0, offsetof(struct slap_internal_schema, si_oc_top) },
186 { "extensibleObject", "( 1.3.6.1.4.1.1466.101.120.111 "
187 "NAME 'extensibleObject' "
188 "DESC 'RFC2252: extensible object' "
189 "SUP top AUXILIARY )",
190 0, SLAP_OC_OPERATIONAL,
191 offsetof(struct slap_internal_schema, si_oc_extensibleObject) },
192 { "alias", "( 2.5.6.1 NAME 'alias' "
193 "DESC 'RFC2256: an alias' "
194 "SUP top STRUCTURAL "
195 "MUST aliasedObjectName )",
196 aliasObjectClass, SLAP_OC_ALIAS|SLAP_OC_OPERATIONAL,
197 offsetof(struct slap_internal_schema, si_oc_alias) },
198 { "referral", "( 2.16.840.1.113730.3.2.6 NAME 'referral' "
199 "DESC 'namedref: named subordinate referral' "
200 "SUP top STRUCTURAL MUST ref )",
201 referralObjectClass, SLAP_OC_REFERRAL|SLAP_OC_OPERATIONAL,
202 offsetof(struct slap_internal_schema, si_oc_referral) },
203 { "LDAProotDSE", "( 1.3.6.1.4.1.4203.1.4.1 "
204 "NAME ( 'OpenLDAProotDSE' 'LDAProotDSE' ) "
205 "DESC 'OpenLDAP Root DSE object' "
206 "SUP top STRUCTURAL MAY cn )",
207 rootDseObjectClass, SLAP_OC_OPERATIONAL,
208 offsetof(struct slap_internal_schema, si_oc_rootdse) },
209 { "subentry", "( 2.5.17.0 NAME 'subentry' "
210 "SUP top STRUCTURAL "
211 "MUST ( cn $ subtreeSpecification ) )",
212 subentryObjectClass, SLAP_OC_SUBENTRY|SLAP_OC_OPERATIONAL,
213 offsetof(struct slap_internal_schema, si_oc_subentry) },
214 { "subschema", "( 2.5.20.1 NAME 'subschema' "
215 "DESC 'RFC2252: controlling subschema (sub)entry' "
217 "MAY ( dITStructureRules $ nameForms $ ditContentRules $ "
218 "objectClasses $ attributeTypes $ matchingRules $ "
219 "matchingRuleUse ) )",
220 subentryObjectClass, SLAP_OC_OPERATIONAL,
221 offsetof(struct slap_internal_schema, si_oc_subschema) },
223 { "collectiveAttributeSubentry", "( 2.5.17.2 "
224 "NAME 'collectiveAttributeSubentry' "
227 SLAP_OC_COLLECTIVEATTRIBUTESUBENTRY|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
228 offsetof(struct slap_internal_schema, si_oc_collectiveAttributeSubentry) },
229 { "dynamicObject", "( 1.3.6.1.4.1.1466.101.119.2 "
230 "NAME 'dynamicObject' "
231 "DESC 'RFC2589: Dynamic Object' "
232 "SUP top AUXILIARY )",
233 dynamicObjectClass, SLAP_OC_DYNAMICOBJECT,
234 offsetof(struct slap_internal_schema, si_oc_dynamicObject) },
236 { "glue", "( 1.3.6.1.4.1.4203.666.3.4 "
239 "SUP top STRUCTURAL )",
240 0, SLAP_OC_GLUE|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
241 offsetof(struct slap_internal_schema, si_oc_glue) },
242 { "syncConsumerSubentry", "( 1.3.6.1.4.1.4203.666.3.5 "
243 "NAME 'syncConsumerSubentry' "
244 "DESC 'Persistent Info for SyncRepl Consumer' "
246 "MAY syncreplCookie )",
247 0, SLAP_OC_SYNCCONSUMERSUBENTRY|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
248 offsetof(struct slap_internal_schema, si_oc_syncConsumerSubentry) },
249 { "syncProviderSubentry", "( 1.3.6.1.4.1.4203.666.3.6 "
250 "NAME 'syncProviderSubentry' "
251 "DESC 'Persistent Info for SyncRepl Producer' "
254 0, SLAP_OC_SYNCPROVIDERSUBENTRY|SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
255 offsetof(struct slap_internal_schema, si_oc_syncProviderSubentry) },
257 { NULL, NULL, NULL, 0, 0 }
260 static AttributeTypeSchemaCheckFN rootDseAttribute;
261 static AttributeTypeSchemaCheckFN aliasAttribute;
262 static AttributeTypeSchemaCheckFN referralAttribute;
263 static AttributeTypeSchemaCheckFN subentryAttribute;
264 static AttributeTypeSchemaCheckFN administrativeRoleAttribute;
265 static AttributeTypeSchemaCheckFN dynamicAttribute;
267 static struct slap_schema_ad_map {
270 AttributeTypeSchemaCheckFN *ssam_check;
271 slap_mask_t ssam_flags;
272 slap_syntax_validate_func *ssam_syn_validate;
273 slap_syntax_transform_func *ssam_syn_pretty;
274 slap_mr_convert_func *ssam_mr_convert;
275 slap_mr_normalize_func *ssam_mr_normalize;
276 slap_mr_match_func *ssam_mr_match;
277 slap_mr_indexer_func *ssam_mr_indexer;
278 slap_mr_filter_func *ssam_mr_filter;
281 { "objectClass", "( 2.5.4.0 NAME 'objectClass' "
282 "DESC 'RFC2256: object classes of the entity' "
283 "EQUALITY objectIdentifierMatch "
284 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
286 NULL, objectClassPretty,
287 NULL, NULL, objectSubClassMatch,
288 objectSubClassIndexer, objectSubClassFilter,
289 offsetof(struct slap_internal_schema, si_ad_objectClass) },
291 /* user entry operational attributes */
292 { "structuralObjectClass", "( 2.5.21.9 NAME 'structuralObjectClass' "
293 "DESC 'X.500(93): structural object class of entry' "
294 "EQUALITY objectIdentifierMatch "
295 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
296 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
298 NULL, objectClassPretty,
299 NULL, NULL, objectSubClassMatch,
300 objectSubClassIndexer, objectSubClassFilter,
301 offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) },
302 { "createTimestamp", "( 2.5.18.1 NAME 'createTimestamp' "
303 "DESC 'RFC2252: time which object was created' "
304 "EQUALITY generalizedTimeMatch "
305 "ORDERING generalizedTimeOrderingMatch "
306 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 "
307 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
310 NULL, NULL, NULL, NULL, NULL,
311 offsetof(struct slap_internal_schema, si_ad_createTimestamp) },
312 { "modifyTimestamp", "( 2.5.18.2 NAME 'modifyTimestamp' "
313 "DESC 'RFC2252: time which object was last modified' "
314 "EQUALITY generalizedTimeMatch "
315 "ORDERING generalizedTimeOrderingMatch "
316 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 "
317 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
320 NULL, NULL, NULL, NULL, NULL,
321 offsetof(struct slap_internal_schema, si_ad_modifyTimestamp) },
322 { "creatorsName", "( 2.5.18.3 NAME 'creatorsName' "
323 "DESC 'RFC2252: name of creator' "
324 "EQUALITY distinguishedNameMatch "
325 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
326 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
329 NULL, NULL, NULL, NULL, NULL,
330 offsetof(struct slap_internal_schema, si_ad_creatorsName) },
331 { "modifiersName", "( 2.5.18.4 NAME 'modifiersName' "
332 "DESC 'RFC2252: name of last modifier' "
333 "EQUALITY distinguishedNameMatch "
334 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
335 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
338 NULL, NULL, NULL, NULL, NULL,
339 offsetof(struct slap_internal_schema, si_ad_modifiersName) },
340 { "hasSubordinates", "( 2.5.18.9 NAME 'hasSubordinates' "
341 "DESC 'X.501: entry has children' "
342 "EQUALITY booleanMatch "
343 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 "
344 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
347 NULL, NULL, NULL, NULL, NULL,
348 offsetof(struct slap_internal_schema, si_ad_hasSubordinates) },
349 { "subschemaSubentry", "( 2.5.18.10 NAME 'subschemaSubentry' "
350 "DESC 'RFC2252: name of controlling subschema entry' "
351 "EQUALITY distinguishedNameMatch "
352 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE "
353 "NO-USER-MODIFICATION USAGE directoryOperation )",
356 NULL, NULL, NULL, NULL, NULL,
357 offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) },
359 { "collectiveAttributeSubentries", "( 2.5.18.12 "
360 "NAME 'collectiveAttributeSubentries' "
361 "EQUALITY distinguishedNameMatch "
362 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
363 "NO-USER-MODIFICATION USAGE directoryOperation )",
366 NULL, NULL, NULL, NULL, NULL,
367 offsetof(struct slap_internal_schema, si_ad_collectiveSubentries) },
368 { "collectiveExclusions", "( 2.5.18.7 NAME 'collectiveExclusions' "
369 "EQUALITY objectIdentifierMatch "
370 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
371 "USAGE directoryOperation )",
374 NULL, NULL, NULL, NULL, NULL,
375 offsetof(struct slap_internal_schema, si_ad_collectiveExclusions) },
378 { "entryUUID", "( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID' "
379 "DESC 'UUID of the entry' "
380 "EQUALITY UUIDMatch "
381 "ORDERING UUIDOrderingMatch "
382 "SYNTAX 1.3.6.1.4.1.4203.666.2.6 "
383 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
386 NULL, NULL, NULL, NULL, NULL,
387 offsetof(struct slap_internal_schema, si_ad_entryUUID) },
388 { "entryCSN", "( 1.3.6.1.4.1.4203.666.1.7 NAME 'entryCSN' "
389 "DESC 'change sequence number of the entry content' "
390 "EQUALITY octetStringMatch "
391 "ORDERING octetStringOrderingMatch "
392 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} "
393 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
396 NULL, NULL, NULL, NULL, NULL,
397 offsetof(struct slap_internal_schema, si_ad_entryCSN) },
398 { "namingCSN", "( 1.3.6.1.4.1.4203.666.1.13 NAME 'namingCSN' "
399 "DESC 'change sequence number of the entry naming (RDN)' "
400 "EQUALITY octetStringMatch "
401 "ORDERING octetStringOrderingMatch "
402 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} "
403 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
406 NULL, NULL, NULL, NULL, NULL,
407 offsetof(struct slap_internal_schema, si_ad_namingCSN) },
409 { "superiorUUID", "( 1.3.6.1.4.1.4203.666.1.11 NAME 'superiorUUID' "
410 "DESC 'UUID of the superior entry' "
411 "EQUALITY octetStringMatch "
412 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} "
413 "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
416 NULL, NULL, NULL, NULL, NULL,
417 offsetof(struct slap_internal_schema, si_ad_superiorUUID) },
419 { "syncreplCookie", "( 1.3.6.1.4.1.4203.666.1.23 "
420 "NAME 'syncreplCookie' "
421 "DESC 'syncrepl Cookie for shadow copy' "
422 "EQUALITY octetStringMatch "
423 "ORDERING octetStringOrderingMatch "
424 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 "
425 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
428 NULL, NULL, NULL, NULL, NULL,
429 offsetof(struct slap_internal_schema, si_ad_syncreplCookie) },
431 { "contextCSN", "( 1.3.6.1.4.1.4203.666.1.25 "
433 "DESC 'the largest committed CSN of a context' "
434 "EQUALITY octetStringMatch "
435 "ORDERING octetStringOrderingMatch "
436 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 "
437 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
440 NULL, NULL, NULL, NULL, NULL,
441 offsetof(struct slap_internal_schema, si_ad_contextCSN) },
444 { "syncTimestamp", "( 1.3.6.1.4.1.4203.666.1.26 NAME 'syncTimestamp' "
445 "DESC 'Time which object was replicated' "
446 "EQUALITY generalizedTimeMatch "
447 "ORDERING generalizedTimeOrderingMatch "
448 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 "
449 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
452 NULL, NULL, NULL, NULL, NULL,
453 offsetof(struct slap_internal_schema, si_ad_syncTimestamp) },
456 /* root DSE attributes */
457 { "altServer", "( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' "
458 "DESC 'RFC2252: alternative servers' "
459 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE dSAOperation )",
462 NULL, NULL, NULL, NULL, NULL,
463 offsetof(struct slap_internal_schema, si_ad_altServer) },
464 { "namingContexts", "( 1.3.6.1.4.1.1466.101.120.5 "
465 "NAME 'namingContexts' "
466 "DESC 'RFC2252: naming contexts' "
467 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation )",
470 NULL, NULL, NULL, NULL, NULL,
471 offsetof(struct slap_internal_schema, si_ad_namingContexts) },
472 { "supportedControl", "( 1.3.6.1.4.1.1466.101.120.13 "
473 "NAME 'supportedControl' "
474 "DESC 'RFC2252: supported controls' "
475 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )",
478 NULL, NULL, NULL, NULL, NULL,
479 offsetof(struct slap_internal_schema, si_ad_supportedControl) },
480 { "supportedExtension", "( 1.3.6.1.4.1.1466.101.120.7 "
481 "NAME 'supportedExtension' "
482 "DESC 'RFC2252: supported extended operations' "
483 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )",
486 NULL, NULL, NULL, NULL, NULL,
487 offsetof(struct slap_internal_schema, si_ad_supportedExtension) },
488 { "supportedLDAPVersion", "( 1.3.6.1.4.1.1466.101.120.15 "
489 "NAME 'supportedLDAPVersion' "
490 "DESC 'RFC2252: supported LDAP versions' "
491 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation )",
494 NULL, NULL, NULL, NULL, NULL,
495 offsetof(struct slap_internal_schema, si_ad_supportedLDAPVersion) },
496 { "supportedSASLMechanisms", "( 1.3.6.1.4.1.1466.101.120.14 "
497 "NAME 'supportedSASLMechanisms' "
498 "DESC 'RFC2252: supported SASL mechanisms'"
499 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation )",
502 NULL, NULL, NULL, NULL, NULL,
503 offsetof(struct slap_internal_schema, si_ad_supportedSASLMechanisms) },
504 { "supportedFeatures", "( 1.3.6.1.4.1.4203.1.3.5 "
505 "NAME 'supportedFeatures' "
506 "DESC 'features supported by the server' "
507 "EQUALITY objectIdentifierMatch "
508 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
509 "USAGE dSAOperation )",
512 NULL, NULL, NULL, NULL, NULL,
513 offsetof(struct slap_internal_schema, si_ad_supportedFeatures) },
514 { "monitorContext", "( 1.3.6.1.4.1.4203.666.1.10 "
515 "NAME 'monitorContext' "
516 "DESC 'monitor context' "
517 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
518 "SINGLE-VALUE NO-USER-MODIFICATION "
519 "USAGE dSAOperation )",
520 rootDseAttribute, SLAP_AT_HIDE,
522 NULL, NULL, NULL, NULL, NULL,
523 offsetof(struct slap_internal_schema, si_ad_monitorContext) },
524 { "vendorName", "( 1.3.6.1.1.4 NAME 'vendorName' "
525 "DESC 'RFC3045: name of implementation vendor' "
526 "EQUALITY caseExactMatch "
527 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
528 "SINGLE-VALUE NO-USER-MODIFICATION "
529 "USAGE dSAOperation )",
532 NULL, NULL, NULL, NULL, NULL,
533 offsetof(struct slap_internal_schema, si_ad_vendorName) },
534 { "vendorVersion", "( 1.3.6.1.1.5 NAME 'vendorVersion' "
535 "DESC 'RFC3045: version of implementation' "
536 "EQUALITY caseExactMatch "
537 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
538 "SINGLE-VALUE NO-USER-MODIFICATION "
539 "USAGE dSAOperation )",
542 NULL, NULL, NULL, NULL, NULL,
543 offsetof(struct slap_internal_schema, si_ad_vendorVersion) },
545 /* subentry attributes */
546 { "administrativeRole", "( 2.5.18.5 NAME 'administrativeRole' "
547 "EQUALITY objectIdentifierMatch "
548 "USAGE directoryOperation "
549 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
550 administrativeRoleAttribute, SLAP_AT_HIDE,
552 NULL, NULL, NULL, NULL, NULL,
553 offsetof(struct slap_internal_schema, si_ad_administrativeRole) },
554 { "subtreeSpecification", "( 2.5.18.6 NAME 'subtreeSpecification' "
556 "USAGE directoryOperation "
557 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.45 )",
558 subentryAttribute, SLAP_AT_HIDE,
560 NULL, NULL, NULL, NULL, NULL,
561 offsetof(struct slap_internal_schema, si_ad_subtreeSpecification) },
563 /* subschema subentry attributes */
564 { "ditStructureRules", "( 2.5.21.1 NAME 'dITStructureRules' "
565 "DESC 'RFC2252: DIT structure rules' "
566 "EQUALITY integerFirstComponentMatch "
567 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
568 "USAGE directoryOperation ) ",
569 subentryAttribute, SLAP_AT_HIDE,
571 NULL, NULL, NULL, NULL, NULL,
572 offsetof(struct slap_internal_schema, si_ad_ditStructureRules) },
573 { "ditContentRules", "( 2.5.21.2 NAME 'dITContentRules' "
574 "DESC 'RFC2252: DIT content rules' "
575 "EQUALITY objectIdentifierFirstComponentMatch "
576 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation )",
577 subentryAttribute, SLAP_AT_HIDE,
579 NULL, NULL, NULL, NULL, NULL,
580 offsetof(struct slap_internal_schema, si_ad_ditContentRules) },
581 { "matchingRules", "( 2.5.21.4 NAME 'matchingRules' "
582 "DESC 'RFC2252: matching rules' "
583 "EQUALITY objectIdentifierFirstComponentMatch "
584 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.30 USAGE directoryOperation )",
585 subentryAttribute, 0,
587 NULL, NULL, NULL, NULL, NULL,
588 offsetof(struct slap_internal_schema, si_ad_matchingRules) },
589 { "attributeTypes", "( 2.5.21.5 NAME 'attributeTypes' "
590 "DESC 'RFC2252: attribute types' "
591 "EQUALITY objectIdentifierFirstComponentMatch "
592 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.3 USAGE directoryOperation )",
593 subentryAttribute, 0,
595 NULL, NULL, NULL, NULL, NULL,
596 offsetof(struct slap_internal_schema, si_ad_attributeTypes) },
597 { "objectClasses", "( 2.5.21.6 NAME 'objectClasses' "
598 "DESC 'RFC2252: object classes' "
599 "EQUALITY objectIdentifierFirstComponentMatch "
600 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.37 USAGE directoryOperation )",
601 subentryAttribute, 0,
603 NULL, NULL, NULL, NULL, NULL,
604 offsetof(struct slap_internal_schema, si_ad_objectClasses) },
605 { "nameForms", "( 2.5.21.7 NAME 'nameForms' "
606 "DESC 'RFC2252: name forms ' "
607 "EQUALITY objectIdentifierFirstComponentMatch "
608 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.35 USAGE directoryOperation )",
609 subentryAttribute, SLAP_AT_HIDE,
611 NULL, NULL, NULL, NULL, NULL,
612 offsetof(struct slap_internal_schema, si_ad_nameForms) },
613 { "matchingRuleUse", "( 2.5.21.8 NAME 'matchingRuleUse' "
614 "DESC 'RFC2252: matching rule uses' "
615 "EQUALITY objectIdentifierFirstComponentMatch "
616 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.31 USAGE directoryOperation )",
617 subentryAttribute, 0,
619 NULL, NULL, NULL, NULL, NULL,
620 offsetof(struct slap_internal_schema, si_ad_matchingRuleUse) },
622 { "ldapSyntaxes", "( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes' "
623 "DESC 'RFC2252: LDAP syntaxes' "
624 "EQUALITY objectIdentifierFirstComponentMatch "
625 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.54 USAGE directoryOperation )",
626 subentryAttribute, 0,
628 NULL, NULL, NULL, NULL, NULL,
629 offsetof(struct slap_internal_schema, si_ad_ldapSyntaxes) },
631 /* knowledge information */
632 { "aliasedObjectName", "( 2.5.4.1 "
633 "NAME ( 'aliasedObjectName' 'aliasedEntryName' ) "
634 "DESC 'RFC2256: name of aliased object' "
635 "EQUALITY distinguishedNameMatch "
636 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )",
637 aliasAttribute, SLAP_AT_FINAL,
639 NULL, NULL, NULL, NULL, NULL,
640 offsetof(struct slap_internal_schema, si_ad_aliasedObjectName) },
641 { "ref", "( 2.16.840.1.113730.3.1.34 NAME 'ref' "
642 "DESC 'namedref: subordinate referral URL' "
643 "EQUALITY caseExactMatch "
644 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
645 "USAGE distributedOperation )",
646 referralAttribute, 0,
648 NULL, NULL, NULL, NULL, NULL,
649 offsetof(struct slap_internal_schema, si_ad_ref) },
651 /* access control internals */
652 { "entry", "( 1.3.6.1.4.1.4203.1.3.1 "
654 "DESC 'OpenLDAP ACL entry pseudo-attribute' "
655 "SYNTAX 1.3.6.1.4.1.4203.1.1.1 "
656 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
659 NULL, NULL, NULL, NULL, NULL,
660 offsetof(struct slap_internal_schema, si_ad_entry) },
661 { "children", "( 1.3.6.1.4.1.4203.1.3.2 "
663 "DESC 'OpenLDAP ACL children pseudo-attribute' "
664 "SYNTAX 1.3.6.1.4.1.4203.1.1.1 "
665 "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )",
668 NULL, NULL, NULL, NULL, NULL,
669 offsetof(struct slap_internal_schema, si_ad_children) },
670 { "saslAuthzTo", "( 1.3.6.1.4.1.4203.666.1.8 "
671 "NAME 'saslAuthzTo' "
672 "DESC 'SASL proxy authorization targets' "
673 "EQUALITY caseExactMatch "
674 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
675 "USAGE distributedOperation )",
678 NULL, NULL, NULL, NULL, NULL,
679 offsetof(struct slap_internal_schema, si_ad_saslAuthzTo) },
680 { "saslAuthzFrom", "( 1.3.6.1.4.1.4203.666.1.9 "
681 "NAME 'saslAuthzFrom' "
682 "DESC 'SASL proxy authorization sources' "
683 "EQUALITY caseExactMatch "
684 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
685 "USAGE distributedOperation )",
688 NULL, NULL, NULL, NULL, NULL,
689 offsetof(struct slap_internal_schema, si_ad_saslAuthzFrom) },
690 #ifdef SLAPD_ACI_ENABLED
691 { "OpenLDAPaci", "( 1.3.6.1.4.1.4203.666.1.5 "
692 "NAME 'OpenLDAPaci' "
693 "DESC 'OpenLDAP access control information (experimental)' "
694 "EQUALITY OpenLDAPaciMatch "
695 "SYNTAX 1.3.6.1.4.1.4203.666.2.1 "
696 "USAGE directoryOperation )",
699 NULL, NULL, NULL, NULL, NULL,
700 offsetof(struct slap_internal_schema, si_ad_aci) },
704 { "entryTtl", "( 1.3.6.1.4.1.1466.101.119.3 NAME 'entryTtl' "
705 "DESC 'RFC2589: entry time-to-live' "
706 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE "
707 "NO-USER-MODIFICATION USAGE dSAOperation )",
710 NULL, NULL, NULL, NULL, NULL,
711 offsetof(struct slap_internal_schema, si_ad_entryTtl) },
712 { "dynamicSubtrees", "( 1.3.6.1.4.1.1466.101.119.4 "
713 "NAME 'dynamicSubtrees' "
714 "DESC 'RFC2589: dynamic subtrees' "
715 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION "
716 "USAGE dSAOperation )",
719 NULL, NULL, NULL, NULL, NULL,
720 offsetof(struct slap_internal_schema, si_ad_dynamicSubtrees) },
723 /* userApplication attributes (which system schema depends upon) */
724 { "distinguishedName", "( 2.5.4.49 NAME 'distinguishedName' "
725 "DESC 'RFC2256: common supertype of DN attributes' "
726 "EQUALITY distinguishedNameMatch "
727 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
728 NULL, SLAP_AT_ABSTRACT,
730 NULL, NULL, NULL, NULL, NULL,
731 offsetof(struct slap_internal_schema, si_ad_distinguishedName) },
732 { "name", "( 2.5.4.41 NAME 'name' "
733 "DESC 'RFC2256: common supertype of name attributes' "
734 "EQUALITY caseIgnoreMatch "
735 "SUBSTR caseIgnoreSubstringsMatch "
736 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )",
737 NULL, SLAP_AT_ABSTRACT,
739 NULL, NULL, NULL, NULL, NULL,
740 offsetof(struct slap_internal_schema, si_ad_name) },
741 { "cn", "( 2.5.4.3 NAME ( 'cn' 'commonName' ) "
742 "DESC 'RFC2256: common name(s) for which the entity is known by' "
746 NULL, NULL, NULL, NULL, NULL,
747 offsetof(struct slap_internal_schema, si_ad_cn) },
748 { "userPassword", "( 2.5.4.35 NAME 'userPassword' "
749 "DESC 'RFC2256/2307: password of user' "
750 "EQUALITY octetStringMatch "
751 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )",
754 NULL, NULL, NULL, NULL, NULL,
755 offsetof(struct slap_internal_schema, si_ad_userPassword) },
757 { "labeledURI", "( 1.3.6.1.4.1.250.1.57 NAME 'labeledURI' "
758 "DESC 'RFC2079: Uniform Resource Identifier with optional label' "
759 "EQUALITY caseExactMatch "
760 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
763 NULL, NULL, NULL, NULL, NULL,
764 offsetof(struct slap_internal_schema, si_ad_labeledURI) },
766 #ifdef SLAPD_AUTHPASSWD
767 { "authPassword", "( 1.3.6.1.4.1.4203.1.3.4 "
768 "NAME 'authPassword' "
769 "DESC 'RFC3112: authentication password attribute' "
770 "EQUALITY 1.3.6.1.4.1.4203.1.2.2 "
771 "SYNTAX 1.3.6.1.4.1.4203.1.1.2 )",
774 NULL, NULL, NULL, NULL, NULL,
775 offsetof(struct slap_internal_schema, si_ad_authPassword) },
776 { "supportedAuthPasswordSchemes", "( 1.3.6.1.4.1.4203.1.3.3 "
777 "NAME 'supportedAuthPasswordSchemes' "
778 "DESC 'RFC3112: supported authPassword schemes' "
779 "EQUALITY caseExactIA5Match "
780 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} "
781 "USAGE dSAOperation )",
782 subschemaAttribute, 0,
784 NULL, NULL, NULL, NULL, NULL,
785 offsetof(struct slap_internal_schema, si_ad_authPassword) },
787 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
788 { "krbName", "( 1.3.6.1.4.1.250.1.32 "
789 "NAME ( 'krbName' 'kerberosName' ) "
790 "DESC 'Kerberos principal associated with object' "
791 "EQUALITY caseIgnoreIA5Match "
792 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 "
796 NULL, NULL, NULL, NULL, NULL,
797 offsetof(struct slap_internal_schema, si_ad_krbName) },
799 { NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 }
802 static AttributeType slap_at_undefined = {
803 { "1.1.1", NULL, NULL, 1, NULL,
804 NULL, NULL, NULL, NULL,
805 0, 0, 0, 1, 3, NULL }, /* LDAPAttributeType */
806 { sizeof("UNDEFINED")-1, "UNDEFINED" }, /* cname */
809 NULL, NULL, NULL, NULL, /* matching rules routines */
810 NULL, /* syntax (this may need to be defined) */
811 (AttributeTypeSchemaCheckFN *) 0, /* schema check function */
812 SLAP_AT_ABSTRACT|SLAP_AT_FINAL, /* mask */
814 NULL /* attribute description */
815 /* mutex (don't know how to initialize it :) */
818 static struct slap_schema_mr_map {
822 { "caseExactIA5Match",
823 offsetof(struct slap_internal_schema, si_mr_caseExactIA5Match) },
825 offsetof(struct slap_internal_schema, si_mr_caseExactMatch) },
826 { "caseExactSubstringsMatch",
827 offsetof(struct slap_internal_schema, si_mr_caseExactSubstringsMatch) },
828 { "distinguishedNameMatch",
829 offsetof(struct slap_internal_schema, si_mr_distinguishedNameMatch) },
831 offsetof(struct slap_internal_schema, si_mr_integerMatch) },
832 { "integerFirstComponentMatch",
833 offsetof(struct slap_internal_schema,
834 si_mr_integerFirstComponentMatch) },
835 { "objectIdentifierFirstComponentMatch",
836 offsetof(struct slap_internal_schema,
837 si_mr_objectIdentifierFirstComponentMatch) },
841 static struct slap_schema_syn_map {
845 { "1.3.6.1.4.1.1466.115.121.1.15",
846 offsetof(struct slap_internal_schema, si_syn_directoryString) },
847 { "1.3.6.1.4.1.1466.115.121.1.12",
848 offsetof(struct slap_internal_schema, si_syn_distinguishedName) },
849 { "1.3.6.1.4.1.1466.115.121.1.27",
850 offsetof(struct slap_internal_schema, si_syn_integer) },
851 { "1.3.6.1.4.1.1466.115.121.1.40",
852 offsetof(struct slap_internal_schema, si_syn_octetString) },
857 slap_schema_load( void )
861 for( i=0; syn_map[i].sssm_name; i++ ) {
862 Syntax ** synp = (Syntax **)
863 &(((char *) &slap_schema)[syn_map[i].sssm_offset]);
865 assert( *synp == NULL );
867 *synp = syn_find( syn_map[i].sssm_name );
869 if( *synp == NULL ) {
870 fprintf( stderr, "slap_schema_load: Syntax: "
871 "No syntax \"%s\" defined in schema\n",
872 syn_map[i].sssm_name );
873 return LDAP_INVALID_SYNTAX;
877 for( i=0; mr_map[i].ssmm_name; i++ ) {
878 MatchingRule ** mrp = (MatchingRule **)
879 &(((char *) &slap_schema)[mr_map[i].ssmm_offset]);
881 assert( *mrp == NULL );
883 *mrp = mr_find( mr_map[i].ssmm_name );
886 fprintf( stderr, "slap_schema_load: MatchingRule: "
887 "No matching rule \"%s\" defined in schema\n",
888 mr_map[i].ssmm_name );
889 return LDAP_INAPPROPRIATE_MATCHING;
893 for( i=0; ad_map[i].ssam_name; i++ ) {
894 assert( ad_map[i].ssam_defn != NULL );
896 LDAPAttributeType *at;
900 at = ldap_str2attributetype( ad_map[i].ssam_defn,
901 &code, &err, LDAP_SCHEMA_ALLOW_ALL );
904 "slap_schema_load: AttributeType \"%s\": %s before %s\n",
905 ad_map[i].ssam_name, ldap_scherr2str(code), err );
909 if ( at->at_oid == NULL ) {
910 fprintf( stderr, "slap_schema_load: "
911 "AttributeType \"%s\": no OID\n",
912 ad_map[i].ssam_name );
916 code = at_add( at, &err );
918 fprintf( stderr, "slap_schema_load: AttributeType "
919 "\"%s\": %s: \"%s\"\n",
920 ad_map[i].ssam_name, scherr2str(code), err );
928 Syntax *syntax = NULL;
930 AttributeDescription ** adp = (AttributeDescription **)
931 &(((char *) &slap_schema)[ad_map[i].ssam_offset]);
933 assert( *adp == NULL );
935 rc = slap_str2ad( ad_map[i].ssam_name, adp, &text );
936 if( rc != LDAP_SUCCESS ) {
937 fprintf( stderr, "slap_schema_load: AttributeType \"%s\": "
938 "not defined in schema\n",
939 ad_map[i].ssam_name );
943 if( ad_map[i].ssam_check ) {
944 /* install check routine */
945 (*adp)->ad_type->sat_check = ad_map[i].ssam_check;
948 (*adp)->ad_type->sat_flags |= ad_map[i].ssam_flags;
950 /* install custom syntax routines */
951 if( ad_map[i].ssam_syn_validate ||
952 ad_map[i].ssam_syn_pretty )
956 syntax = (*adp)->ad_type->sat_syntax;
958 syn = ch_malloc( sizeof( Syntax ) );
961 if( ad_map[i].ssam_syn_validate ) {
962 syn->ssyn_validate = ad_map[i].ssam_syn_validate;
964 if( ad_map[i].ssam_syn_pretty ) {
965 syn->ssyn_pretty = ad_map[i].ssam_syn_pretty;
968 (*adp)->ad_type->sat_syntax = syn;
971 /* install custom rule routines */
972 if( ( (*adp)->ad_type->sat_equality != NULL &&
973 syntax == (*adp)->ad_type->sat_equality->smr_syntax ) ||
974 ad_map[i].ssam_mr_convert ||
975 ad_map[i].ssam_mr_normalize ||
976 ad_map[i].ssam_mr_match ||
977 ad_map[i].ssam_mr_indexer ||
978 ad_map[i].ssam_mr_filter )
980 MatchingRule *mr = ch_malloc( sizeof( MatchingRule ) );
981 *mr = *(*adp)->ad_type->sat_equality;
983 if ( syntax == mr->smr_syntax ) {
984 mr->smr_syntax = (*adp)->ad_type->sat_syntax;
986 if ( ad_map[i].ssam_mr_convert ) {
987 mr->smr_convert = ad_map[i].ssam_mr_convert;
989 if ( ad_map[i].ssam_mr_normalize ) {
990 mr->smr_normalize = ad_map[i].ssam_mr_normalize;
992 if ( ad_map[i].ssam_mr_match ) {
993 mr->smr_match = ad_map[i].ssam_mr_match;
995 if ( ad_map[i].ssam_mr_indexer ) {
996 mr->smr_indexer = ad_map[i].ssam_mr_indexer;
998 if ( ad_map[i].ssam_mr_filter ) {
999 mr->smr_filter = ad_map[i].ssam_mr_filter;
1002 (*adp)->ad_type->sat_equality = mr;
1007 for( i=0; oc_map[i].ssom_name; i++ ) {
1008 assert( oc_map[i].ssom_defn != NULL );
1010 LDAPObjectClass *oc;
1014 oc = ldap_str2objectclass( oc_map[i].ssom_defn, &code, &err,
1015 LDAP_SCHEMA_ALLOW_ALL );
1017 fprintf( stderr, "slap_schema_load: ObjectClass "
1018 "\"%s\": %s before %s\n",
1019 oc_map[i].ssom_name, ldap_scherr2str(code), err );
1023 if ( oc->oc_oid == NULL ) {
1024 fprintf( stderr, "slap_schema_load: ObjectClass "
1026 oc_map[i].ssom_name );
1030 code = oc_add(oc,0,&err);
1032 fprintf( stderr, "slap_schema_load: ObjectClass "
1033 "\"%s\": %s: \"%s\"\n",
1034 oc_map[i].ssom_name, scherr2str(code), err);
1041 ObjectClass ** ocp = (ObjectClass **)
1042 &(((char *) &slap_schema)[oc_map[i].ssom_offset]);
1044 assert( *ocp == NULL );
1046 *ocp = oc_find( oc_map[i].ssom_name );
1047 if( *ocp == NULL ) {
1048 fprintf( stderr, "slap_schema_load: "
1049 "ObjectClass \"%s\": not defined in schema\n",
1050 oc_map[i].ssom_name );
1051 return LDAP_OBJECT_CLASS_VIOLATION;
1054 if( oc_map[i].ssom_check ) {
1055 /* install check routine */
1056 (*ocp)->soc_check = oc_map[i].ssom_check;
1059 (*ocp)->soc_flags |= oc_map[i].ssom_flags;
1063 slap_at_undefined.sat_syntax = slap_schema.si_syn_distinguishedName;
1064 slap_schema.si_at_undefined = &slap_at_undefined;
1066 return LDAP_SUCCESS;
1070 slap_schema_check( void )
1072 /* we should only be called once after schema_init() was called */
1073 assert( schema_init_done == 1 );
1076 * cycle thru attributeTypes to build matchingRuleUse
1078 if ( matching_rule_use_init() ) {
1083 return LDAP_SUCCESS;
1086 static int rootDseObjectClass (
1091 char *textbuf, size_t textlen )
1095 if( e->e_nname.bv_len ) {
1096 snprintf( textbuf, textlen,
1097 "objectClass \"%s\" only allowed in the root DSE",
1099 return LDAP_OBJECT_CLASS_VIOLATION;
1102 /* we should not be called for the root DSE */
1104 return LDAP_SUCCESS;
1107 static int aliasObjectClass (
1112 char *textbuf, size_t textlen )
1116 if( !SLAP_ALIASES(be) ) {
1117 snprintf( textbuf, textlen,
1118 "objectClass \"%s\" not supported in context",
1120 return LDAP_OBJECT_CLASS_VIOLATION;
1123 return LDAP_SUCCESS;
1126 static int referralObjectClass (
1131 char *textbuf, size_t textlen )
1135 if( !SLAP_REFERRALS(be) ) {
1136 snprintf( textbuf, textlen,
1137 "objectClass \"%s\" not supported in context",
1139 return LDAP_OBJECT_CLASS_VIOLATION;
1142 return LDAP_SUCCESS;
1145 static int subentryObjectClass (
1150 char *textbuf, size_t textlen )
1154 if( !SLAP_SUBENTRIES(be) ) {
1155 snprintf( textbuf, textlen,
1156 "objectClass \"%s\" not supported in context",
1158 return LDAP_OBJECT_CLASS_VIOLATION;
1161 if( oc != slap_schema.si_oc_subentry && !is_entry_subentry( e ) ) {
1162 snprintf( textbuf, textlen,
1163 "objectClass \"%s\" only allowed in subentries",
1165 return LDAP_OBJECT_CLASS_VIOLATION;
1168 return LDAP_SUCCESS;
1171 static int dynamicObjectClass (
1176 char *textbuf, size_t textlen )
1180 if( !SLAP_DYNAMIC(be) ) {
1181 snprintf( textbuf, textlen,
1182 "objectClass \"%s\" not supported in context",
1184 return LDAP_OBJECT_CLASS_VIOLATION;
1187 return LDAP_SUCCESS;
1190 static int rootDseAttribute (
1195 char *textbuf, size_t textlen )
1199 if( e->e_nname.bv_len ) {
1200 snprintf( textbuf, textlen,
1201 "attribute \"%s\" only allowed in the root DSE",
1202 attr->a_desc->ad_cname.bv_val );
1203 return LDAP_OBJECT_CLASS_VIOLATION;
1206 /* we should not be called for the root DSE */
1208 return LDAP_SUCCESS;
1211 static int aliasAttribute (
1216 char *textbuf, size_t textlen )
1220 if( !SLAP_ALIASES(be) ) {
1221 snprintf( textbuf, textlen,
1222 "attribute \"%s\" not supported in context",
1223 attr->a_desc->ad_cname.bv_val );
1224 return LDAP_OBJECT_CLASS_VIOLATION;
1227 if( !is_entry_alias( e ) ) {
1228 snprintf( textbuf, textlen,
1229 "attribute \"%s\" only allowed in the alias",
1230 attr->a_desc->ad_cname.bv_val );
1231 return LDAP_OBJECT_CLASS_VIOLATION;
1234 return LDAP_SUCCESS;
1237 static int referralAttribute (
1242 char *textbuf, size_t textlen )
1246 if( !SLAP_REFERRALS(be) ) {
1247 snprintf( textbuf, textlen,
1248 "attribute \"%s\" not supported in context",
1249 attr->a_desc->ad_cname.bv_val );
1250 return LDAP_OBJECT_CLASS_VIOLATION;
1253 if( !is_entry_referral( e ) ) {
1254 snprintf( textbuf, textlen,
1255 "attribute \"%s\" only allowed in the referral",
1256 attr->a_desc->ad_cname.bv_val );
1257 return LDAP_OBJECT_CLASS_VIOLATION;
1260 return LDAP_SUCCESS;
1263 static int subentryAttribute (
1268 char *textbuf, size_t textlen )
1272 if( !SLAP_SUBENTRIES(be) ) {
1273 snprintf( textbuf, textlen,
1274 "attribute \"%s\" not supported in context",
1275 attr->a_desc->ad_cname.bv_val );
1276 return LDAP_OBJECT_CLASS_VIOLATION;
1279 if( !is_entry_subentry( e ) ) {
1280 snprintf( textbuf, textlen,
1281 "attribute \"%s\" only allowed in the subentry",
1282 attr->a_desc->ad_cname.bv_val );
1283 return LDAP_OBJECT_CLASS_VIOLATION;
1286 return LDAP_SUCCESS;
1289 static int administrativeRoleAttribute (
1294 char *textbuf, size_t textlen )
1298 if( !SLAP_SUBENTRIES(be) ) {
1299 snprintf( textbuf, textlen,
1300 "attribute \"%s\" not supported in context",
1301 attr->a_desc->ad_cname.bv_val );
1302 return LDAP_OBJECT_CLASS_VIOLATION;
1305 snprintf( textbuf, textlen,
1306 "attribute \"%s\" not supported!",
1307 attr->a_desc->ad_cname.bv_val );
1308 return LDAP_OBJECT_CLASS_VIOLATION;
1311 static int dynamicAttribute (
1316 char *textbuf, size_t textlen )
1320 if( !SLAP_DYNAMIC(be) ) {
1321 snprintf( textbuf, textlen,
1322 "attribute \"%s\" not supported in context",
1323 attr->a_desc->ad_cname.bv_val );
1324 return LDAP_OBJECT_CLASS_VIOLATION;
1327 if( !is_entry_dynamicObject( e ) ) {
1328 snprintf( textbuf, textlen,
1329 "attribute \"%s\" only allowed in dynamic object",
1330 attr->a_desc->ad_cname.bv_val );
1331 return LDAP_OBJECT_CLASS_VIOLATION;
1334 return LDAP_SUCCESS;