From 0c65f51ab291fff6e9bece0297d116420d12c555 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 30 Nov 2004 01:49:06 +0000 Subject: [PATCH] fix user/operational mix of attribute request --- servers/slapd/back-sql/back-sql.h | 10 ++++++---- servers/slapd/back-sql/entry-id.c | 19 +++++++++++-------- servers/slapd/back-sql/search.c | 10 ++++++++-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/servers/slapd/back-sql/back-sql.h b/servers/slapd/back-sql/back-sql.h index 6ca43efec8..cb6250733c 100644 --- a/servers/slapd/back-sql/back-sql.h +++ b/servers/slapd/back-sql/back-sql.h @@ -269,10 +269,12 @@ typedef struct backsql_srch_info { unsigned bsi_flags; #define BSQL_SF_NONE 0x0000U -#define BSQL_SF_ALL_OPER 0x0001U -#define BSQL_SF_FILTER_HASSUBORDINATE 0x0002U -#define BSQL_SF_FILTER_ENTRYUUID 0x0004U -#define BSQL_SF_FILTER_ENTRYCSN 0x0008U +#define BSQL_SF_ALL_USER 0x0001U +#define BSQL_SF_ALL_OPER 0x0002U +#define BSQL_SF_ALL_ATTRS (BSQL_SF_ALL_USER|BSQL_SF_ALL_OPER) +#define BSQL_SF_FILTER_HASSUBORDINATE 0x0010U +#define BSQL_SF_FILTER_ENTRYUUID 0x0020U +#define BSQL_SF_FILTER_ENTRYCSN 0x0040U #define BSQL_SF_RETURN_ENTRYUUID (BSQL_SF_FILTER_ENTRYUUID << 8) struct berval *bsi_base_ndn; diff --git a/servers/slapd/back-sql/entry-id.c b/servers/slapd/back-sql/entry-id.c index c229a65c8e..d75bfe0dda 100644 --- a/servers/slapd/back-sql/entry-id.c +++ b/servers/slapd/back-sql/entry-id.c @@ -510,7 +510,14 @@ backsql_id2entry( backsql_srch_info *bsi, backsql_entryID *eid ) return rc; } - if ( bsi->bsi_attrs != NULL ) { + if ( bsi->bsi_attrs == NULL || ( bsi->bsi_flags & BSQL_SF_ALL_USER ) ) + { + Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): " + "retrieving all attributes\n", 0, 0, 0 ); + avl_apply( bsi->bsi_oc->bom_attrs, backsql_get_attr_vals, + bsi, 0, AVL_INORDER ); + + } else { Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): " "custom attribute list\n", 0, 0, 0 ); for ( i = 0; bsi->bsi_attrs[ i ].an_name.bv_val; i++ ) { @@ -555,12 +562,6 @@ backsql_id2entry( backsql_srch_info *bsi, backsql_entryID *eid ) next:; } - - } else { - Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): " - "retrieving all attributes\n", 0, 0, 0 ); - avl_apply( bsi->bsi_oc->bom_attrs, backsql_get_attr_vals, - bsi, 0, AVL_INORDER ); } if ( bsi->bsi_flags & BSQL_SF_RETURN_ENTRYUUID ) { @@ -600,7 +601,9 @@ next:; } if ( ( bsi->bsi_flags & BSQL_SF_ALL_OPER ) - || an_find( bsi->bsi_attrs, &AllOper ) ) { + || an_find( bsi->bsi_attrs, &AllOper ) + || an_find( bsi->bsi_attrs, &slap_schema.si_ad_structuralObjectClass->ad_cname ) ) + { rc = attr_merge_normalize_one( bsi->bsi_e, slap_schema.si_ad_structuralObjectClass, &soc, bsi->bsi_op->o_tmpmemctx ); diff --git a/servers/slapd/back-sql/search.c b/servers/slapd/back-sql/search.c index 2351a2e5fd..3fbe8cd13d 100644 --- a/servers/slapd/back-sql/search.c +++ b/servers/slapd/back-sql/search.c @@ -132,8 +132,10 @@ backsql_init_search( /* * handle "*" */ - if ( attrs == NULL || an_find( attrs, &AllUser ) ) { + if ( attrs == NULL ) { + /* also add request for all operational */ bsi->bsi_attrs = NULL; + bsi->bsi_flags |= BSQL_SF_ALL_USER; } else { int got_oc = 0; @@ -146,7 +148,11 @@ backsql_init_search( /* * ignore "1.1"; handle "+" */ - if ( BACKSQL_NCMP( &p->an_name, &AllOper ) == 0 ) { + if ( BACKSQL_NCMP( &p->an_name, &AllUser ) == 0 ) { + bsi->bsi_flags |= BSQL_SF_ALL_USER; + continue; + + } else if ( BACKSQL_NCMP( &p->an_name, &AllOper ) == 0 ) { bsi->bsi_flags |= BSQL_SF_ALL_OPER; continue; -- 2.39.5