From: Kurt Zeilenga Date: Mon, 19 Jun 2000 16:14:12 +0000 (+0000) Subject: Extend objectClassMatch to return true if asserted class is a X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2578 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=11ac0330bbdc64d28ff28aff62b0313712e3f9e1;p=openldap Extend objectClassMatch to return true if asserted class is a subclass of stored value. --- diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index adcd6c7693..d2bcae6679 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -20,19 +20,36 @@ int schema_init_done = 0; struct slap_internal_schema slap_schema; +#define objectClassIndexer NULL +#define objectClassFilter NULL + static int objectClassMatch( - int *match, + int *matchp, unsigned use, Syntax *syntax, MatchingRule *mr, struct berval *value, void *assertedValue ) { + struct berval *a = (struct berval *) assertedValue; ObjectClass *oc = oc_find( value->bv_val ); - ObjectClass *asserted = oc_find( ((struct berval *) assertedValue)->bv_val ); + ObjectClass *asserted = oc_find( a->bv_val ); + + if( asserted == NULL || oc == NULL ) { + return LDAP_CONSTRAINT_VIOLATION; + } + +#if 0 + Debug( LDAP_DEBUG_TRACE, "objectClassMatch(%s,%s)\n", + value->bv_val, a->bv_val, NULL ); +#endif + + *matchp = !is_object_subclass( asserted, oc ); + + Debug( LDAP_DEBUG_TRACE, "\treturns %d\n", + *matchp, NULL, NULL ); - *match = ( oc == NULL || oc != asserted ); return LDAP_SUCCESS; } @@ -53,71 +70,74 @@ struct slap_schema_oc_map { struct slap_schema_ad_map { char *ssam_name; slap_mr_match_func *ssam_match; + slap_mr_indexer_func *ssam_indexer; + slap_mr_filter_func *ssam_filter; size_t ssam_offset; } ad_map[] = { - { "objectClass", objectClassMatch, + { "objectClass", + objectClassMatch, objectClassIndexer, objectClassFilter, offsetof(struct slap_internal_schema, si_ad_objectClass) }, /* user entry operational attributes */ - { "creatorsName", NULL, + { "creatorsName", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_creatorsName) }, - { "createTimestamp", NULL, + { "createTimestamp", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_createTimestamp) }, - { "modifiersName", NULL, + { "modifiersName", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_modifiersName) }, - { "modifyTimestamp", NULL, + { "modifyTimestamp", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_modifyTimestamp) }, - { "subschemaSubentry", NULL, + { "subschemaSubentry", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) }, /* root DSE attributes */ - { "namingContexts", NULL, + { "namingContexts", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_namingContexts) }, - { "supportedControl", NULL, + { "supportedControl", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedControl) }, - { "supportedExtension", NULL, + { "supportedExtension", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedExtension) }, - { "supportedLDAPVersion", NULL, + { "supportedLDAPVersion", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedLDAPVersion) }, - { "supportedSASLMechanisms", NULL, + { "supportedSASLMechanisms", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_supportedSASLMechanisms) }, /* subschema subentry attributes */ - { "attributeTypes", NULL, + { "attributeTypes", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_attributeTypes) }, - { "ldapSyntaxes", NULL, + { "ldapSyntaxes", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ldapSyntaxes) }, - { "matchingRules", NULL, + { "matchingRules", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_matchingRules) }, - { "objectClasses", NULL, + { "objectClasses", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_objectClasses) }, /* knowledge information */ - { "aliasedObjectName", NULL, + { "aliasedObjectName", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_aliasedObjectName) }, - { "ref", NULL, + { "ref", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_ref) }, /* access control internals */ - { "entry", NULL, + { "entry", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entry) }, - { "children", NULL, + { "children", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_children) }, #ifdef SLAPD_ACI_ENABLED - { "OpenLDAPaci", NULL, + { "OpenLDAPaci", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_aci) }, #endif - { "userPassword", NULL, + { "userPassword", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_userPassword) }, - { "authPassword", NULL, + { "authPassword", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_authPassword) }, #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND - { "krbName", NULL, + { "krbName", NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_krbName) }, #endif - { NULL, NULL, 0 } + { NULL, NULL, NULL, NULL, 0 } };