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/dsdb/samdb/ldb_modules/samldb.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/samldb.c') diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 906a2299f7..5ed84cc10d 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -107,17 +107,17 @@ static int samldb_allocate_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx els[1].flags = LDB_FLAG_MOD_ADD; els[1].name = els[0].name; - vals[0].data = talloc_asprintf(mem_ctx, "%u", *id); + vals[0].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", *id); if (!vals[0].data) { return -1; } - vals[0].length = strlen(vals[0].data); + vals[0].length = strlen((char *)vals[0].data); - vals[1].data = talloc_asprintf(mem_ctx, "%u", (*id)+1); + vals[1].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", (*id)+1); if (!vals[1].data) { return -1; } - vals[1].length = strlen(vals[1].data); + vals[1].length = strlen((char *)vals[1].data); ret = ldb_modify(ldb, &msg); if (ret != 0) { @@ -240,7 +240,8 @@ static struct ldb_message_element *samldb_find_attribute(const struct ldb_messag return &msg->elements[i]; } for (j = 0; j < msg->elements[i].num_values; j++) { - if (strcasecmp(value, msg->elements[i].values[j].data) == 0) { + if (strcasecmp(value, + (char *)msg->elements[i].values[j].data) == 0) { return &msg->elements[i]; } } @@ -260,7 +261,7 @@ static BOOL samldb_msg_add_string(struct ldb_module *module, struct ldb_message return False; } - if (ldb_msg_add_string(module->ldb, msg, aname, aval) != 0) { + if (ldb_msg_add_string(msg, aname, aval) != 0) { return False; } @@ -276,7 +277,7 @@ static BOOL samldb_msg_add_sid(struct ldb_module *module, struct ldb_message *ms if (!NT_STATUS_IS_OK(status)) { return -1; } - return (ldb_msg_add_value(module->ldb, msg, name, &v) == 0); + return (ldb_msg_add_value(msg, name, &v) == 0); } static BOOL samldb_find_or_add_attribute(struct ldb_module *module, struct ldb_message *msg, const char *name, const char *value, const char *set_value) @@ -497,7 +498,7 @@ static struct ldb_message *samldb_fill_foreignSecurityPrincipal_object(struct ld } if ((attribute = samldb_find_attribute(msg2, "objectSid", NULL)) == NULL ) { - struct dom_sid *sid = dom_sid_parse_talloc(msg2, rdn->value.data); + struct dom_sid *sid = dom_sid_parse_talloc(msg2, (char *)rdn->value.data); if (sid == NULL) { ldb_debug(module->ldb, LDB_DEBUG_FATAL, "samldb_fill_foreignSecurityPrincipal_object: internal error! Can't parse sid in CN\n"); return NULL; -- cgit