Skip to content

Commit

Permalink
ldb controls: use uint8_t* for contextID binary blob
Browse files Browse the repository at this point in the history
It is never a readable string.

Signed-off-by: Douglas Bagnall <[email protected]>
Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
  • Loading branch information
douglasbagnall authored and abartlet committed Mar 9, 2016
1 parent fe2bcf9 commit 16fda12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/ldb/common/ldb_controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,9 @@ char *ldb_control_to_string(TALLOC_CTX *mem_ctx, const struct ldb_control *contr
struct ldb_vlv_resp_control);

char *cookie;
const uint8_t *c = (uint8_t*) rep_control->contextId;

cookie = ldb_base64_encode(mem_ctx,
rep_control->contextId,
(char *)rep_control->contextId,
rep_control->ctxid_len);

res = talloc_asprintf(mem_ctx, "%s:%d:%d:%d:%d:%s",
Expand Down Expand Up @@ -497,7 +496,7 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
}
if (ctxid[0]) {
control->ctxid_len = ldb_base64_decode(ctxid);
control->contextId = (char *)talloc_memdup(control, ctxid, control->ctxid_len);
control->contextId = talloc_memdup(control, ctxid, control->ctxid_len);
} else {
control->ctxid_len = 0;
control->contextId = NULL;
Expand Down
4 changes: 2 additions & 2 deletions lib/ldb/include/ldb.h
Original file line number Diff line number Diff line change
Expand Up @@ -849,15 +849,15 @@ struct ldb_vlv_req_control {
} gtOrEq;
} match;
int ctxid_len;
char *contextId;
uint8_t *contextId;
};

struct ldb_vlv_resp_control {
int targetPosition;
int contentCount;
int vlv_result;
int ctxid_len;
char *contextId;
uint8_t *contextId;
};

struct ldb_verify_name_control {
Expand Down

0 comments on commit 16fda12

Please sign in to comment.