RE: [Exim] Blocking based on the subject (Possible bug in ex…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Rick Cooper
Date:  
À: Darren Casey, Exim Users
Sujet: RE: [Exim] Blocking based on the subject (Possible bug in exim 4.22?)
Ok I guess I should have tested it a bit more, I made three mistakes
    1. Should not have used $rh it appears the terminating \n caused trouble
    2. I meant !eq (checking for the blank)
    3. Got the two strings swapped in the match clause


this DOES work and I did test both good and bad subjects and I have included
the log
results as well

deny message = Bad Mojo For You With the Subject Of $acl_c8
set acl_c9 = ONE
    condition = ${if and {\
                    {!eq{$h_Subject:}{}}\
                    {match{${lc:$h_Subject:}}{${lc:$acl_c9}}}\
                    }\
                    {yes}{no}}


warn log_message = testing for ${lc:$acl_c9} the subject was $h_Subject
done


With a bad subject:

2003-08-19 05:43:44 19p3xo-0000cp-3d H=sahomelt (sysadmin02) [x.x.x.x]
F=<rick@???> rejected after
DATA: Bad Mojo For You With the Subject Of testing with ONE in the subject

With another subject:

2003-08-19 05:45:25 19p3zR-0000dh-KH H=sahomelt (sysadmin02) [x.x.x.x]
Warning: testing for one the subject was there is no bad thing in here done


> -----Original Message-----
> From: Darren Casey [mailto:exim@darrencasey.co.uk]
> Sent: Tuesday, August 19, 2003 3:33 AM
> To: Rick Cooper; Exim Users
> Cc: ph10@???
> Subject: Re: [Exim] Blocking based on the subject (Possible bug in exim
> 4.22?)
>
>
> > > > i *think* you can access it like $h__subject or $h_subject
> > > >
> > > > don't remember how exim does it -- but there's some prefix like $h_
> > > > that lets you plug in header fields with. its somewhere in
> the docs.
> > > >
> > >
> > > Thanks but I get
> > > 9355 H=(LAPTOP) [192.168.0.125] F=<test@???>
> > > temporarily rejected
> > > RCPT <carpe@???>: failed to expand ACL string
> > > "${lookup mysql
> > > {SELECT true FROM block WHERE condition =
> > > '${quote_mysql:${h_subject}}' and
> > > type='subject' AND user = '${quote_mysql:$local_part}' limit
> > > 1}{$value}}":
> > > unknown variable in "${h_subject}"
> > >
> > > I suspect its something to do with :-
> > >
> > <snip>
> >
> > I tried the following test which works just as it should with a subject
> of:
> > this subject has ONE in the middle
>
> I tried your following example work for word and it fails in exim 4.22
>
> >
> > deny message = Bad Mojo For You With the Subject Of $rh_Subject
> > set acl_c9 = ONE
> >     condition = ${if or {\
> >                     {!eq{$rh_Subject:}{}}\
> >                     {match{${lc:$acl_c9}}{${lc:$rh_Subject:}}}\
> >                     }\
> >                     {yes}{no}}

> >
> > I think the problem may be the fact you are not adding the : in
> $rh_Subject:
> > so I think it would be '${quote_mysql:${h_subject:}}'
>
> OK with this in it blocks the e-mail but does NOT quote the
> $rh_Subject in
> the error message its just blank
>
> The debug reports :-
> Exim version 4.22 uid=0 gid=0 pid=1417 D=8
> Berkeley DB: Sleepycat Software: Berkeley DB 3.1.17: (July 31, 2000)
> Support for: iconv()
> Authenticators: cram_md5 plaintext
> Routers: accept dnslookup ipliteral manualroute queryprogram redirect
> Transports: appendfile autoreply pipe smtp
> configuration file is /usr/exim/configure
> log selector = 060d99d8
> trusted user
> admin user
> 1417 listening on all interfaces (IPv4) port 25
> 1417 pid written to /var/run/exim.pid
> 1417 LOG: MAIN
> 1417 exim 4.22 daemon started: pid=1417, no queue runs, listening for
> SMTP on port 25 (IPv4)
> 1417 daemon running with uid=8 gid=100 euid=8 egid=100
> 1417 Listening...
> 1417 Connection request from 192.168.0.125 port 1665
> 1417 1 SMTP accept process running
> 1417 Listening...
> 1443 Process 1443 is handling incoming connection from [192.168.0.125]
> 1443 LOG: host_lookup_failed MAIN
> 1443 no host name found for IP address 192.168.0.125
> 1443 Process 1443 is ready for new message
> 1443 LOG: MAIN REJECT
> 1443 H=(LAPTOP) [192.168.0.125] F=<darren@???> rejected
> RCPT <reply@???>: Bad Mojo For You With the Subject Of
> 1443 LOG: smtp_connection MAIN
> 1443 SMTP connection from (LAPTOP) [192.168.0.125] closed by QUIT
> 1417 child 1443 ended: status=0x0
> 1417 0 SMTP accept processes now running
> 1417 Listening...
>
> The subject DID NOT match the condition, somewhere the subject variable is
> being missed
>
> I am filtering based on everything else I needed just not the subject it
> just seems to be blank...
>
> >
> > You might try '%${quote_mysql:${h_subject:}}%' (which is why I
> trapped the
> > blank subject)
> > to match if the subject CONTAINS the user's target string ... I would
> think
> > you would also want to normalize the case in the table and the subject
> > string for better matching (both lc or uc)
>
> Thanks
>
> Darren
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>