From 1f28047ab5f6bac924044e8f935ef7539b671ccf Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 9 Dec 2001 02:46:25 +0000 Subject: [PATCH] Added referrals to gluestate. --- servers/slapd/backglue.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index cd2363ee97..1bf44af818 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -189,6 +189,8 @@ typedef struct glue_state { int nentries; int matchlen; char *matched; + int nrefs; + struct berval **refs; } glue_state; void @@ -225,6 +227,27 @@ glue_back_response ( gs->matchlen = len; } } + if (ref) { + int i, j, k; + struct berval **new; + + for (i=0; ref[i]; i++); + + j = gs->nrefs; + if (!j) { + new = ch_malloc ((i+1)*sizeof(struct berval *)); + gs->nrefs = i; + } else { + new = ch_realloc(gs->refs, + (j+i+1)*sizeof(struct berval *)); + } + for (k=0; knrefs = j; + gs->refs = new; + } } void @@ -267,8 +290,7 @@ glue_back_search ( BackendDB *be; int i, rc, t2limit = 0, s2limit = 0; long stoptime = 0; - glue_state gs = - {0}; + glue_state gs = {0}; if (tlimit) @@ -391,11 +413,13 @@ glue_back_search ( op->o_response = NULL; op->o_glue = NULL; - send_search_result (conn, op, gs.err, gs.matched, NULL, NULL, + send_search_result (conn, op, gs.err, gs.matched, NULL, gs.refs, NULL, gs.nentries); - done: +done: if (gs.matched) free (gs.matched); + if (gs.refs) + ber_bvecfree(gs.refs); return rc; } -- 2.39.5