From a599edf04cbdeef9014923ba0d3713b8ff84f266 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Oct 2005 06:10:23 +0000 Subject: r10913: This patch isn't as big as it looks ... most of the changes are fixes to make all the ldb code compile without warnings on gcc4. Unfortunately That required a lot of casts :-( I have also added the start of an 'operational' module, which will replace the timestamp module, plus add support for some other operational attributes In ldb_msg_*() I added some new utility functions to make the operational module sane, and remove the 'ldb' argument from the ldb_msg_add_*() functions. That argument was only needed back in the early days of ldb when we didn't use the hierarchical talloc and thus needed a place to get the allocation function from. Now its just a pain to pass around everywhere. Also added a ldb_debug_set() function that calls ldb_debug() plus sets the result using ldb_set_errstring(). That saves on some awkward coding in a few places. (This used to be commit f6818daecca95760c12f79fd307770cbe3346f57) --- source4/lib/ldb/common/ldb_ldif.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source4/lib/ldb/common/ldb_ldif.c') diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c index b268cca578..7ba6a00147 100644 --- a/source4/lib/ldb/common/ldb_ldif.c +++ b/source4/lib/ldb/common/ldb_ldif.c @@ -55,7 +55,7 @@ static int ldb_read_data_file(void *mem_ctx, struct ldb_val *value) int ret; int f; - f = open(value->data, O_RDONLY); + f = open((const char *)value->data, O_RDONLY); if (f == -1) { return -1; } @@ -79,7 +79,7 @@ static int ldb_read_data_file(void *mem_ctx, struct ldb_val *value) count = 0; size = statbuf.st_size; - buf = value->data; + buf = (char *)value->data; while (count < statbuf.st_size) { bytes = read(f, buf, size); if (bytes == -1) { @@ -325,7 +325,7 @@ int ldb_ldif_write(struct ldb_context *ldb, msg->elements[i].name); CHECK_RET; ret = base64_encode_f(ldb, fprintf_fn, private_data, - v.data, v.length, + (char *)v.data, v.length, strlen(msg->elements[i].name)+3); CHECK_RET; ret = fprintf_fn(private_data, "\n"); @@ -334,7 +334,7 @@ int ldb_ldif_write(struct ldb_context *ldb, ret = fprintf_fn(private_data, "%s: ", msg->elements[i].name); CHECK_RET; ret = fold_string(fprintf_fn, private_data, - v.data, v.length, + (char *)v.data, v.length, strlen(msg->elements[i].name)+2); CHECK_RET; ret = fprintf_fn(private_data, "\n"); @@ -461,7 +461,7 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val p++; } - value->data = p; + value->data = (uint8_t *)p; p = strchr(p, '\n'); @@ -475,7 +475,7 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val } if (base64_encoded) { - int len = ldb_base64_decode(value->data); + int len = ldb_base64_decode((char *)value->data); if (len == -1) { /* it wasn't valid base64 data */ return -1; @@ -588,7 +588,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb, goto failed; } - msg->dn = ldb_dn_explode(msg, value.data); + msg->dn = ldb_dn_explode(msg, (char *)value.data); if (msg->dn == NULL) { ldb_debug(ldb, LDB_DEBUG_ERROR, "Error: Unable to parse dn '%s'\n", -- cgit