1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-31 20:22:15 +03:00

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>
This commit is contained in:
Andrew Tridgell
2011-07-28 15:51:31 +10:00
parent 2663586c8b
commit e3b76bd620

View File

@ -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);