summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_dn.c
diff options
context:
space:
mode:
authorAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2009-09-22 14:37:58 -0700
committerAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2009-09-22 14:46:18 -0700
commit68f33428c7736966caa98cd85b2ef15e71d5fad8 (patch)
treed4faff3c232aad69f1df2d89835e27c6d7bd6e93 /source4/lib/ldb/common/ldb_dn.c
parent6a8ef6c424c52be861ed2a9806f917a64ec892a6 (diff)
downloadsamba-68f33428c7736966caa98cd85b2ef15e71d5fad8.tar.gz
samba-68f33428c7736966caa98cd85b2ef15e71d5fad8.tar.bz2
samba-68f33428c7736966caa98cd85b2ef15e71d5fad8.zip
Move the check above the talloc
Diffstat (limited to 'source4/lib/ldb/common/ldb_dn.c')
-rw-r--r--source4/lib/ldb/common/ldb_dn.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index af00ef96f3..12a513fc42 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -88,6 +88,12 @@ struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx,
if (! ldb) return NULL;
+ if (strdn && strdn->data
+ && (strlen((const char*)strdn->data) != strdn->length)) {
+ /* The RDN must not contain a character with value 0x0 */
+ return NULL;
+ }
+
dn = talloc_zero(mem_ctx, struct ldb_dn);
LDB_DN_NULL_FAILED(dn);
@@ -103,11 +109,6 @@ struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx,
dn->ext_linearized = talloc_strndup(dn, data, length);
LDB_DN_NULL_FAILED(dn->ext_linearized);
- if (strlen(data) != length) {
- /* The RDN must not contain a character with value 0x0 */
- return NULL;
- }
-
if (data[0] == '<') {
const char *p_save, *p = dn->ext_linearized;
do {