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;
/* 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 ) {
}
}
+
+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;
+}
+
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;