Re: Grammar Requires Backtracking
Alessandro Vesely <[email protected]> Sun, 18 Apr 2010 16:26:35 +0200
| Newsgroups | gmane.mail.spam.spf.devel |
|---|---|
| Message-ID | <[email protected]> |
On 17/Apr/10 21:50, William Ahern wrote: > Is anyone else bothered by the fact that the grammar requires backtracking? > Specifically, because a domain-spec can include forward slashes, and because > some of the terms allow cidr masks after a domain-spec, you have to support > backtracking. > > Frankly I'm not sure I want to bother supporting this. I use Ragel to parse > the policies, which is a pure regular langage parser generator. I could use > Ragel's scanner feature, or just hack the support, but as a general rule I > don't like backtracking grammars for untrusted input. > > Perhaps it would have been wise to have included a %-encoded forward-slash, > as was done for spaces. > > Anybody open to such an amendment? A rewriting of the spec has been due since a couple of years ago. Until we start that, we can presumably use http://www.openspf.org/Community/SPFv3 to annotate various issues (even if we won't eventually bump the version number.) I've added a skeletal page in http://www.openspf.org/Community/SPFv3-Grammar . Please feel free to amend/complete it as appropriate. > I gratuitously wrote an RFC 1035 master file parser and composer in C (w/ > Ragel), and am of course parsing the YAML tests from C (w/ libyaml). So if > anybody was waiting for the ability to generate zone files from the test > suite, it's all but done--rfc4408-tests.c in my regress/ directory already > spits out the zones files, the code would just need to be tweaked to output > them in a more useful manner than as part of the debug output for failed > tests. How would that work for running the test suite, given that you need different zones --with conflicting names-- for different tests?