policyd-weight-list  

Re: HELO_NUMERIC

Robert Felber
Wed, 07 Nov 2007 11:16:21 -0800

On Wed, Nov 07, 2007 at 04:15:37PM +0000, Riaan Kok wrote:
> (another one of these!)
> 
> the test around line 2340 or so looks at whether there's any number or
> closing square bracket at the end of a helo and then fires HELO_NUMERIC?
> Say a server incorrectly identifies itself as "EHLO server3", it already
> gets penalised in the right places, and it might not be the intention to
> fire off HELO_NUMERIC as well then?

Well, yes, the RE could also be expressed as
/^\d+\.\d+\.\d+\.\d+\]*$/

> I stumbled onto a decent perl-regexp for identifying IP addresses on some
> PHP site a while ago, if you think it useful here instead of the current
> test:
> /^\[(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}\]$/
> (square brackets added to fit this case)

Serious checks whether something is a valid IP should be done with 
inet_* functions.

We don't need to be that serious and are fine with simple checks (if they are
not too simple as in /[\d|\]]$/ )


-- 
    Robert Felber (PGP: 896CF30B)
    Munich, Germany

____________________________________________________________
Policyd-weight Mailinglist - http://www.policyd-weight.org/