Commit bb3e14dd authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

honor requested attrs (ITS#6254), including operational

parent f283f7ad
...@@ -770,6 +770,7 @@ typedef struct trans_ctx { ...@@ -770,6 +770,7 @@ typedef struct trans_ctx {
Avlnode *list; Avlnode *list;
int step; int step;
int slimit; int slimit;
AttributeName *attrs;
} trans_ctx; } trans_ctx;
static int translucent_search_cb(Operation *op, SlapReply *rs) { static int translucent_search_cb(Operation *op, SlapReply *rs) {
...@@ -795,6 +796,11 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) { ...@@ -795,6 +796,11 @@ static int translucent_search_cb(Operation *op, SlapReply *rs) {
rs->sr_entry->e_name.bv_val, 0, 0); rs->sr_entry->e_name.bv_val, 0, 0);
op->ors_slimit = tc->slimit + ( tc->slimit > 0 ? 1 : 0 ); op->ors_slimit = tc->slimit + ( tc->slimit > 0 ? 1 : 0 );
if ( op->ors_attrs == slap_anlist_all_attributes ) {
op->ors_attrs = tc->attrs;
rs->sr_attrs = tc->attrs;
rs->sr_attr_flags = slap_attr_flags( rs->sr_attrs );
}
on = tc->on; on = tc->on;
ov = on->on_bi.bi_private; ov = on->on_bi.bi_private;
...@@ -1106,16 +1112,16 @@ static int translucent_search(Operation *op, SlapReply *rs) { ...@@ -1106,16 +1112,16 @@ static int translucent_search(Operation *op, SlapReply *rs) {
tc.orig = op->ors_filter; tc.orig = op->ors_filter;
tc.list = NULL; tc.list = NULL;
tc.step = 0; tc.step = 0;
tc.slimit = op->ors_slimit;
tc.attrs = NULL;
fbv = op->ors_filterstr; fbv = op->ors_filterstr;
op->o_callback = &cb; op->o_callback = &cb;
tc.slimit = op->ors_slimit;
if ( fr || !fl ) { if ( fr || !fl ) {
AttributeName *attrs = op->ors_attrs; tc.attrs = op->ors_attrs;
op->ors_slimit = SLAP_NO_LIMIT; op->ors_slimit = SLAP_NO_LIMIT;
op->ors_attrs = NULL; op->ors_attrs = slap_anlist_all_attributes;
op->o_bd = &ov->db; op->o_bd = &ov->db;
tc.step |= RMT_SIDE; tc.step |= RMT_SIDE;
if ( fl ) { if ( fl ) {
...@@ -1124,7 +1130,7 @@ static int translucent_search(Operation *op, SlapReply *rs) { ...@@ -1124,7 +1130,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
filter2bv_x( op, fr, &op->ors_filterstr ); filter2bv_x( op, fr, &op->ors_filterstr );
} }
rc = ov->db.bd_info->bi_op_search(op, rs); rc = ov->db.bd_info->bi_op_search(op, rs);
op->ors_attrs = attrs; op->ors_attrs = tc.attrs;
op->o_bd = tc.db; op->o_bd = tc.db;
if ( fl ) { if ( fl ) {
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx ); op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
...@@ -1141,6 +1147,7 @@ static int translucent_search(Operation *op, SlapReply *rs) { ...@@ -1141,6 +1147,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
op->ors_filter = tc.orig; op->ors_filter = tc.orig;
op->o_callback = cb.sc_next; op->o_callback = cb.sc_next;
rs->sr_attrs = op->ors_attrs; rs->sr_attrs = op->ors_attrs;
rs->sr_attr_flags = slap_attr_flags( rs->sr_attrs );
/* Send out anything remaining on the list and finish */ /* Send out anything remaining on the list and finish */
if ( tc.step & USE_LIST ) { if ( tc.step & USE_LIST ) {
......
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