summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c13
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c28
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_pack.c14
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c16
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c2
5 files changed, 36 insertions, 37 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index 5e40b8fd3f..01f9338009 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -95,7 +95,7 @@ static int ltdb_attributes_flags(struct ldb_message_element *el, unsigned *v)
int j;
for (j=0;ltdb_valid_attr_flags[j].name;j++) {
if (strcmp(ltdb_valid_attr_flags[j].name,
- el->values[i].data) == 0) {
+ (char *)el->values[i].data) == 0) {
value |= ltdb_valid_attr_flags[j].value;
break;
}
@@ -197,7 +197,8 @@ static int ltdb_subclasses_load(struct ldb_module *module)
for (i=0;i<msg->num_elements;i++) {
struct ldb_message_element *el = &msg->elements[i];
for (j=0;j<el->num_values;j++) {
- if (ldb_subclass_add(module->ldb, el->name, el->values[j].data) != 0) {
+ if (ldb_subclass_add(module->ldb, el->name,
+ (char *)el->values[j].data) != 0) {
goto failed;
}
}
@@ -268,7 +269,7 @@ static int ltdb_baseinfo_init(struct ldb_module *module)
el.values = &val;
el.num_values = 1;
el.flags = 0;
- val.data = talloc_strdup(msg, initial_sequence_number);
+ val.data = (uint8_t *)talloc_strdup(msg, initial_sequence_number);
if (!val.data) {
goto failed;
}
@@ -446,7 +447,7 @@ int ltdb_increase_sequence_number(struct ldb_module *module)
el.values = &val;
el.num_values = 1;
el.flags = LDB_FLAG_MOD_REPLACE;
- val.data = s;
+ val.data = (uint8_t *)s;
val.length = strlen(s);
ret = ltdb_modify_internal(module, msg);
@@ -495,7 +496,7 @@ int ltdb_attribute_flags(struct ldb_module *module, const char *attr_name)
for (i = 0; i < attr_el->num_values; i++) {
for (j=0; ltdb_valid_attr_flags[j].name; j++) {
if (strcmp(ltdb_valid_attr_flags[j].name,
- attr_el->values[i].data) == 0) {
+ (char *)attr_el->values[i].data) == 0) {
ret |= ltdb_valid_attr_flags[j].value;
}
}
@@ -514,7 +515,7 @@ int ltdb_check_at_attributes_values(const struct ldb_val *value)
int i;
for (i = 0; ltdb_valid_attr_flags[i].name != NULL; i++) {
- if ((strcmp(ltdb_valid_attr_flags[i].name, value->data) == 0)) {
+ if ((strcmp(ltdb_valid_attr_flags[i].name, (char *)value->data) == 0)) {
return 0;
}
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index 7c920dd78b..e80cf74c62 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -120,7 +120,7 @@ static struct ldb_dn *ldb_dn_key(struct ldb_context *ldb,
return NULL;
}
if (ldb_should_b64_encode(&v)) {
- char *vstr = ldb_base64_encode(ldb, v.data, v.length);
+ char *vstr = ldb_base64_encode(ldb, (char *)v.data, v.length);
if (!vstr) return NULL;
dn = talloc_asprintf(ldb, "%s:%s::%s", LTDB_INDEX, attr_folded, vstr);
talloc_free(vstr);
@@ -261,7 +261,7 @@ static int ltdb_index_dn_objectclass(struct ldb_module *module,
struct ldb_context *ldb = module->ldb;
unsigned int i;
int ret;
- const char *target = tree->u.equality.value.data;
+ const char *target = (const char *)tree->u.equality.value.data;
const char **subclasses;
list->count = 0;
@@ -279,17 +279,19 @@ static int ltdb_index_dn_objectclass(struct ldb_module *module,
struct ldb_parse_tree tree2;
struct dn_list *list2;
tree2.operation = LDB_OP_EQUALITY;
- tree2.u.equality.attr = talloc_strdup(list, LTDB_OBJECTCLASS);
+ tree2.u.equality.attr = LTDB_OBJECTCLASS;
if (!tree2.u.equality.attr) {
return -1;
}
- tree2.u.equality.value.data = talloc_strdup(tree2.u.equality.attr, subclasses[i]);
+ tree2.u.equality.value.data =
+ (uint8_t *)talloc_strdup(list, subclasses[i]);
if (tree2.u.equality.value.data == NULL) {
return -1;
}
tree2.u.equality.value.length = strlen(subclasses[i]);
list2 = talloc(list, struct dn_list);
if (list2 == NULL) {
+ talloc_free(tree2.u.equality.value.data);
return -1;
}
if (ltdb_index_dn_objectclass(module, &tree2,
@@ -302,7 +304,7 @@ static int ltdb_index_dn_objectclass(struct ldb_module *module,
talloc_free(list2);
}
}
- talloc_free(tree2.u.equality.attr);
+ talloc_free(tree2.u.equality.value.data);
}
return ret;
@@ -747,7 +749,7 @@ static int ltdb_index_add1_new(struct ldb_context *ldb,
return -1;
}
msg->elements[msg->num_elements].values[0].length = strlen(dn);
- msg->elements[msg->num_elements].values[0].data = dn;
+ msg->elements[msg->num_elements].values[0].data = (uint8_t *)dn;
msg->elements[msg->num_elements].num_values = 1;
msg->num_elements++;
@@ -770,7 +772,7 @@ static int ltdb_index_add1_add(struct ldb_context *ldb,
/* for multi-valued attributes we can end up with repeats */
for (i=0;i<msg->elements[idx].num_values;i++) {
- if (strcmp(dn, msg->elements[idx].values[i].data) == 0) {
+ if (strcmp(dn, (char *)msg->elements[idx].values[i].data) == 0) {
return 0;
}
}
@@ -784,7 +786,7 @@ static int ltdb_index_add1_add(struct ldb_context *ldb,
msg->elements[idx].values = v2;
msg->elements[idx].values[msg->elements[idx].num_values].length = strlen(dn);
- msg->elements[idx].values[msg->elements[idx].num_values].data = dn;
+ msg->elements[idx].values[msg->elements[idx].num_values].data = (uint8_t *)dn;
msg->elements[idx].num_values++;
return 0;
@@ -1027,7 +1029,7 @@ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg)
static int delete_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *state)
{
const char *dn = "DN=" LTDB_INDEX ":";
- if (strncmp(key.dptr, dn, strlen(dn)) == 0) {
+ if (strncmp((char *)key.dptr, dn, strlen(dn)) == 0) {
return tdb_delete(tdb, key);
}
return 0;
@@ -1044,8 +1046,8 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
int ret;
TDB_DATA key2;
- if (strncmp(key.dptr, "DN=@", 4) == 0 ||
- strncmp(key.dptr, "DN=", 3) != 0) {
+ if (strncmp((char *)key.dptr, "DN=@", 4) == 0 ||
+ strncmp((char *)key.dptr, "DN=", 3) != 0) {
return 0;
}
@@ -1070,14 +1072,14 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
talloc_free(msg);
return 0;
}
- if (strcmp(key2.dptr, key.dptr) != 0) {
+ if (strcmp((char *)key2.dptr, (char *)key.dptr) != 0) {
tdb_delete(tdb, key);
tdb_store(tdb, key2, data, 0);
}
talloc_free(key2.dptr);
if (msg->dn == NULL) {
- dn = key.dptr + 3;
+ dn = (char *)key.dptr + 3;
} else {
dn = ldb_dn_linearize(msg->dn, msg->dn);
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index 332dbf03df..bf57aa904c 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c
@@ -75,7 +75,7 @@ int ltdb_pack_data(struct ldb_module *module,
unsigned int i, j, real_elements=0;
size_t size;
char *dn;
- char *p;
+ uint8_t *p;
size_t len;
dn = ldb_dn_linearize(ldb, message->dn);
@@ -106,7 +106,7 @@ int ltdb_pack_data(struct ldb_module *module,
}
/* allocate it */
- data->dptr = talloc_array(ldb, char, size);
+ data->dptr = talloc_array(ldb, uint8_t, size);
if (!data->dptr) {
talloc_free(dn);
errno = ENOMEM;
@@ -157,7 +157,7 @@ int ltdb_unpack_data(struct ldb_module *module,
struct ldb_message *message)
{
struct ldb_context *ldb = module->ldb;
- char *p;
+ uint8_t *p;
unsigned int remaining;
unsigned int i, j;
unsigned format;
@@ -183,12 +183,12 @@ int ltdb_unpack_data(struct ldb_module *module,
break;
case LTDB_PACKING_FORMAT:
- len = strnlen(p, remaining);
+ len = strnlen((char *)p, remaining);
if (len == remaining) {
errno = EIO;
goto failed;
}
- message->dn = ldb_dn_explode(message, p);
+ message->dn = ldb_dn_explode(message, (char *)p);
if (message->dn == NULL) {
errno = ENOMEM;
goto failed;
@@ -226,13 +226,13 @@ int ltdb_unpack_data(struct ldb_module *module,
errno = EIO;
goto failed;
}
- len = strnlen(p, remaining-6);
+ len = strnlen((char *)p, remaining-6);
if (len == remaining-6) {
errno = EIO;
goto failed;
}
message->elements[i].flags = 0;
- message->elements[i].name = p;
+ message->elements[i].name = (char *)p;
remaining -= len + 1;
p += len + 1;
message->elements[i].num_values = pull_uint32(p, 0);
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index e0a62962c7..97f8a7d0be 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -100,17 +100,13 @@ static int msg_add_distinguished_name(struct ldb_module *module, struct ldb_mess
int ret;
el.flags = 0;
- el.name = talloc_strdup(msg, "distinguishedName");
- if (!el.name) {
- return -1;
- }
+ el.name = "distinguishedName";
el.num_values = 1;
el.values = &val;
- val.data = ldb_dn_linearize(msg, msg->dn);
- val.length = strlen(val.data);
+ val.data = (uint8_t *)ldb_dn_linearize(msg, msg->dn);
+ val.length = strlen((char *)val.data);
ret = msg_add_element(module->ldb, msg, &el, 1);
- talloc_free(el.name);
return ret;
}
@@ -190,7 +186,7 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module,
if (ldb_attr_cmp(attrs[i], "distinguishedName") == 0) {
if (msg_add_distinguished_name(module, ret) != 0) {
- return -1;
+ return NULL;
}
continue;
}
@@ -358,7 +354,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
int ret;
if (key.dsize < 4 ||
- strncmp(key.dptr, "DN=", 3) != 0) {
+ strncmp((char *)key.dptr, "DN=", 3) != 0) {
return 0;
}
@@ -376,7 +372,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
}
if (!msg->dn) {
- msg->dn = ldb_dn_explode(msg, key.dptr + 3);
+ msg->dn = ldb_dn_explode(msg, (char *)key.dptr + 3);
if (msg->dn == NULL) {
talloc_free(msg);
return -1;
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 22360ffb1c..b9404a557b 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -80,7 +80,7 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn)
goto failed;
}
- key.dptr = key_str;
+ key.dptr = (uint8_t *)key_str;
key.dsize = strlen(key_str) + 1;
return key;