From 2973d4cd0fe6863841b276d4f73e3c175319c942 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Tue, 26 Jan 2016 13:07:48 +1300 Subject: [PATCH] ldb controls: base64 encode VLV response context strings Pair-programmed-with: Douglas Bagnall Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett --- lib/ldb/common/ldb_controls.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ldb/common/ldb_controls.c b/lib/ldb/common/ldb_controls.c index af056d09a5a..500805c5459 100644 --- a/lib/ldb/common/ldb_controls.c +++ b/lib/ldb/common/ldb_controls.c @@ -310,14 +310,20 @@ char *ldb_control_to_string(TALLOC_CTX *mem_ctx, const struct ldb_control *contr struct ldb_vlv_resp_control *rep_control = talloc_get_type(control->data, struct ldb_vlv_resp_control); - res = talloc_asprintf(mem_ctx, "%s:%d:%d:%d:%d:%d:%s", + char *cookie; + const uint8_t *c = (uint8_t*) rep_control->contextId; + + cookie = ldb_base64_encode(mem_ctx, + rep_control->contextId, + rep_control->ctxid_len); + + res = talloc_asprintf(mem_ctx, "%s:%d:%d:%d:%d:%s", LDB_CONTROL_VLV_RESP_NAME, control->critical, rep_control->targetPosition, rep_control->contentCount, rep_control->vlv_result, - rep_control->ctxid_len, - rep_control->contextId); + cookie); return res; }