Re: [Exim] regex and email validation

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Giuliano Gavazzi
Data:  
Para: exim-users, Abaddon
Asunto: Re: [Exim] regex and email validation
At 10:09 +0000 2003/02/24, Philip Hazel wrote:
>On Mon, 24 Feb 2003, Abaddon wrote:
>
>> Hello, i am trying to make a ACL the deny emails
>> with strange characthers, like:
>>
>>    deny    senders       = !
>  > ^.[a-z0-9_-]+(\.[a-z0-9_-]+)*@[a-z0-9_-]+(\.[a-z0-9_-]+)+

>>
>> If somene issues:
>>
>> mail from: tést@???
>>
>> it will deny, but
>>
>> mail from: test%as@???
>>
>> it will not deny...
>>
>> Is this regex wrong ?
>
>Yes.
>
>Lists in ACLs are string-expanded. Thus, \ is an escape character for
>the expansion, and will have been removed from the regex before it is
>processed. What the regex engine is seeing is
>
> ^.[a-z0-9_-]+(.[a-z0-9_-]+)*@[a-z0-9_-]+(.[a-z0-9_-]+)+
>
>Can you now see why it fails?
>
>The easiest way round this is to wrap your regex in \N...\N
>so that the internal backslashes are left alone.
>


two observations:

isn't the initial . = any character?

isn't this rule in blatant violation of RFC 2821 for local-parts [and
in particular it will reject the quite common +]?

Giuliano