From 6d074bcd4b869b3ff65cb999bf3c10d4affa17f7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 25 Nov 2006 14:59:59 +0000 Subject: r19885: special dn's were not casefolded before rev 19831, act like this again... also when we already have a casefoled value we should not call ldb_dn_casefold_internal() metze (This used to be commit cbf4eb16725992bfdfa5a334e0e5547e6df568e6) --- source4/lib/ldb/common/ldb_dn.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 1c535fda33..3f66943ad2 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -628,24 +628,22 @@ const char *ldb_dn_get_casefold(struct ldb_dn *dn) int i, len; char *d, *n; + if (dn->casefold) return dn->casefold; + + if (dn->special) { + dn->casefold = talloc_strdup(dn, dn->linearized); + if (!dn->casefold) return NULL; + dn->valid_case = true; + return dn->casefold; + } + if ( ! ldb_dn_casefold_internal(dn)) { return NULL; } - if (dn->casefold) return dn->casefold; - if (dn->comp_num == 0) { - if (dn->special) { - len = strlen(dn->linearized); - dn->casefold = talloc_array(dn, char, len * 3 + 1); - if ( ! dn->casefold) return NULL; - ldb_dn_escape_internal(dn->casefold, dn->linearized, len); - /* don't waste more memory than necessary */ - dn->casefold = talloc_realloc(dn, dn->casefold, char, strlen(dn->casefold) + 1); - } else { - dn->casefold = talloc_strdup(dn, ""); - if ( ! dn->casefold) return NULL; - } + dn->casefold = talloc_strdup(dn, ""); + if (!dn->casefold) return NULL; dn->valid_case = true; return dn->casefold; } -- cgit