From: Howard Chu Date: Mon, 13 Jul 2009 12:40:35 +0000 (+0000) Subject: More VLV stuff X-Git-Tag: ACLCHECK_0~433 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2e4da3f9eeb1c41bb90294c2a710cdb51f4db585;p=openldap More VLV stuff --- diff --git a/servers/slapd/overlays/sssvlv.c b/servers/slapd/overlays/sssvlv.c index e1f2464dc4..ac7fd392cd 100644 --- a/servers/slapd/overlays/sssvlv.c +++ b/servers/slapd/overlays/sssvlv.c @@ -166,6 +166,8 @@ static int node_cmp( const void* val1, const void* val2 ) mr = sc->sc_keys[i].sk_ordering; mr->smr_match( &cmp, 0, mr->smr_syntax, mr, &sn1->sn_vals[i], &sn2->sn_vals[i] ); + if ( cmp ) + cmp *= sc->sc_keys[i].sk_direction; } } return cmp; @@ -470,7 +472,9 @@ range_err: break; } cur_node = tavl_next( cur_node, TAVL_DIR_RIGHT ); + if ( !cur_node ) break; } + so->so_vlv_rc = LDAP_SUCCESS; op->o_bd = be; } @@ -559,8 +563,12 @@ static void send_result( int rc; rc = pack_sss_response_control( op, rs, ctrls ); - if ( rc == LDAP_SUCCESS && so->so_paged > SLAP_CONTROL_IGNORED ) { - rc = pack_pagedresult_response_control( op, rs, so, ctrls+1 ); + if ( rc == LDAP_SUCCESS ) { + if ( so->so_paged > SLAP_CONTROL_IGNORED ) { + rc = pack_pagedresult_response_control( op, rs, so, ctrls+1 ); + } else if ( so->so_vlv > SLAP_CONTROL_IGNORED ) { + rc = pack_vlv_response_control( op, rs, so, ctrls+1 ); + } ctrls[2] = NULL; } else { ctrls[1] = NULL; @@ -1032,7 +1040,7 @@ static int vlv_parseCtrl( tag = ber_peek_tag( ber, &len ); if ( tag == LDAP_VLVBYINDEX_IDENTIFIER ) { - tag = ber_scanf( ber, "ii", &vc2.vc_offset, &vc2.vc_count ); + tag = ber_scanf( ber, "{ii}", &vc2.vc_offset, &vc2.vc_count ); if ( tag == LBER_ERROR ) return rs->sr_err; BER_BVZERO( &vc2.vc_value );