Little issue with conf parser
2004-06-14 by Cyril Guibourg
According to greyist.conf manpage, comments can be placed after a statement
on the same line
A line like:
addr 213.91.0.0/17 # Teaser / Firstream
is seen by conf_lex as ADDR IPADDR CIDR instead of ADDR IPADDR CIDR COMMENT.
This ends into parser error that prevents processing of the remaining of the
configuration file.
I tried to fix the token definition but I think that it breaks RFC2882
when considering atext lexical definition in dot-atom part of a SMTP addy.
The diff is:
--- conf_lex.l.orig Tue Jun 1 18:15:49 2004
+++ conf_lex.l Mon Jun 14 20:09:19 2004
@@ -38,7 +38,7 @@
all [Aa][Ll][Ll]
delay -?[0-9]{1,}[smhdw]?
path "\""[^"\n]{1,}"\""
-regex "/"[^/\n]{1,}"/"
+regex "/"[^/#\n]{1,}"/"
dumpfreq [Dd][Uu][Mm][Pp][Ff][Rr][Ee][Qq]:?
timeout [Tt][Ii][Mm][Ee][Oo][Uu][Tt]:?
domain [Dd][Oo][Mm][Aa][Ii][Nn]:?
Given the following configuration file
$ cat /milter/greylist.conf
quiet
dumpfile "/var/db/milter-greylist/greylist.db"
addr 127.0.0.0/8
addr 192.168.0.0/16 # My private netblock
addr 213.91.0.0/17 # Teaser / Firstream
rcpt spamtrap@...
rcpt /.*@.../
rcpt /[#.]*@.../
Before patch:
$ ./milter-greylist -Dv -f /milter/greylist.conf -p /milter/sock
load exception net 127.0.0.0/255.0.0.0
load exception net 192.168.0.0/255.255.0.0
error at line 5: syntax error
milter-greylist: cannot read dumpfile "/var/db/milter-greylist/greylist.db"
milter-greylist: starting with an empty greylist
^Cmilter-greylist: greylist: mi_stop=2
milter-greylist: Final database dump: no change to dump
milter-greylist: Exitting
After patch:
$ ./milter-greylist -Dv -f /milter/greylist.conf -p /milter/sock
load exception net 127.0.0.0/255.0.0.0
load exception net 192.168.0.0/255.255.0.0
load exception net 213.91.0.0/255.255.128.0
load exception rcpt spamtrap@...
load exception rcpt regex .*@...
unknown token "/" line 8
Any clue ? What about patching the man page ? :)
Thanks.