mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-04 14:10:39 -05:00
Change AttributeName.an_oc_exclude to an_oc_flags, avoid multiple
futile searches for OC matches.
This commit is contained in:
parent
25a06ddd43
commit
82e95f8091
7 changed files with 38 additions and 30 deletions
|
|
@ -2774,7 +2774,7 @@ acl_unparse( AccessControl *a, struct berval *bv )
|
|||
for ( an = a->acl_attrs; an && !BER_BVISNULL( &an->an_name ); an++ ) {
|
||||
if ( ! first ) *ptr++ = ',';
|
||||
if (an->an_oc) {
|
||||
*ptr++ = an->an_oc_exclude ? '!' : '@';
|
||||
*ptr++ = ( an->an_flags & SLAP_AN_OCEXCLUDE ) ? '!' : '@';
|
||||
ptr = lutil_strcopy( ptr, an->an_oc->soc_cname.bv_val );
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -594,29 +594,33 @@ int ad_inlist(
|
|||
* else if requested description is !objectClass, return
|
||||
* attributes which the class does not require/allow
|
||||
*/
|
||||
oc = attrs->an_oc;
|
||||
if( oc == NULL && attrs->an_name.bv_val ) {
|
||||
switch( attrs->an_name.bv_val[0] ) {
|
||||
case '@': /* @objectClass */
|
||||
case '+': /* +objectClass (deprecated) */
|
||||
case '!': { /* exclude */
|
||||
struct berval ocname;
|
||||
ocname.bv_len = attrs->an_name.bv_len - 1;
|
||||
ocname.bv_val = &attrs->an_name.bv_val[1];
|
||||
oc = oc_bvfind( &ocname );
|
||||
attrs->an_oc_exclude = 0;
|
||||
if ( oc && attrs->an_name.bv_val[0] == '!' ) {
|
||||
attrs->an_oc_exclude = 1;
|
||||
}
|
||||
} break;
|
||||
if ( !( attrs->an_flags & SLAP_AN_OCINITED )) {
|
||||
if( attrs->an_name.bv_val ) {
|
||||
switch( attrs->an_name.bv_val[0] ) {
|
||||
case '@': /* @objectClass */
|
||||
case '+': /* +objectClass (deprecated) */
|
||||
case '!': { /* exclude */
|
||||
struct berval ocname;
|
||||
ocname.bv_len = attrs->an_name.bv_len - 1;
|
||||
ocname.bv_val = &attrs->an_name.bv_val[1];
|
||||
oc = oc_bvfind( &ocname );
|
||||
if ( oc && attrs->an_name.bv_val[0] == '!' ) {
|
||||
attrs->an_flags |= SLAP_AN_OCEXCLUDE;
|
||||
} else {
|
||||
attrs->an_flags &= ~SLAP_AN_OCEXCLUDE;
|
||||
}
|
||||
} break;
|
||||
|
||||
default: /* old (deprecated) way */
|
||||
oc = oc_bvfind( &attrs->an_name );
|
||||
default: /* old (deprecated) way */
|
||||
oc = oc_bvfind( &attrs->an_name );
|
||||
}
|
||||
attrs->an_oc = oc;
|
||||
}
|
||||
attrs->an_oc = oc;
|
||||
attrs->an_flags |= SLAP_AN_OCINITED;
|
||||
}
|
||||
oc = attrs->an_oc;
|
||||
if( oc != NULL ) {
|
||||
if ( attrs->an_oc_exclude ) {
|
||||
if ( attrs->an_flags & SLAP_AN_OCEXCLUDE ) {
|
||||
if ( oc == slap_schema.si_oc_extensibleObject ) {
|
||||
/* extensibleObject allows the return of anything */
|
||||
return 0;
|
||||
|
|
@ -932,7 +936,7 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
|
|||
|
||||
anew->an_desc = NULL;
|
||||
anew->an_oc = NULL;
|
||||
anew->an_oc_exclude = 0;
|
||||
anew->an_flags = 0;
|
||||
ber_str2bv(s, 0, 1, &anew->an_name);
|
||||
slap_bv2ad(&anew->an_name, &anew->an_desc, &text);
|
||||
if ( !anew->an_desc ) {
|
||||
|
|
@ -959,7 +963,7 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
|
|||
}
|
||||
|
||||
if ( anew->an_name.bv_val[0] == '!' ) {
|
||||
anew->an_oc_exclude = 1;
|
||||
anew->an_flags |= SLAP_AN_OCEXCLUDE;
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
@ -971,6 +975,7 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
|
|||
}
|
||||
}
|
||||
}
|
||||
anew->an_flags |= SLAP_AN_OCINITED;
|
||||
anew++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1414,7 +1414,7 @@ parseReadAttrs(
|
|||
|
||||
an[i].an_desc = NULL;
|
||||
an[i].an_oc = NULL;
|
||||
an[i].an_oc_exclude = 0;
|
||||
an[i].an_flags = 0;
|
||||
rc = slap_bv2ad( &an[i].an_name, &an[i].an_desc, &dummy );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
an[i].an_name = an[i].an_desc->ad_cname;
|
||||
|
|
|
|||
|
|
@ -1605,7 +1605,7 @@ filter2template(
|
|||
(*filter_attrs)[*filter_cnt].an_desc = ad;
|
||||
(*filter_attrs)[*filter_cnt].an_name = ad->ad_cname;
|
||||
(*filter_attrs)[*filter_cnt].an_oc = NULL;
|
||||
(*filter_attrs)[*filter_cnt].an_oc_exclude = 0;
|
||||
(*filter_attrs)[*filter_cnt].an_flags = 0;
|
||||
BER_BVZERO( &(*filter_attrs)[*filter_cnt+1].an_name );
|
||||
(*filter_cnt)++;
|
||||
if ( ad == slap_schema.si_ad_objectClass )
|
||||
|
|
@ -2202,14 +2202,14 @@ add_filter_attrs(
|
|||
(*new_attrs)[j].an_name = filter_attrs[i].an_name;
|
||||
(*new_attrs)[j].an_desc = filter_attrs[i].an_desc;
|
||||
(*new_attrs)[j].an_oc = NULL;
|
||||
(*new_attrs)[j].an_oc_exclude = 0;
|
||||
(*new_attrs)[j].an_flags = 0;
|
||||
j++;
|
||||
}
|
||||
if ( addoc ) {
|
||||
(*new_attrs)[j].an_name = slap_schema.si_ad_objectClass->ad_cname;
|
||||
(*new_attrs)[j].an_desc = slap_schema.si_ad_objectClass;
|
||||
(*new_attrs)[j].an_oc = NULL;
|
||||
(*new_attrs)[j].an_oc_exclude = 0;
|
||||
(*new_attrs)[j].an_flags = 0;
|
||||
j++;
|
||||
}
|
||||
BER_BVZERO( &(*new_attrs)[j].an_name );
|
||||
|
|
@ -3039,7 +3039,7 @@ pc_cf_gen( ConfigArgs *c )
|
|||
attr_name->an_name = attr_name->an_desc->ad_cname;
|
||||
}
|
||||
attr_name->an_oc = NULL;
|
||||
attr_name->an_oc_exclude = 0;
|
||||
attr_name->an_flags = 0;
|
||||
if ( attr_name->an_desc == slap_schema.si_ad_objectClass )
|
||||
qm->attr_sets[num].flags |= PC_GOT_OC;
|
||||
attr_name++;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ do_search(
|
|||
const char *dummy; /* ignore msgs from bv2ad */
|
||||
op->ors_attrs[i].an_desc = NULL;
|
||||
op->ors_attrs[i].an_oc = NULL;
|
||||
op->ors_attrs[i].an_oc_exclude = 0;
|
||||
op->ors_attrs[i].an_flags = 0;
|
||||
if ( slap_bv2ad( &op->ors_attrs[i].an_name,
|
||||
&op->ors_attrs[i].an_desc, &dummy ) != LDAP_SUCCESS )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -842,10 +842,13 @@ struct AttributeDescription {
|
|||
#define SLAP_AD_PROXIED 0x01U
|
||||
#define SLAP_AD_NOINSERT 0x02U
|
||||
|
||||
#define SLAP_AN_OCEXCLUDE 0x01
|
||||
#define SLAP_AN_OCINITED 0x02
|
||||
|
||||
struct AttributeName {
|
||||
struct berval an_name;
|
||||
AttributeDescription *an_desc;
|
||||
int an_oc_exclude;
|
||||
int an_flags;
|
||||
ObjectClass *an_oc;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1152,7 +1152,7 @@ pblock_set( Slapi_PBlock *pb, int param, void *value )
|
|||
for ( i = 0; attrs[i] != NULL; i++ ) {
|
||||
an[j].an_desc = NULL;
|
||||
an[j].an_oc = NULL;
|
||||
an[j].an_oc_exclude = 0;
|
||||
an[j].an_flags = 0;
|
||||
an[j].an_name.bv_val = attrs[i];
|
||||
an[j].an_name.bv_len = strlen( attrs[i] );
|
||||
if ( slap_bv2ad( &an[j].an_name, &an[j].an_desc, &pb->pb_rs->sr_text ) == LDAP_SUCCESS ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue