From: Howard Chu Date: Sun, 9 Dec 2001 02:46:25 +0000 (+0000) Subject: Added referrals to gluestate. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~691 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1f28047ab5f6bac924044e8f935ef7539b671ccf;p=openldap Added referrals to gluestate. --- 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; }