X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Foc.c;h=7163f1aa5f025eb2504e9e251c5563cd548230e6;hb=fd810bb35ebcae78d9e9393af51873f1b404ee02;hp=083034d2743b60ae6919d8d46189c1883d823cb2;hpb=f52cc9bab51e427afa3ed5d28be012d8da27a7a8;p=openldap diff --git a/servers/slapd/oc.c b/servers/slapd/oc.c index 083034d274..7163f1aa5f 100644 --- a/servers/slapd/oc.c +++ b/servers/slapd/oc.c @@ -1,7 +1,7 @@ /* oc.c - object class routines */ /* $OpenLDAP$ */ /* - * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -17,28 +17,28 @@ #include "ldap_pvt.h" int is_object_subclass( - ObjectClass *sub, - ObjectClass *sup ) + ObjectClass *sup, + ObjectClass *sub ) { int i; if( sub == NULL || sup == NULL ) return 0; -#if 0 +#if 1 Debug( LDAP_DEBUG_TRACE, "is_object_subclass(%s,%s) %d\n", - sub->soc_oid, sup->soc_oid, sup == sub ); + sup->soc_oid, sub->soc_oid, sup == sub ); #endif if( sup == sub ) { return 1; } - if( sup->soc_sups == NULL ) { + if( sub->soc_sups == NULL ) { return 0; } - for( i=0; sup->soc_sups[i] != NULL; i++ ) { - if( is_object_subclass( sub, sup->soc_sups[i] ) ) { + for( i=0; sub->soc_sups[i] != NULL; i++ ) { + if( is_object_subclass( sup, sub->soc_sups[i] ) ) { return 1; } } @@ -48,7 +48,8 @@ int is_object_subclass( int is_entry_objectclass( Entry* e, - ObjectClass *oc ) + ObjectClass *oc, + int set_flags ) { Attribute *attr; struct berval *bv; @@ -59,6 +60,10 @@ int is_entry_objectclass( return 0; } + if( set_flags && ( e->e_ocflags & SLAP_OC__END )) { + return (e->e_ocflags & oc->soc_flags); + } + /* * find objectClass attribute */ @@ -84,13 +89,17 @@ int is_entry_objectclass( for( bv=attr->a_vals; bv->bv_val; bv++ ) { ObjectClass *objectClass = oc_bvfind( bv ); - if( objectClass == oc ) { + if ( objectClass == oc && !set_flags ) { return 1; } + + if ( objectClass != NULL ) { + e->e_ocflags |= objectClass->soc_flags; + } } + e->e_ocflags |= SLAP_OC__END; /* We've finished this */ - return 0; - + return (e->e_ocflags & oc->soc_flags); } @@ -389,6 +398,19 @@ oc_add( } } + if ( !OID_LEADCHAR( oc->oc_oid[0] )) { + /* Expand OID macros */ + char *oid = oidm_find( oc->oc_oid ); + if ( !oid ) { + *err = oc->oc_oid; + return SLAP_SCHERR_OIDM; + } + if ( oid != oc->oc_oid ) { + ldap_memfree( oc->oc_oid ); + oc->oc_oid = oid; + } + } + soc = (ObjectClass *) ch_calloc( 1, sizeof(ObjectClass) ); AC_MEMCPY( &soc->soc_oclass, oc, sizeof(LDAPObjectClass) );