summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-11 03:46:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:02 -0500
commite29e30d0688afaaf9d7c26972e82dcb4b3788ccd (patch)
tree2a3ab67274111a67a2cfcc822ff39c39ec367446 /source4
parent8d62a6ba2cf223ae99f1c10b6d3593328de83ef5 (diff)
downloadsamba-e29e30d0688afaaf9d7c26972e82dcb4b3788ccd.tar.gz
samba-e29e30d0688afaaf9d7c26972e82dcb4b3788ccd.tar.bz2
samba-e29e30d0688afaaf9d7c26972e82dcb4b3788ccd.zip
r16937: Add const, to make it clear that it is invalid to talloc_free() the DN
at this point. Andrew Bartlett (This used to be commit f7fb168ab69e39ab3ff236bb5db4e5306a79971d)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index e2a3201884..3473ed3ac1 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -762,7 +762,7 @@ int ltdb_search_indexed(struct ldb_async_handle *handle)
static int ltdb_index_add1_new(struct ldb_context *ldb,
struct ldb_message *msg,
struct ldb_message_element *el,
- char *dn)
+ const char *dn)
{
struct ldb_message_element *el2;
@@ -784,7 +784,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 = (uint8_t *)dn;
+ msg->elements[msg->num_elements].values[0].data = discard_const_p(uint8_t, dn);
msg->elements[msg->num_elements].num_values = 1;
msg->num_elements++;
@@ -800,7 +800,7 @@ static int ltdb_index_add1_add(struct ldb_context *ldb,
struct ldb_message *msg,
struct ldb_message_element *el,
int idx,
- char *dn)
+ const char *dn)
{
struct ldb_val *v2;
unsigned int i;
@@ -821,7 +821,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 = (uint8_t *)dn;
+ msg->elements[idx].values[msg->elements[idx].num_values].data = discard_const_p(uint8_t, dn);
msg->elements[idx].num_values++;
return 0;
@@ -830,7 +830,7 @@ static int ltdb_index_add1_add(struct ldb_context *ldb,
/*
add an index entry for one message element
*/
-static int ltdb_index_add1(struct ldb_module *module, char *dn,
+static int ltdb_index_add1(struct ldb_module *module, const char *dn,
struct ldb_message_element *el, int v_idx)
{
struct ldb_context *ldb = module->ldb;
@@ -886,7 +886,7 @@ static int ltdb_index_add1(struct ldb_module *module, char *dn,
return ret;
}
-static int ltdb_index_add0(struct ldb_module *module, char *dn,
+static int ltdb_index_add0(struct ldb_module *module, const char *dn,
struct ldb_message_element *elements, int num_el)
{
struct ltdb_private *ltdb = module->private_data;
@@ -911,7 +911,6 @@ static int ltdb_index_add0(struct ldb_module *module, char *dn,
for (j = 0; j < elements[i].num_values; j++) {
ret = ltdb_index_add1(module, dn, &elements[i], j);
if (ret == -1) {
- talloc_free(dn);
return -1;
}
}