From ce2e35309e26d7fc23ba54f1caeb8aeeefa7ccc2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 23 Jun 2005 23:19:31 +0000 Subject: r7851: We are case preserving let the DN be returned the same the user put it into. sss (This used to be commit 5b41e3202456549250e6e5b1c63bd45ea7500fa3) --- source4/lib/ldb/common/ldb_explode_dn.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/ldb_explode_dn.c b/source4/lib/ldb/common/ldb_explode_dn.c index 30e5740652..0dcca5dc70 100644 --- a/source4/lib/ldb/common/ldb_explode_dn.c +++ b/source4/lib/ldb/common/ldb_explode_dn.c @@ -154,12 +154,11 @@ ldb_explode_dn(void * mem_ctx, } /* Copy the provided DN so we can manipulate it */ - if ((p = ldb_dn_fold(mem_ctx, orig_dn, - hUserData, case_fold_attr_fn)) == NULL) { + if ((dn_copy = talloc_strdup(mem_ctx, orig_dn)) == NULL) { goto failed; } - dn_copy = p; + p = dn_copy; /* Our copy may end shorter than the original as we unescape chars */ dn_end = dn_copy + orig_len + 1; @@ -224,13 +223,17 @@ ldb_explode_dn(void * mem_ctx, goto failed; } - /* attribute names are always case-folded */ - p = attribute->name; - if ((attribute->name = - ldb_casefold(attribute, p)) == NULL) { - goto failed; - } - talloc_free(p); + /* see if this attribute name needs case folding */ + if (case_fold_attr_fn != NULL && + (* case_fold_attr_fn)(hUserData, + attribute->name)) { + p = attribute->name; + if ((attribute->name = + ldb_casefold(attribute, p)) == NULL) { + goto failed; + } + talloc_free(p); + } ldb_debug(mem_ctx, LDB_DEBUG_TRACE, -- cgit