summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-11-25 14:59:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:32 -0500
commit6d074bcd4b869b3ff65cb999bf3c10d4affa17f7 (patch)
tree69bec37f6f04952b00930abbeccb1c6ace45c601 /source4/lib/ldb
parent2ad51046e3becd5257d7bb25c0dc43be13172809 (diff)
downloadsamba-6d074bcd4b869b3ff65cb999bf3c10d4affa17f7.tar.gz
samba-6d074bcd4b869b3ff65cb999bf3c10d4affa17f7.tar.bz2
samba-6d074bcd4b869b3ff65cb999bf3c10d4affa17f7.zip
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)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb_dn.c24
1 files 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;
}