summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-06 05:53:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:27 -0500
commit3cb96c8db92dc3059244f0977a79599b897a59b6 (patch)
tree68a05aa590484e715e8bd5755fdb8674aaa003ff /source4/lib/ldb
parent12399c9b5e9b66ab95bd67142d181ccaecb067e2 (diff)
downloadsamba-3cb96c8db92dc3059244f0977a79599b897a59b6.tar.gz
samba-3cb96c8db92dc3059244f0977a79599b897a59b6.tar.bz2
samba-3cb96c8db92dc3059244f0977a79599b897a59b6.zip
r10756: another fix for the construction of expressions from subtrees for
SUBSTRING searches. This time fix multi-part substring searches. (This used to be commit bf5cef6f00466fc1dc3c2864a109f1ccd92681b0)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb_parse.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c
index 110361d2b7..27f9e1ec25 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -695,16 +695,18 @@ char *ldb_filter_from_tree(void *mem_ctx, struct ldb_parse_tree *tree)
talloc_free(ret);
return NULL;
}
- s = talloc_asprintf_append(ret, "%s*", s2);
+ if (tree->u.substring.chunks[i+1] ||
+ tree->u.substring.end_with_wildcard) {
+ s = talloc_asprintf_append(ret, "%s*", s2);
+ } else {
+ s = talloc_asprintf_append(ret, "%s", s2);
+ }
if (s == NULL) {
talloc_free(ret);
return NULL;
}
ret = s;
}
- if ( ! tree->u.substring.end_with_wildcard ) {
- ret[strlen(ret) - 1] = '\0'; /* remove last wildcard */
- }
s = talloc_asprintf_append(ret, ")");
if (s == NULL) {
talloc_free(ret);