#include "lutil.h"
#include "config.h"
+#include "../../../libraries/liblber/lber-int.h" /* ber_rewind */
+
/* RFC2891: Server Side Sorting
* RFC2696: Paged Results
*/
typedef struct sort_ctrl {
int sc_nkeys;
- sort_key sc_keys[0];
+ sort_key sc_keys[1];
} sort_ctrl;
ch_free( so );
}
-static int send_list(
+static void send_list(
Operation *op,
SlapReply *rs,
sort_op *so)
"%s: response control: status=%d, text=%s\n",
debug_header, rs->sr_err, SAFESTR(rs->sr_text, "<None>"));
+ if ( !so->so_tree )
+ return;
+
/* RFC 2891: If critical then send the entries iff they were
* succesfully sorted. If non-critical send all entries
* whether they were sorted or not.
} else {
so->so_paged = 0;
so->so_page_size = 0;
- if ( vc )
+ if ( vc ) {
so->so_vlv = op->o_ctrlflag[vlv_cid];
+ so->so_vlv_target = 0;
+ so->so_vlv_rc = 0;
+ }
}
so->so_vcontext = (unsigned long)so;
so->so_nentries = 0;
i = count_key( ber );
sc = op->o_tmpalloc( sizeof(sort_ctrl) +
- i * sizeof(sort_key), op->o_tmpmemctx );
+ (i-1) * sizeof(sort_key), op->o_tmpmemctx );
sc->sc_nkeys = i;
op->o_controls[sss_cid] = sc;
{
slap_overinst *on = (slap_overinst *)be->bd_info;
sssvlv_info *si = on->on_bi.bi_private;
+ int rc;
/* If not set, default to 1/2 of available threads */
if ( !si->svi_max )
si->svi_max = connection_pool_max / 2;
- int rc = overlay_register_control( be, LDAP_CONTROL_SORTREQUEST );
+ rc = overlay_register_control( be, LDAP_CONTROL_SORTREQUEST );
if ( rc == LDAP_SUCCESS )
rc = overlay_register_control( be, LDAP_CONTROL_VLVREQUEST );
return rc;