[Mimedefang] RelayAddr

Barry Byrne barry.byrne at wbtsystems.com
Mon Sep 23 05:06:01 EDT 2002


-----Original Message-----
> From: mimedefang-admin at lists.roaringpenguin.com
> [mailto:mimedefang-admin at lists.roaringpenguin.com]On Behalf Of Marco
mBerizzi

> The "official way" suggested by David doesn't work for me:
>  $RelayAddr =~ /^172\.16\.1$/
> instead this work for me:
> $RelayAddr =~ /^172\.16\.1/
> The problem appears to be the "$" at the end (a typo?)

Marco:

The $ means end of line in a regex pattern match, and the ^ means the start
of line.

The pattern should probably be:

	$RelayAddr =~ /^172\.16\.1\.\d{1,3}$/

assuming you are matching something like: 172.16.1.*

You could also get away with:

	$RelayAddr =~ /^172\.16\.1\./

assuming you trust $RelarAddr to be an IP address.

Note your pattern only has two dots in it so may not be exactly what you
want.

	$RelayAddr =~ /^172\.16\.1/

Matches any string the begins with 172.16.1

	e.g. 172.16.192.1, 172.16.100.3, 172.16.1.8

Cheers,

Barry



> This is my simple piece of code.
>
> if ($RelayAddr =~ /^172\.16\.1/) {
> $LocalRelay = 1;
> } else {
> $LocalRelay = 0;
> }
>
> ----- Original Message -----
> From: <Matthew.van.Eerde at hbinc.com>
> To: <mimedefang at lists.roaringpenguin.com>
> Sent: Friday, September 20, 2002 11:16 PM
> Subject: RE: [Mimedefang] RelayAddr
>
>
> > It may be that the problem with the code as posted is the relatively
> tight
> > binding of the "|" operator in a regular expression:
> > $RelayAddr =~ /^(127.0.0.1|$LocalNetworks)/o
> >
> > Perhaps this should be
> > $RelayAddr =~ /^(127\.0\.0\.1)|($LocalNetworks)$/o
> >
> > It should also be verified that $LocalNetworks has its "|" families
> suitably
> > parenthesized
> >
> > $LocalNetworks =
> > "(10\.\d{1,3}\.\d{1,3}\.\d{1,3})|(192\.168\.\d{1,3}\.\d{1,3})"
> >
> > All in all, it's probably clearer to write
> >
> > $RelayAddr eq "127.0.0.1" or
> > $RelayAddr =~ /^10\./ or
> > $RelayAddr =~ /^192\.168\./
> >
> > > -----Original Message-----
> > > From: Stefano McGhee [mailto:SMcGhee at arcweb.com]
> > > Sent: Friday, September 20, 2002 12:13
> > > To: mimedefang at lists.roaringpenguin.com
> > > Subject: RE: [Mimedefang] RelayAddr
> > >
> > >
> > > Ashley,
> > > That sounds exactly what I'm trying to accomplish for my server.
> > > David sent a piece of code into the list like so:
> > >
> > > The "official" way is as follows:
> > >
> > > if ($RelayAddr eq "127.0.0.1" or
> > >     $RelayAddr eq "ip.of.my.server" or
> > >     $RelayAddr =~ /^ip\.of\.my-class-c$/) {
> > > # Don't check for spam
> > > } else {
> > > # Check for spam
> > > }
> > >
> > > This works with all versions of MIMEDefang.
> > >
> > > The problem with you're code, if I'm not mistaken, is that
> > > action_accept
> > > doesn't work on entire messages as action_discard does.  You
> > > probably need
> > > to implement his code rather than using action_accept.
> > >
> > > Cheers,
> > >
> > > Stefano
> > >
>
> _______________________________________________
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
>




More information about the MIMEDefang mailing list