summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2005-06-15 02:43:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:13 -0500
commitf021dffb6991138213967521c743f03f474f9af9 (patch)
treef29843de72640cc3c449b785a3ff18852991a81f /source4/lib/ldb/common
parentec4a99ffe89656c4ef89e21109c4136d491952d5 (diff)
downloadsamba-f021dffb6991138213967521c743f03f474f9af9.tar.gz
samba-f021dffb6991138213967521c743f03f474f9af9.tar.bz2
samba-f021dffb6991138213967521c743f03f474f9af9.zip
r7601: ldb_sqlite3 work in progress
(This used to be commit 0a64948152a446b5e127578d49b1ed8a90a1a222)
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/ldb_explode_dn.c5
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c18
2 files changed, 14 insertions, 9 deletions
diff --git a/source4/lib/ldb/common/ldb_explode_dn.c b/source4/lib/ldb/common/ldb_explode_dn.c
index 5cea4424b0..79cbe12d61 100644
--- a/source4/lib/ldb/common/ldb_explode_dn.c
+++ b/source4/lib/ldb/common/ldb_explode_dn.c
@@ -138,10 +138,13 @@ ldb_explode_dn(void * mem_ctx,
}
/* Copy the provided DN so we can manipulate it */
- if ((dn_copy = p = talloc_strdup(mem_ctx, orig_dn)) == NULL) {
+ if ((p = ldb_dn_fold(mem_ctx, orig_dn,
+ hUserData, case_fold_attr_fn)) == NULL) {
goto failed;
}
+ dn_copy = p;
+
/* Our copy may end shorter than the original as we unescape chars */
dn_end = dn_copy + orig_len + 1;
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index dc25d6cf13..35249c4b70 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -95,11 +95,13 @@ int ldb_attr_cmp(const char *dn1, const char *dn2)
attribute values of case insensitive attributes. We also need to remove
extraneous spaces between elements
*/
-char *ldb_dn_fold(struct ldb_module *module, const char *dn, int (*case_fold_attr_fn)(struct ldb_module * module, char * attr))
+char *ldb_dn_fold(void * mem_ctx,
+ const char * dn,
+ void * user_data,
+ int (* case_fold_attr_fn)(void * user_data, char * attr))
{
const char *dn_orig = dn;
- struct ldb_context *ldb = module->ldb;
- TALLOC_CTX *tmp_ctx = talloc_new(ldb);
+ TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
char *ret;
size_t len;
@@ -133,14 +135,14 @@ char *ldb_dn_fold(struct ldb_module *module, const char *dn, int (*case_fold_att
}
if (*value == 0) goto failed;
- case_fold_required = (* case_fold_attr_fn)(module, attr);
+ case_fold_required = (* case_fold_attr_fn)(user_data, attr);
- attr = ldb_casefold(ldb, attr);
+ attr = ldb_casefold(tmp_ctx, attr);
if (attr == NULL) goto failed;
talloc_steal(tmp_ctx, attr);
if (case_fold_required) {
- value = ldb_casefold(ldb, value);
+ value = ldb_casefold(tmp_ctx, value);
if (value == NULL) goto failed;
talloc_steal(tmp_ctx, value);
}
@@ -156,12 +158,12 @@ char *ldb_dn_fold(struct ldb_module *module, const char *dn, int (*case_fold_att
if (*dn == ',') dn++;
}
- talloc_steal(ldb, ret);
+ talloc_steal(mem_ctx, ret);
talloc_free(tmp_ctx);
return ret;
failed:
talloc_free(tmp_ctx);
- return ldb_casefold(ldb, dn_orig);
+ return ldb_casefold(mem_ctx, dn_orig);
}