Commit 44f0efb4 authored by Howard Chu's avatar Howard Chu
Browse files

Defined some ObjectClass->soc_flags values, changed is_entry_*objectclass

macros to use flags
parent ccc4e64f
......@@ -145,7 +145,7 @@ bdb_group(
goto return_results;
}
if( !is_entry_objectclass( e, group_oc ) ) {
if( !is_entry_objectclass( e, group_oc, 0 ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
"bdb_group: failed to find %s in objectClass.\n",
......
......@@ -68,7 +68,7 @@ ldap_back_group(
/*
* Now we can check for the group objectClass value
*/
if( !is_entry_objectclass( target, group_oc ) ) {
if( !is_entry_objectclass( target, group_oc, 0 ) ) {
return(1);
}
......
......@@ -143,7 +143,7 @@ ldbm_back_group(
goto return_results;
}
if( !is_entry_objectclass( e, group_oc ) ) {
if( !is_entry_objectclass( e, group_oc, 0 ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
"ldbm_back_group: failed to find %s in objectClass.\n",
......
......@@ -129,7 +129,7 @@ meta_back_group(
/*
* Now we can check for the group objectClass value
*/
if ( !is_entry_objectclass( target, group_oc ) ) {
if ( !is_entry_objectclass( target, group_oc, 0 ) ) {
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,15 @@ 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;
}
}
return 0;
e->e_ocflags |= objectClass->soc_flags;
}
e->e_ocflags |= SLAP_OC__END; /* We've finished this */
return (e->e_ocflags & oc->soc_flags);
}
......
......@@ -622,17 +622,22 @@ LDAP_SLAPD_F (int) is_object_subclass LDAP_P((
ObjectClass *sup ));
LDAP_SLAPD_F (int) is_entry_objectclass LDAP_P((
Entry *, ObjectClass *oc ));
Entry *, ObjectClass *oc, int set_flags ));
#define is_entry_alias(e) \
is_entry_objectclass((e), slap_schema.si_oc_alias)
((e)->e_ocflags & SLAP_OC__END) ? ((e)->e_ocflags & SLAP_OC_ALIAS) : \
is_entry_objectclass((e), slap_schema.si_oc_alias, 1)
#define is_entry_referral(e) \
is_entry_objectclass((e), slap_schema.si_oc_referral)
((e)->e_ocflags & SLAP_OC__END) ? ((e)->e_ocflags & SLAP_OC_REFERRAL) : \
is_entry_objectclass((e), slap_schema.si_oc_referral, 1)
#define is_entry_subentry(e) \
is_entry_objectclass((e), slap_schema.si_oc_subentry)
((e)->e_ocflags & SLAP_OC__END) ? ((e)->e_ocflags & SLAP_OC_SUBENTRY) : \
is_entry_objectclass((e), slap_schema.si_oc_subentry, 1)
#define is_entry_collectiveAttributes(e) \
is_entry_objectclass((e), slap_schema.si_oc_collectiveAttributes)
((e)->e_ocflags & SLAP_OC__END) ? ((e)->e_ocflags & SLAP_OC_COLLECTIVEATTRIBUTES) : \
is_entry_objectclass((e), slap_schema.si_oc_collectiveAttributes, 1)
#define is_entry_dynamicObject(e) \
is_entry_objectclass((e), slap_schema.si_oc_dynamicObject)
((e)->e_ocflags & SLAP_OC__END) ? ((e)->e_ocflags & SLAP_OC_DYNAMICOBJECT) : \
is_entry_objectclass((e), slap_schema.si_oc_dynamicObject, 1)
LDAP_SLAPD_F (int) oc_schema_info( Entry *e );
......
......@@ -219,8 +219,8 @@ entry_schema_check(
return LDAP_OBJECT_CLASS_VIOLATION;
}
if ( oc->sco_check ) {
int rc = (oc->sco_check)( be, e, oc,
if ( oc->soc_check ) {
int rc = (oc->soc_check)( be, e, oc,
text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
return rc;
......
......@@ -141,12 +141,12 @@ static struct slap_schema_oc_map {
"DESC 'RFC2256: an alias' "
"SUP top STRUCTURAL "
"MUST aliasedObjectName )",
aliasObjectClass, 0,
aliasObjectClass, SLAP_OC_ALIAS,
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, 0,
referralObjectClass, SLAP_OC_REFERRAL,
offsetof(struct slap_internal_schema, si_oc_referral) },
{ "LDAProotDSE", "( 1.3.6.1.4.1.4203.1.4.1 "
"NAME ( 'OpenLDAProotDSE' 'LDAProotDSE' ) "
......@@ -165,7 +165,7 @@ static struct slap_schema_oc_map {
"MAY ( dITStructureRules $ nameForms $ ditContentRules $ "
"objectClasses $ attributeTypes $ matchingRules $ "
"matchingRuleUse ) )",
subentryObjectClass, 0,
subentryObjectClass, SLAP_OC_SUBENTRY,
offsetof(struct slap_internal_schema, si_oc_subschema) },
{ "monitor", "( 1.3.6.1.4.1.4203.666.3.2 NAME 'monitor' "
"DESC 'OpenLDAP system monitoring' "
......@@ -175,13 +175,13 @@ static struct slap_schema_oc_map {
{ "collectiveAttributes", "( 2.5.20.2 "
"NAME 'collectiveAttributes' "
"AUXILIARY )",
subentryObjectClass, 0,
subentryObjectClass, SLAP_OC_COLLECTIVEATTRIBUTES,
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, 0,
dynamicObjectClass, SLAP_OC_DYNAMICOBJECT,
offsetof(struct slap_internal_schema, si_oc_dynamicObject) },
{ NULL, NULL, NULL, 0, 0 }
};
......@@ -732,10 +732,10 @@ slap_schema_check( void )
if( oc_map[i].ssom_check ) {
/* install check routine */
(*ocp)->sco_check = oc_map[i].ssom_check;
(*ocp)->soc_check = oc_map[i].ssom_check;
}
/* install flags */
(*ocp)->sco_flags |= oc_map[i].ssom_flags;
(*ocp)->soc_flags |= oc_map[i].ssom_flags;
}
++schema_init_done;
......
......@@ -471,8 +471,8 @@ typedef struct slap_object_class {
struct slap_object_class **soc_sups;
AttributeType **soc_required;
AttributeType **soc_allowed;
ObjectClassSchemaCheckFN *sco_check;
slap_mask_t sco_flags;
ObjectClassSchemaCheckFN *soc_check;
slap_mask_t soc_flags;
#define soc_oid soc_oclass.oc_oid
#define soc_names soc_oclass.oc_names
#define soc_desc soc_oclass.oc_desc
......@@ -486,6 +486,14 @@ typedef struct slap_object_class {
struct slap_object_class *soc_next;
} ObjectClass;
#define SLAP_OC_ALIAS 0x01
#define SLAP_OC_REFERRAL 0x02
#define SLAP_OC_SUBENTRY 0x04
#define SLAP_OC_DYNAMICOBJECT 0x08
#define SLAP_OC_COLLECTIVEATTRIBUTES 0x10
#define SLAP_OC__MASK 0x1F
#define SLAP_OC__END 0x20
#ifdef LDAP_EXTENDED_SCHEMA
/*
* DIT content rule
......@@ -746,6 +754,8 @@ typedef struct slap_entry {
Attribute *e_attrs; /* list of attributes + values */
slap_mask_t e_ocflags;
/* for use by the backend for any purpose */
void* e_private;
} Entry;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment