[Mimedefang] filter based on From/To headers?

Kelsey Cummings kgc at sonic.net
Mon May 10 14:01:24 EDT 2004


On Fri, May 07, 2004 at 11:21:17AM -0700, Kelsey Cummings wrote:
> On Fri, May 07, 2004 at 07:54:15PM +0200, Dirk Mueller wrote:
> > On Friday 07 May 2004 19:33, Kelsey Cummings wrote:
> > 
> > >                 next unless /^(To|From|Cc):/;
> > 
> > you're missing /i
> 
> I got the impression that the headers had been normalized by MD.  I'm
> checking case insensitive now and will see if that fixes is.

Case sensitivity doesn't appear to be the problem.  Out of roughly 275
messages that *should* match, I'm only catching a handful.  A filter that's
going to catch less than a few thousand a day is barely worth it for me
(I'm rejecting over 1 million messages a day already) but I'm curious why
it's not working now.  The only thing I can figure now is that the HEADERS
file isn't getting flushed to (ram)disk when it's created.

To sumarize:

In filter_begin I have the following snipit:

   if ( open(HEADER, "<HEADERS") )
   {
        while(<HEADER>)
        {
                next unless /^(To|From|Cc):/i;
                if ( /mx\.sonic\.net/i )
                {
                        md_syslog('err',"found hostname in header:: $_");
                }
        }
        close(HEADER);
   }
   else
   {
        mdsyslog('err',"couldn't open HEADERS for hostname information :: $!\n");
   }


Yet:

for dir in `ls`; do find $dir -type f | grep new | xargs grep \
 '^\(To\|From\)' | grep mx.sonic.net > /tmp/mx_in_header.$dir & done

results in:

...
a/n/XXX/new/1084194436.30315_0.a.lds,S=3595:From: Marianne.Walters at a.mx.sonic.net
a/s/XXX/new/1084194432.30081_0.a.lds,S=4152:From: Marianne.Walters at a.mx.sonic.net
b/a/XXX/new/1084204421.9158_0.a.lds,S=13680:From: "arthur" <"arthur"@b.mx.sonic.net>
b/a/XXX/new/1084198291.29385_0.a.lds,S=12729:To: undisclosed-recipients at b.mx.sonic.net
b/a/XXX/new/1084198480.3495_0.a.lds,S=11911:To: undisclosed-recipients at b.mx.sonic.net
...


-- 
Kelsey Cummings - kgc at sonic.net           sonic.net, inc.
System Administrator                      2260 Apollo Way
707.522.1000 (Voice)                      Santa Rosa, CA 95407
707.547.2199 (Fax)                        http://www.sonic.net/
Fingerprint = D5F9 667F 5D32 7347 0B79  8DB7 2B42 86B6 4E2C 3896



More information about the MIMEDefang mailing list