summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_tdb.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-11-22 02:05:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:22 -0500
commita9e31b33b55a873c2f01db5e348560176adf863d (patch)
tree603f4cb99999eea881f6092fb6cbbbcb8daca184 /source4/lib/ldb/ldb_tdb/ldb_tdb.c
parent4889eb9f7aae9349e426d0f6d2217adff67eaebd (diff)
downloadsamba-a9e31b33b55a873c2f01db5e348560176adf863d.tar.gz
samba-a9e31b33b55a873c2f01db5e348560176adf863d.tar.bz2
samba-a9e31b33b55a873c2f01db5e348560176adf863d.zip
r19832: better prototypes for the linearization functions:
- ldb_dn_get_linearized returns a const string - ldb_dn_alloc_linearized allocs astring with the linearized dn (This used to be commit 3929c086d5d0b3f08b1c4f2f3f9602c3f4a9a4bd)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_tdb.c')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index d950ab9cf0..9b05d98a66 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -123,7 +123,7 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn)
struct ldb_context *ldb = module->ldb;
TDB_DATA key;
char *key_str = NULL;
- char *dn_folded = NULL;
+ const char *dn_folded = NULL;
/*
most DNs are case insensitive. The exception is index DNs for
@@ -267,14 +267,7 @@ static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message
ret = ltdb_store(module, msg, TDB_INSERT);
if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
- char *dn;
-
- dn = ldb_dn_linearize(module, msg->dn);
- if (!dn) {
- return ret;
- }
- ldb_asprintf_errstring(module->ldb, "Entry %s already exists", dn);
- talloc_free(dn);
+ ldb_asprintf_errstring(module->ldb, "Entry %s already exists", ldb_dn_get_linearized(msg->dn));
return ret;
}
@@ -504,10 +497,10 @@ static int msg_delete_attribute(struct ldb_module *module,
struct ldb_context *ldb,
struct ldb_message *msg, const char *name)
{
- char *dn;
+ const char *dn;
unsigned int i, j;
- dn = ldb_dn_linearize(ldb, msg->dn);
+ dn = ldb_dn_get_linearized(msg->dn);
if (dn == NULL) {
return -1;
}
@@ -532,7 +525,6 @@ static int msg_delete_attribute(struct ldb_module *module,
}
}
- talloc_free(dn);
return 0;
}
@@ -627,7 +619,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
struct ldb_message_element *el = &msg->elements[i];
struct ldb_message_element *el2;
struct ldb_val *vals;
- char *dn;
+ const char *dn;
switch (msg->elements[i].flags & LDB_FLAG_MOD_MASK) {
@@ -690,7 +682,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
case LDB_FLAG_MOD_DELETE:
- dn = ldb_dn_linearize(msg2, msg->dn);
+ dn = ldb_dn_get_linearized(msg->dn);
if (dn == NULL) {
ret = LDB_ERR_OTHER;
goto failed;