summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/ldb/common/ldb_dn.c2
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c12
2 files changed, 6 insertions, 8 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index 8b9cf4e129..7556a144e2 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -37,7 +37,7 @@
#include "includes.h"
#include "ldb/include/ldb.h"
#include "ldb/include/ldb_private.h"
-
+#include <ctype.h>
#define LDB_DN_NULL_FAILED(x) if (!(x)) goto failed
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index eb72e665f5..df94b0691d 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -56,6 +56,8 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const char *dn)
TDB_DATA key;
char *key_str = NULL;
char *dn_folded = NULL;
+ struct ldb_dn *edn = NULL;
+ struct ldb_dn *cedn = NULL;
/*
most DNs are case insensitive. The exception is index DNs for
@@ -71,8 +73,6 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const char *dn)
if (*dn == '@') {
dn_folded = talloc_strdup(ldb, dn);
} else {
- struct ldb_dn *edn, *cedn;
-
edn = ldb_dn_explode(ldb, dn);
if (!edn)
goto failed;
@@ -89,10 +89,6 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const char *dn)
talloc_free(cedn);
}
- if (!dn_folded) {
- goto failed;
- }
-
key_str = talloc_asprintf(ldb, "DN=%s", dn_folded);
talloc_free(dn_folded);
@@ -101,11 +97,13 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const char *dn)
}
key.dptr = key_str;
- key.dsize = strlen(key_str)+1;
+ key.dsize = strlen(key_str) + 1;
return key;
failed:
+ talloc_free(edn);
+ talloc_free(cedn);
errno = ENOMEM;
key.dptr = NULL;
key.dsize = 0;