The below combo has two problems.
1. I feel i am overcomplicating
2. sql_virtuals_part2: seems to match "anything". The bottom debug is a run
with a user that definitely isnt in the database, yet sql_virtuals_part2
(which is after sql_virtuals in the config file) seems to try to handle the
address?
the database looks a little like this
_key incoming outgoing type
smtp_server
1 spamfilter2@??? j2@??? smtp_redirect
animal.mupp.net
sql_virtuals:
driver = redirect
condition = ${lookup mysql{select outgoing from
maildata.account_data where incoming = '${quote_mysql:$local_part@$domain}'}
{$value}{no}}
data = ${lookup mysql{select outgoing from maildata.account_data
where incoming = '${quote_mysql:$local_part@$domain}'}{$val
ue}{no}}
redirect_router = sql_virtuals_part2
retry_use_local_part
sql_virtuals_part2:
driver = accept
condition = ${lookup mysql{select if(count(*), "yes", "no") from
maildata.account_data where outgoing = '${quote_mysql:$loca
l_part@$domain}'}{yes}{no}}
# transport = ${lookup mysql{select smtp_server from
maildata.account_data where outgoing = '${quote_mysql:$local_part@$domain
}'}{$value}{no}}
transport = virtual_smtp
virtual_smtp:
driver = smtp
hosts = transport = ${lookup mysql{select smtp_server from
maildata.account_data where outgoing = '${quote_mysql:$local_part@$doma
in}'}{$value}{no}}
debug
> sdfdfg
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing sdfdfg@???
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering sdfdfg@???
active address sdfdfg@???
local_part=sdfdfg domain=mupp.net
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing sdfdfg@???
--------> lookuphost router <--------
local_part=sdfdfg domain=mupp.net
checking domains
mupp.net in "mupp.net : *.mupp.net : *.skyddsrummet.net : skyddsrummet.net :
sm7h.org : obstinat.net"? yes (matched "mupp.net")
mupp.net in "! +local_domains"? no (matched "! +local_domains")
cached lookup data = NULL
lookuphost router skipped: domains mismatch
--------> skyddsrummet router <--------
local_part=sdfdfg domain=mupp.net
checking domains
mupp.net in "*.skyddsrummet.net : skyddsrummet.net : sm7h.org :
obstinat.net"? no (end of list)
skyddsrummet router skipped: domains mismatch
--------> system_aliases router <--------
local_part=sdfdfg domain=mupp.net
calling system_aliases router
rda_interpret (string): ${lookup{$local_part}lsearch{/etc/aliases}}
search_open: lsearch "/etc/aliases"
cached open
search_find: file="/etc/aliases"
key="sdfdfg" partial=-1
LRU list:
8/etc/aliases
End
internal_search_find: file="/etc/aliases"
type=lsearch key="sdfdfg"
file lookup required for sdfdfg
in /etc/aliases
lookup failed
expanded:
file is not a filter file
parse_forward_list:
system_aliases router declined for sdfdfg@???
--------> bdsmse_aliases router <--------
local_part=sdfdfg domain=mupp.net
checking domains
mupp.net in "bdsmse.mupp.net"? no (end of list)
bdsmse_aliases router skipped: domains mismatch
--------> sql_virtuals router <--------
local_part=sdfdfg domain=mupp.net
checking "condition"
search_open: mysql "NULL"
cached open
search_find: file="NULL"
key="select outgoing from maildata.account_data where incoming =
'sdfdfg@???'" partial=-1
LRU list:
8/etc/aliases
End
internal_search_find: file="NULL"
type=mysql key="select outgoing from maildata.account_data where incoming
= 'sdfdfg@???'"
database lookup required for select outgoing from maildata.account_data
where incoming = 'sdfdfg@???'
MYSQL query: select outgoing from maildata.account_data where incoming =
'sdfdfg@???'
MYSQL using cached connection for localhost//exim
MYSQL: no data found
lookup failed
sql_virtuals router skipped: condition failure
--------> sql_virtuals_part2 router <--------
local_part=sdfdfg domain=mupp.net
checking "condition"
search_open: mysql "NULL"
cached open
search_find: file="NULL"
key="select if(count(*), "yes", "no") from maildata.account_data where
outgoing = 'sdfdfg@???'" partial=-1
LRU list:
8/etc/aliases
End
internal_search_find: file="NULL"
type=mysql key="select if(count(*), "yes", "no") from
maildata.account_data where outgoing = 'sdfdfg@???'"
database lookup required for select if(count(*), "yes", "no") from
maildata.account_data where outgoing = 'sdfdfg@???'
MYSQL query: select if(count(*), "yes", "no") from maildata.account_data
where outgoing = 'sdfdfg@???'
MYSQL using cached connection for localhost//exim
lookup yielded: no
calling sql_virtuals_part2 router
sql_virtuals_part2 router called for sdfdfg@???
domain = mupp.net
queued for virtual_smtp transport: local_part = sdfdfg
domain = mupp.net
errors_to=NULL
domain_data=NULL localpart_data=NULL
routed by sql_virtuals_part2 router
envelope to: sdfdfg@???
transport: virtual_smtp
sdfdfg@???
router = sql_virtuals_part2, transport = virtual_smtp
>