summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/samldb.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-12 06:10:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:41 -0500
commita599edf04cbdeef9014923ba0d3713b8ff84f266 (patch)
tree3754385df962fd26fe8bd0e16f3c3b706a385c24 /source4/dsdb/samdb/ldb_modules/samldb.c
parent655138602c75925a6d655841ee80cf5346a9a399 (diff)
downloadsamba-a599edf04cbdeef9014923ba0d3713b8ff84f266.tar.gz
samba-a599edf04cbdeef9014923ba0d3713b8ff84f266.tar.bz2
samba-a599edf04cbdeef9014923ba0d3713b8ff84f266.zip
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)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/samldb.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c17
1 files changed, 9 insertions, 8 deletions
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;