Closed Geobert closed 3 years ago
Go ahead, by all means. Please reuse as much of src/filter.rs
as possible; ideally, your filter parsing should extend the code in that file. I believe almost everything you need is already there.
It seems that there's already everything in src/filter.rs
so the control is basically calling parse
and instantiate a RawControl
with the matched values control's OID :)
correct me if I'm wrong :D
The top-level filter expression in the Matched Values control lacks the logical operator (it's an implicit "or") and its encoding is different, so you can't use the filter
production as-is. Try passing a valid multi-element M-V filter to parse_filter()
and you'll get a parse error back. I believe you can fully reuse the item
production.
Thanks for you insight :)
What is "M-V"?
What is "M-V"?
"Matched Values".
I need a bit of help here.
So far I got this grammar:
named!(filtexpr<Tag>, alt!(filter | valuesreturnfilter | item));
named!(
valuesreturnfilter<Tag>,
delimited!(char!('('), itemlist, char!(')'))
);
named!(valuesreturnfilterlist<Vec<Tag>>, many1!(valuesreturnfilter));
named!(
itemlist<Tag>,
map!(valuesreturnfilterlist, |tagv: Vec<Tag>| -> Tag {
Tag::Sequence(Sequence {
class: TagClass::Universal,
id: lber::universal::Types::Sequence as u64,
inner: tagv,
})
})
);
but it fails to parse "((attr=val*))" and I don't get why.
It does succeed to parse "(attr=val*)" though (but the encoding seems wrong, which is another issue)
EDIT: I got something that parse the problematic expr:
named!(
valuesreturnfilter<Tag>,
delimited!(char!('('), item_or_list, char!(')'))
);
named!(valuesreturnfilterlist<Vec<Tag>>, many1!(valuesreturnfilter));
named!(item_or_list<Tag>, alt!(itemlist | item));
named!(
itemlist<Tag>,
map!(valuesreturnfilterlist, |tagv: Vec<Tag>| -> Tag {
Tag::Sequence(Sequence {
class: TagClass::Universal,
id: lber::universal::Types::Sequence as u64,
inner: tagv,
})
})
);
See the final version (817c5124 in the v07x branch) for the form of the grammar.
Hi there,
We are in the need of Matched Values Control and it's not available in
ldap3
.RFC https://tools.ietf.org/html/rfc3876.html
Would you mind if we add it?
Regards,