From e315aceda357711284da08094f80b1e03346fef0 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 19 Jun 2010 14:49:23 +0200 Subject: ldb:ldb_dn.c - don't support "ldb_dn_add_child" on a "" parent DN It's meaningless and could end in DNs as "cn=child,". --- source4/lib/ldb/common/ldb_dn.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib/ldb/common/ldb_dn.c') diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 00646f6ba5..5ce735f145 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -1488,6 +1488,10 @@ bool ldb_dn_add_child(struct ldb_dn *dn, struct ldb_dn *child) unsigned int n; long long int i, j; + if (dn->comp_num == 0) { + return false; + } + if ( ! ldb_dn_validate(child)) { return false; } @@ -1534,6 +1538,9 @@ bool ldb_dn_add_child(struct ldb_dn *dn, struct ldb_dn *child) } if (dn->linearized) { + if (dn->linearized[0] == '\0') { + return false; + } s = ldb_dn_get_linearized(child); if ( ! s) { -- cgit