Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] pattern for regex and comment

2004-10-19 by Hajimu UMEMOTO

Hi,

>>>>> On Sun, 17 Oct 2004 20:27:39 +0200
>>>>> manu@... said:

manu> Moreover comment at the end of the line are not really
manu> supported. See greylist.conf(5):

After some thought, I gave thought that it is still better to have
less restriction.  How about this patch?  It makes regex to match just
after from, rcpt or domain.

Index: conf_lex.l
diff -u conf_lex.l.orig conf_lex.l
--- conf_lex.l.orig	Sun Oct 17 23:15:29 2004
+++ conf_lex.l	Tue Oct 19 19:00:26 2004
@@ -48,6 +48,8 @@
 port		[Pp][Oo][Rr][Tt]
 star		"*"
 
+%s S_REGEX
+
 
 %{
 	#include "config.h"
@@ -74,8 +76,8 @@
 {blank}
 {comment}
 {addr}		{ return ADDR; }
-{from}		{ return FROM; }
-{rcpt}		{ return RCPT; }
+{from}		{ BEGIN(S_REGEX); return FROM; }
+{rcpt}		{ BEGIN(S_REGEX); return RCPT; }
 {peer}		{ return PEER; }
 {autowhite}	{ return AUTOWHITE; }
 {lazyaw}	{ return LAZYAW; }
@@ -99,7 +101,7 @@
 {all}		{ return ALL; }
 {dumpfreq}	{ return GLDUMPFREQ; }
 {timeout}	{ return GLTIMEOUT; }
-{domain}	{ return DOMAIN; }
+{domain}	{ BEGIN(S_REGEX); return DOMAIN; }
 {syncaddr}	{ return SYNCADDR; }
 {port}		{ return PORT; }
 {star}		{ return STAR; }
@@ -146,7 +148,7 @@
 			yylval.domainname[ADDRLEN] = '\0';
 			return DOMAINNAME; 
 		}
-{regex}		{
+<S_REGEX>{regex} {
 			strncpy(yylval.regex, yytext, REGEXLEN);
 			yylval.regex[PATHLEN] = '\0';
 			return REGEX;
@@ -156,6 +158,7 @@
 			return CIDR; 
 		}
 \n		{ 
+			BEGIN(0);
 			conf_line++; 
 			return yytext[0]; 
 		}



Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@...  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.