Commit 0c65f51a authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

fix user/operational mix of attribute request

parent 66a66db3
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
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