From 5b258c3b9dda634af721802916880bccffab45a2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 25 Nov 2006 15:42:22 +0000 Subject: r19887: return "" string only if the dn is a valid one (This used to be commit 056f90798f6d2cea1debc50f31fea3d740c4a837) --- source4/lib/ldb/common/ldb_dn.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 3f66943ad2..38d9ea3aff 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -630,7 +630,7 @@ const char *ldb_dn_get_casefold(struct ldb_dn *dn) if (dn->casefold) return dn->casefold; - if (dn->special) { + if (dn->special) { dn->casefold = talloc_strdup(dn, dn->linearized); if (!dn->casefold) return NULL; dn->valid_case = true; @@ -642,10 +642,14 @@ const char *ldb_dn_get_casefold(struct ldb_dn *dn) } if (dn->comp_num == 0) { - dn->casefold = talloc_strdup(dn, ""); - if (!dn->casefold) return NULL; - dn->valid_case = true; - return dn->casefold; + if (dn->linearized && dn->linearized[0] == '\0') { + /* hmm a NULL dn, should we faild casefolding ? */ + dn->casefold = talloc_strdup(dn, ""); + return dn->casefold; + } + /* A DN must be NULL, special, or have components */ + dn->invalid = true; + return NULL; } /* calculate maximum possible length of DN */ -- cgit