summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/common/ldb_parse.c')
-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);