Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: users

exim pcre match question

 

 

exim users RSS feed   Index | Next | Previous | View Threaded


v.tolstov at selfip

Nov 10, 2009, 7:04 AM

Post #1 of 3 (637 views)
Permalink
exim pcre match question

Hello.
I have this regular expression to check Message-Id header
[\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?

(* before @ and two words separated with dot after @)

deny condition = ${if match
{$h_Message-Id:}{[\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?} {1}}
message = X-ACL-DATA: Invalid Message-Id
log_message = X-ACL-DATA: Invalid Message-Id

But if a send e-mail with aaa [at] tes and aaa [at] test all messages passed
by this acl and delivery.

pcretest work's fine with this expression


--
Vasiliy G Tolstov <v.tolstov [at] selfip>
Selfip.Ru


--
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


exim-users at spodhuis

Nov 10, 2009, 2:43 PM

Post #2 of 3 (601 views)
Permalink
Re: exim pcre match question [In reply to]

On 2009-11-10 at 18:04 +0300, Vasiliy G Tolstov wrote:
> Hello.
> I have this regular expression to check Message-Id header
> [\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
>
> (* before @ and two words separated with dot after @)
>
> deny condition = ${if match
> {$h_Message-Id:}{[\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?} {1}}
> message = X-ACL-DATA: Invalid Message-Id
> log_message = X-ACL-DATA: Invalid Message-Id
>
> But if a send e-mail with aaa [at] tes and aaa [at] test all messages passed
> by this acl and delivery.
>
> pcretest work's fine with this expression

You need to wrap the regexp in \N....\N to protect escape sequences
inside it. Otherwise, the "\." is interpreted at the Exim string
expansion layer and becomes just "." in the regexp.

Generally, you can test by starting a test Exim daemon on a different
port, with debugging turned on via -d; you can test the string expansion
with -d+expand for more information. Eg, in one terminal run:

exim -d+expand -oX 26 -bd

and then connect to port 26 in a different window and type/paste in the
SMTP dialogue to send your test message.

Regards,
-Phil

--
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


v.tolstov at selfip

Nov 10, 2009, 3:57 PM

Post #3 of 3 (587 views)
Permalink
Re: exim pcre match question [In reply to]

On Tue, 2009-11-10 at 14:43 -0800, Phil Pennock wrote:
> On 2009-11-10 at 18:04 +0300, Vasiliy G Tolstov wrote:
> > Hello.
> > I have this regular expression to check Message-Id header
> > [\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
> >
> > (* before @ and two words separated with dot after @)
> >
> > deny condition = ${if match
> > {$h_Message-Id:}{[\S]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?} {1}}
> > message = X-ACL-DATA: Invalid Message-Id
> > log_message = X-ACL-DATA: Invalid Message-Id
> >
> > But if a send e-mail with aaa [at] tes and aaa [at] test all messages passed
> > by this acl and delivery.
> >
> > pcretest work's fine with this expression
>
> You need to wrap the regexp in \N....\N to protect escape sequences
> inside it. Otherwise, the "\." is interpreted at the Exim string
> expansion layer and becomes just "." in the regexp.
>
> Generally, you can test by starting a test Exim daemon on a different
> port, with debugging turned on via -d; you can test the string expansion
> with -d+expand for more information. Eg, in one terminal run:
>
> exim -d+expand -oX 26 -bd
>
> and then connect to port 26 in a different window and type/paste in the
> SMTP dialogue to send your test message.
>
> Regards,
> -Phil
>
Thank's. THis forks fine.

--
Vasiliy G Tolstov <v.tolstov [at] selfip>
Selfip.Ru


--
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

exim users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.