From 64619bed946447d104a85cc30f21ab08731f64bb Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 13 Jan 2002 19:38:12 +0000 Subject: [PATCH] Install system schema checks --- servers/slapd/schema_check.c | 6 +- servers/slapd/schema_prep.c | 131 +++++++++++++++++++---------------- servers/slapd/slap.h | 24 ++++--- 3 files changed, 91 insertions(+), 70 deletions(-) diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index c9a67e51ee..fb6ba5275d 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -46,9 +46,9 @@ entry_schema_check( = slap_schema.si_ad_objectClass; int extensible = 0; int subentry = is_entry_subentry( e ); - int collective = 0; + int collectiveSubentry = 0; - if( subentry) collective = is_entry_collectiveAttributes( e ); + if( subentry) collectiveSubentry = is_entry_collectiveAttributes( e ); *text = textbuf; @@ -68,7 +68,7 @@ entry_schema_check( } } - if( !collective && is_at_collective( a->a_desc->ad_type ) ) { + if( !collectiveSubentry && is_at_collective( a->a_desc->ad_type ) ) { snprintf( textbuf, textlen, "'%s' can only appear in collectiveAttributes subentry", type ); diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 49a2f5b7e2..e10076f94d 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -125,38 +125,39 @@ static struct slap_schema_oc_map { char *ssom_name; char *ssom_defn; ObjectClassSchemaCheckFN *ssom_check; + slap_mask_t ssom_flags; size_t ssom_offset; } oc_map[] = { { "top", "( 2.5.6.0 NAME 'top' " "DESC 'top of the superclass chain' " "ABSTRACT MUST objectClass )", - 0, offsetof(struct slap_internal_schema, si_oc_top) }, + 0, 0, offsetof(struct slap_internal_schema, si_oc_top) }, { "extensibleObject", "( 1.3.6.1.4.1.1466.101.120.111 " "NAME 'extensibleObject' " "DESC 'RFC2252: extensible object' " "SUP top AUXILIARY )", - 0, offsetof(struct slap_internal_schema, si_oc_extensibleObject) }, + 0, 0, offsetof(struct slap_internal_schema, si_oc_extensibleObject) }, { "alias", "( 2.5.6.1 NAME 'alias' " "DESC 'RFC2256: an alias' " "SUP top STRUCTURAL " "MUST aliasedObjectName )", - aliasObjectClass, + aliasObjectClass, 0, offsetof(struct slap_internal_schema, si_oc_alias) }, { "referral", "( 2.16.840.1.113730.3.2.6 NAME 'referral' " "DESC 'namedref: named subordinate referral' " "SUP top STRUCTURAL MUST ref )", - referralObjectClass, + referralObjectClass, 0, offsetof(struct slap_internal_schema, si_oc_referral) }, { "LDAProotDSE", "( 1.3.6.1.4.1.4203.1.4.1 " "NAME ( 'OpenLDAProotDSE' 'LDAProotDSE' ) " "DESC 'OpenLDAP Root DSE object' " "SUP top STRUCTURAL MAY cn )", - rootDseObjectClass, + rootDseObjectClass, 0, offsetof(struct slap_internal_schema, si_oc_rootdse) }, { "subentry", "( 2.5.20.0 NAME 'subentry' " "SUP top STRUCTURAL " "MUST ( cn $ subtreeSpecification ) )", - subentryObjectClass, + subentryObjectClass, 0, offsetof(struct slap_internal_schema, si_oc_subentry) }, { "subschema", "( 2.5.20.1 NAME 'subschema' " "DESC 'RFC2252: controlling subschema (sub)entry' " @@ -170,17 +171,17 @@ static struct slap_schema_oc_map { "DESC 'OpenLDAP system monitoring' " "STRUCTURAL " "MUST cn )", - 0, offsetof(struct slap_internal_schema, si_oc_monitor) }, + 0, 0, offsetof(struct slap_internal_schema, si_oc_monitor) }, { "collectiveAttributes", "( 2.5.20.2 " "NAME 'collectiveAttributes' " "AUXILIARY )", - subentryObjectClass, + subentryObjectClass, 0, offsetof(struct slap_internal_schema, si_oc_collectiveAttributes) }, { "dynamicObject", "( 1.3.6.1.4.1.1466.101.119.2 " "NAME 'dynamicObject' " "DESC 'RFC2589: Dynamic Object' " "SUP top AUXILIARY )", - dynamicObjectClass, + dynamicObjectClass, 0, offsetof(struct slap_internal_schema, si_oc_dynamicObject) }, { NULL, 0 } }; @@ -195,6 +196,7 @@ static struct slap_schema_ad_map { char *ssam_name; char *ssam_defn; AttributeTypeSchemaCheckFN *ssam_check; + slap_mask_t ssam_flags; slap_mr_match_func *ssam_match; slap_mr_indexer_func *ssam_indexer; slap_mr_filter_func *ssam_filter; @@ -204,7 +206,7 @@ static struct slap_schema_ad_map { "DESC 'RFC2256: object classes of the entity' " "EQUALITY objectIdentifierMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )", - NULL, + NULL, 0, objectClassMatch, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_objectClass) }, @@ -214,8 +216,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " "NO-USER-MODIFICATION SINGLE-VALUE USAGE directoryOperation )", - NULL, - structuralObjectClassMatch, NULL, NULL, + NULL, 0, structuralObjectClassMatch, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) }, { "createTimestamp", "( 2.5.18.1 NAME 'createTimestamp' " "DESC 'RFC2252: time which object was created' " @@ -223,7 +224,7 @@ static struct slap_schema_ad_map { "ORDERING generalizedTimeOrderingMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_createTimestamp) }, { "modifyTimestamp", "( 2.5.18.2 NAME 'modifyTimestamp' " "DESC 'RFC2252: time which object was last modified' " @@ -231,48 +232,48 @@ static struct slap_schema_ad_map { "ORDERING generalizedTimeOrderingMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_modifyTimestamp) }, { "creatorsName", "( 2.5.18.3 NAME 'creatorsName' " "DESC 'RFC2252: name of creator' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_creatorsName) }, { "modifiersName", "( 2.5.18.4 NAME 'modifiersName' " "DESC 'RFC2252: name of last modifier' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_modifiersName) }, { "hasSubordinates", "( 2.5.18.9 NAME 'hasSubordinates' " "DESC 'X.501: entry has children' " "EQUALITY booleanMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_hasSubordinates) }, { "subschemaSubentry", "( 2.5.18.10 NAME 'subschemaSubentry' " "DESC 'RFC2252: name of controlling subschema entry' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION " "SINGLE-VALUE USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) }, { "collectiveAttributeSubentry", "( 2.5.18.12 " "NAME 'collectiveAttributeSubentry' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 " "USAGE directoryOperation NO-USER-MODIFICATION )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_collectiveSubentry) }, { "collectiveExclusions", "( 2.5.18.7 NAME 'collectiveExclusions' " "EQUALITY objectIdentifierMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " "USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_collectiveExclusions) }, { "entryUUID", "( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID' " @@ -280,51 +281,51 @@ static struct slap_schema_ad_map { "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, 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' " "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryCSN) }, /* root DSE attributes */ { "altServer", "( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' " "DESC 'RFC2252: alternative servers' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_altServer) }, { "namingContexts", "( 1.3.6.1.4.1.1466.101.120.5 " "NAME 'namingContexts' " "DESC 'RFC2252: naming contexts' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_namingContexts) }, { "supportedControl", "( 1.3.6.1.4.1.1466.101.120.13 " "NAME 'supportedControl' " "DESC 'RFC2252: supported controls' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedControl) }, { "supportedExtension", "( 1.3.6.1.4.1.1466.101.120.7 " "NAME 'supportedExtension' " "DESC 'RFC2252: supported extended operations' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedExtension) }, { "supportedLDAPVersion", "( 1.3.6.1.4.1.1466.101.120.15 " "NAME 'supportedLDAPVersion' " "DESC 'RFC2252: supported LDAP versions' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedLDAPVersion) }, { "supportedSASLMechanisms", "( 1.3.6.1.4.1.1466.101.120.14 " "NAME 'supportedSASLMechanisms' " "DESC 'RFC2252: supported SASL mechanisms'" "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedSASLMechanisms) }, { "supportedFeatures", "( 1.3.6.1.4.1.4203.1.3.5 " "NAME 'supportedFeatures' " @@ -332,7 +333,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 " "USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedFeatures) }, { "vendorName", "( 1.3.6.1.1.4 NAME 'vendorName' " "DESC 'RFC3045: name of implementation vendor' " @@ -340,7 +341,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " "SINGLE-VALUE NO-USER-MODIFICATION " "USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_vendorName) }, { "vendorVersion", "( 1.3.6.1.1.5 NAME 'vendorVersion' " "DESC 'RFC3045: version of implementation' " @@ -348,7 +349,7 @@ static struct slap_schema_ad_map { "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " "SINGLE-VALUE NO-USER-MODIFICATION " "USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_vendorVersion) }, /* subentry attributes */ @@ -356,13 +357,13 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierMatch " "USAGE directoryOperation " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_administrativeRole) }, { "subtreeSpecification", "( 2.5.18.6 NAME 'subtreeSpecification' " "SINGLE-VALUE " "USAGE directoryOperation " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.45 )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_subtreeSpecification) }, /* subschema subentry attributes */ @@ -371,50 +372,50 @@ static struct slap_schema_ad_map { "EQUALITY integerFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 " "USAGE directoryOperation ) ", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ditStructureRules) }, { "ditContentRules", "( 2.5.21.2 NAME 'dITContentRules' " "DESC 'RFC2252: DIT content rules' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.16 USAGE directoryOperation )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ditContentRules) }, { "matchingRules", "( 2.5.21.4 NAME 'matchingRules' " "DESC 'RFC2252: matching rules' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.30 USAGE directoryOperation )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_matchingRules) }, { "attributeTypes", "( 2.5.21.5 NAME 'attributeTypes' " "DESC 'RFC2252: attribute types' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.3 USAGE directoryOperation )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_attributeTypes) }, { "objectClasses", "( 2.5.21.6 NAME 'objectClasses' " "DESC 'RFC2252: object classes' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.37 USAGE directoryOperation )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_objectClasses) }, { "nameForms", "( 2.5.21.7 NAME 'nameForms' " "DESC 'RFC2252: name forms ' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.35 USAGE directoryOperation )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_nameForms) }, { "matchingRuleUse", "( 2.5.21.8 NAME 'matchingRuleUse' " "DESC 'RFC2252: matching rule uses' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.31 USAGE directoryOperation )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_matchingRuleUse) }, { "ldapSyntaxes", "( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes' " "DESC 'RFC2252: LDAP syntaxes' " "EQUALITY objectIdentifierFirstComponentMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.54 USAGE directoryOperation )", - subentryAttribute, NULL, NULL, NULL, + subentryAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ldapSyntaxes) }, /* knowledge information */ @@ -423,14 +424,14 @@ static struct slap_schema_ad_map { "DESC 'RFC2256: name of aliased object' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )", - aliasAttribute, NULL, NULL, NULL, + aliasAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_aliasedObjectName) }, { "ref", "( 2.16.840.1.113730.3.1.34 NAME 'ref' " "DESC 'namedref: subordinate referral URL' " "EQUALITY caseExactMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " "USAGE distributedOperation )", - referralAttribute, NULL, NULL, NULL, + referralAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ref) }, /* access control internals */ @@ -439,14 +440,14 @@ static struct slap_schema_ad_map { "DESC 'OpenLDAP ACL entry pseudo-attribute' " "SYNTAX 1.3.6.1.4.1.4203.1.1.1 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entry) }, { "children", "( 1.3.6.1.4.1.4203.1.3.2 " "NAME 'children' " "DESC 'OpenLDAP ACL children pseudo-attribute' " "SYNTAX 1.3.6.1.4.1.4203.1.1.1 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_children) }, #ifdef SLAPD_ACI_ENABLED { "OpenLDAPaci", "( 1.3.6.1.4.1.4203.666.1.5 " @@ -455,7 +456,7 @@ static struct slap_schema_ad_map { "EQUALITY OpenLDAPaciMatch " "SYNTAX 1.3.6.1.4.1.4203.666.2.1 " "USAGE directoryOperation )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_aci) }, #endif @@ -463,14 +464,14 @@ static struct slap_schema_ad_map { "DESC 'RFC2589: entry time-to-live' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE " "NO-USER-MODIFICATION USAGE dSAOperation )", - dynamicAttribute, NULL, NULL, NULL, + dynamicAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryTtl) }, { "dynamicSubtrees", "( 1.3.6.1.4.1.1466.101.119.4 " "NAME 'dynamicSubtrees' " "DESC 'RFC2589: dynamic subtrees' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION " "USAGE dSAOperation )", - rootDseAttribute, NULL, NULL, NULL, + rootDseAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_dynamicSubtrees) }, /* userApplication attributes (which system schema depends upon) */ @@ -478,25 +479,25 @@ static struct slap_schema_ad_map { "DESC 'RFC2256: common supertype of DN attributes' " "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_distinguishedName) }, { "name", "( 2.5.4.41 NAME 'name' " "DESC 'RFC2256: common supertype of name attributes' " "EQUALITY caseIgnoreMatch " "SUBSTR caseIgnoreSubstringsMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_name) }, { "cn", "( 2.5.4.3 NAME ( 'cn' 'commonName' ) " "DESC 'RFC2256: common name(s) for which the entity is known by' " "SUP name )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_cn) }, { "userPassword", "( 2.5.4.35 NAME 'userPassword' " "DESC 'RFC2256/2307: password of user' " "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )", - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_userPassword) }, #ifdef SLAPD_AUTHPASSWD @@ -505,7 +506,8 @@ static struct slap_schema_ad_map { "DESC 'RFC3112: authentication password attribute' " "EQUALITY 1.3.6.1.4.1.4203.1.2.2 " "SYNTAX 1.3.6.1.4.1.4203.1.1.2 )", - NULL, NULL, NULL, NULL, + NULL, 0, + NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_authPassword) }, { "supportedAuthPasswordSchemes", "( 1.3.6.1.4.1.4203.1.3.3 " "NAME 'supportedAuthPasswordSchemes' " @@ -513,16 +515,16 @@ static struct slap_schema_ad_map { "EQUALITY caseExactIA5Match " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} " "USAGE dSAOperation )", - subschemaAttribute, NULL, NULL, NULL, + subschemaAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_authPassword) }, #endif #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND { "krbName", NULL, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_krbName) }, #endif - { NULL, NULL, NULL, NULL, NULL, NULL, 0 } + { NULL, NULL, NULL, 0, NULL, NULL, NULL, 0 } }; static AttributeType slap_at_undefined = { @@ -535,6 +537,7 @@ static AttributeType slap_at_undefined = { NULL, NULL, NULL, NULL, /* matching rules */ NULL, /* syntax (this may need to be defined) */ (AttributeTypeSchemaCheckFN *) 0, /* schema check function */ + 0, /* schema check flags */ NULL, /* attribute description */ NULL /* next */ /* mutex (don't know how to initialize it :) */ @@ -693,7 +696,6 @@ slap_schema_check( void ) assert( *adp == NULL ); rc = slap_str2ad( ad_map[i].ssam_name, adp, &text ); - if( rc != LDAP_SUCCESS ) { fprintf( stderr, "slap_schema_check: " "No attribute \"%s\" defined in schema\n", @@ -701,6 +703,13 @@ slap_schema_check( void ) return rc; } + if( ad_map[i].ssam_check ) { + /* install check routine */ + (*adp)->ad_type->sat_check = ad_map[i].ssam_check; + } + /* install flags */ + (*adp)->ad_type->sat_flags |= ad_map[i].ssam_flags; + if( ad_map[i].ssam_match ) { /* install custom matching routine */ (*adp)->ad_type->sat_equality->smr_match = ad_map[i].ssam_match; @@ -714,13 +723,19 @@ slap_schema_check( void ) assert( *ocp == NULL ); *ocp = oc_find( oc_map[i].ssom_name ); - if( *ocp == NULL ) { fprintf( stderr, "slap_schema_check: " "No objectClass \"%s\" defined in schema\n", oc_map[i].ssom_name ); return LDAP_OBJECT_CLASS_VIOLATION; } + + if( oc_map[i].ssom_check ) { + /* install check routine */ + (*ocp)->sco_check = oc_map[i].ssom_check; + } + /* install flags */ + (*ocp)->sco_flags |= oc_map[i].ssom_flags; } ++schema_init_done; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 98b2148be1..8079c73298 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -427,10 +427,12 @@ typedef struct slap_attribute_type { MatchingRule *sat_approx; MatchingRule *sat_ordering; MatchingRule *sat_substr; - Syntax *sat_syntax; + Syntax *sat_syntax; + AttributeTypeSchemaCheckFN *sat_check; + slap_mask_t sat_flags; + struct slap_attr_desc *sat_ad; - struct slap_attribute_type *sat_next; ldap_pvt_thread_mutex_t sat_ad_mutex; #define sat_oid sat_atype.at_oid #define sat_names sat_atype.at_names @@ -446,6 +448,8 @@ typedef struct slap_attribute_type { #define sat_no_user_mod sat_atype.at_no_user_mod #define sat_usage sat_atype.at_usage #define sat_extensions sat_atype.at_extensions + + struct slap_attribute_type *sat_next; } AttributeType; #define is_at_operational(at) ((at)->sat_usage) @@ -466,19 +470,21 @@ typedef int (ObjectClassSchemaCheckFN)( typedef struct slap_object_class { LDAPObjectClass soc_oclass; struct slap_object_class **soc_sups; - AttributeType **soc_required; - AttributeType **soc_allowed; + AttributeType **soc_required; + AttributeType **soc_allowed; ObjectClassSchemaCheckFN *sco_check; - struct slap_object_class *soc_next; -#define soc_oid soc_oclass.oc_oid -#define soc_names soc_oclass.oc_names -#define soc_desc soc_oclass.oc_desc + slap_mask_t sco_flags; +#define soc_oid soc_oclass.oc_oid +#define soc_names soc_oclass.oc_names +#define soc_desc soc_oclass.oc_desc #define soc_obsolete soc_oclass.oc_obsolete #define soc_sup_oids soc_oclass.oc_sup_oids -#define soc_kind soc_oclass.oc_kind +#define soc_kind soc_oclass.oc_kind #define soc_at_oids_must soc_oclass.oc_at_oids_must #define soc_at_oids_may soc_oclass.oc_at_oids_may #define soc_extensions soc_oclass.oc_extensions + + struct slap_object_class *soc_next; } ObjectClass; #ifdef LDAP_DIT_CONTENT_RULES -- 2.39.5