Commit 05b81e62 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

cleanup attr flags; provide a helper

parent f1b5d4b2
......@@ -974,6 +974,7 @@ LDAP_SLAPD_F (int) slap_read_controls LDAP_P(( Operation *op, SlapReply *rs,
LDAP_SLAPD_F (int) str2result LDAP_P(( char *s,
int *code, char **matched, char **info ));
LDAP_SLAPD_F (int) slap_map_api2result LDAP_P(( SlapReply *rs ));
LDAP_SLAPD_F (slap_mask_t) slap_attr_flags LDAP_P(( AttributeName *an ));
LDAP_SLAPD_V( const struct berval ) slap_dummy_bv;
......
......@@ -786,15 +786,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
/* FIXME: maybe we could se this flag at the operation level;
* however, in principle the caller of send_search_entry() may
* change the attribute list at each call */
if ( rs->sr_attrs == NULL ) {
rs->sr_attr_flags = ( SLAP_OPATTRS_NO | SLAP_USERATTRS_YES );
} else {
rs->sr_attr_flags |= an_find( rs->sr_attrs, &AllOper ) ?
SLAP_OPATTRS_YES : SLAP_OPATTRS_NO;
rs->sr_attr_flags |= an_find( rs->sr_attrs, &AllUser ) ?
SLAP_USERATTRS_YES : SLAP_USERATTRS_NO;
}
rs->sr_attr_flags = slap_attr_flags( rs->sr_attrs );
rc = backend_operational( op, rs );
if ( rc ) {
......@@ -1838,3 +1830,20 @@ slap_map_api2result( SlapReply *rs )
}
}
slap_mask_t
slap_attr_flags( AttributeName *an )
{
slap_mask_t flags = SLAP_ATTRS_UNDEFINED;
if ( an == NULL ) {
flags |= ( SLAP_OPATTRS_NO | SLAP_USERATTRS_YES );
} else {
flags |= an_find( an, &AllOper ) ? SLAP_OPATTRS_YES : SLAP_OPATTRS_NO;
flags |= an_find( an, &AllUser ) ? SLAP_USERATTRS_YES : SLAP_USERATTRS_NO;
}
return flags;
}
......@@ -1691,16 +1691,16 @@ typedef struct rep_extended_s {
typedef struct rep_search_s {
Entry *r_entry;
int r_attr_flags;
#define SLAP_ATTRS_UNDEFINED (0)
#define SLAP_OPATTRS_NO (0x01)
#define SLAP_OPATTRS_YES (0x02)
#define SLAP_USERATTRS_NO (0x10)
#define SLAP_USERATTRS_YES (0x20)
slap_mask_t r_attr_flags;
#define SLAP_ATTRS_UNDEFINED (0x00U)
#define SLAP_OPATTRS_NO (0x01U)
#define SLAP_OPATTRS_YES (0x02U)
#define SLAP_USERATTRS_NO (0x10U)
#define SLAP_USERATTRS_YES (0x20U)
#define SLAP_OPATTRS_MASK(f) ( (f) & (SLAP_OPATTRS_NO|SLAP_OPATTRS_YES) )
#define SLAP_OPATTRS(f) ( (f) & SLAP_OPATTRS_YES )
#define SLAP_OPATTRS(f) ( ( (f) & SLAP_OPATTRS_YES ) == SLAP_OPATTRS_YES )
#define SLAP_USERATTRS_MASK(f) ( (f) & (SLAP_USERATTRS_NO|SLAP_USERATTRS_YES) )
#define SLAP_USERATTRS(f) ( (f) & SLAP_USERATTRS_YES )
#define SLAP_USERATTRS(f) ( ( (f) & SLAP_USERATTRS_YES ) == SLAP_USERATTRS_YES )
Attribute *r_operational_attrs;
AttributeName *r_attrs;
int r_nentries;
......
Markdown is supported
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