summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-07-28 15:51:31 +1000
committerAndrew Tridgell <tridge@samba.org>2011-07-29 18:17:44 +1000
commite3b76bd6205acfc1a89fbcab5d9588b32cb47b88 (patch)
tree14f71730d98b0509cca32a2c3f07cd7c2b008ca1 /lib
parent2663586c8bbda96822c9325de2966382a2341fca (diff)
downloadsamba-e3b76bd6205acfc1a89fbcab5d9588b32cb47b88.tar.gz
samba-e3b76bd6205acfc1a89fbcab5d9588b32cb47b88.tar.bz2
samba-e3b76bd6205acfc1a89fbcab5d9588b32cb47b88.zip
ldb: fixed a search expression parse bug
when a secondary component of a & or | expression was invalid, it was ignored rather than giving an error. For example: (|(objectclass=user)(samaccountname=foo\blah)) was treated as being: (objectclass=user) whereas it should be an error, as foo\blah is invalid Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com> Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/common/ldb_parse.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/ldb/common/ldb_parse.c b/lib/ldb/common/ldb_parse.c
index b4eabf8375..8c6c2d993e 100644
--- a/lib/ldb/common/ldb_parse.c
+++ b/lib/ldb/common/ldb_parse.c
@@ -534,8 +534,18 @@ static struct ldb_parse_tree *ldb_parse_filterlist(TALLOC_CTX *mem_ctx, const ch
while (isspace((unsigned char)*p)) p++;
- while (*p && (next = ldb_parse_filter(ret->u.list.elements, &p))) {
+ while (*p) {
+ if (*p == ')') {
+ break;
+ }
+
+ next = ldb_parse_filter(ret->u.list.elements, &p);
struct ldb_parse_tree **e;
+ if (next == NULL) {
+ /* an invalid filter element */
+ talloc_free(ret);
+ return NULL;
+ }
e = talloc_realloc(ret, ret->u.list.elements,
struct ldb_parse_tree *,
ret->u.list.num_elements + 1);