Re: [exim] condition problem in routers

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: W B Hacker
Fecha:  
A: exim users
Cc: wakko
Asunto: Re: [exim] condition problem in routers
Wakko Warner wrote:
> Please keep me CCd.
> exim v4.64
>
> I have the following router on one of my mail servers:
> auto_whitelist:
>         driver = redirect
>         domains = !+local_domains
>         sender_domains = +local_domains
>         condition = no${lookup mysql{SELECT 'no' \
>                                         FROM lists.auto_whitelist \
>                                         WHERE sender='$sender_address_local_part' AND \
>                                                 recipient='${quote_mysql:$local_part}@$domain' \
>                                         LIMIT 1 \
>                                   } \
>                              {} \
>                              {${lookup mysql{REPLACE INTO lists.auto_whitelist \
>                                                 (sender, recipient) \
>                                                 VALUES ('$sender_address_local_part', \
>                                                         '${quote_mysql:$local_part}@$domain') \
>                                             } \
>                                             {} \
>                                             {} \
>                                } \
>                              } \
>                      }


First, put one blank line in right here, then test again.

>         data = :blackhole:
>         unseen
>         no_verify
>         no_expn
>         no_address_test

>


Second, I *think* you will need to split that into two separate SQL
calls. ELSE simplify. See below.

> The only reason for this is to add data to a database at routing time.
> condition is always "no" so it should never work, unfortunately, it runs only
> if the SELECT statement returns any data.


See above.

> What's even worse is that unseen
> is not honoured.
>


My (many!) all are - but there was a need for that blank line.

> The entire ${lookup is not supposed to return anything.
>
> If I comment out the lookup part, it works as expected.


So .. can you just leave it out permanently?

;-)

>
> If I comment out the inner ${lookup (the one that does the REPLACE INTO), it
> also works as expected.
>


Ditto...

> If I change :blackhole: to :defer:, it works as expected.
>


That gets the same job done also, at least if done during smtp-time
rather than in a router...

> Any one have any ideas on this?
>


KISS:

A) If all you want to do is to add the data, see if you can cut it down
to less SQL code, then run any needed cleanup of 'aged' entries
separately (and not necessarily even from within Exim, but rather with a
trigger in the DB).

B) It is less likely to create a 'leaky' router, trash on the queue, or
need for a bounce if you can do it in an smtp-time acl instead.

EX: (not line-wrapped the same in the configure file as it is here by my
MUA):

set acl_c19 = ${lookup pgsql{INSERT into brownlist \
               (pg_when, pg_ip, pg_host) \
               VALUES \
('$tod_log','${quote_pgsql:$sender_host_address}','$sender_host_name')}}


HTH,

Bill

*snip*