Hello,
While rewriting my mysql-based exim configuration file entirely, I've
came across a really strange issue which I can not explain. It could be
something minor of course but.. anyway:
begin authenticators
plain:
[snip snip]
client_send = ${lookup mysql{select
concat('^',users_manualroute.user,'^',users_manualroute.passwd) \
from users_manualroute,users,domains \
where
concat(users.user,'@',domains.domain)='${quote_mysql:$authenticated_id}' \
and users.domain_id=domains.id \
and users.active='on' and domains.active='on' \
and users_manualroute.host LIKE '%.%'}}
What I attempt to do here is to have a feature of manualroute for each
user. In case an auth is necessary for this manualroute then it will
perform it with the authenticators (hosts_try_auth). When I attempt the
MySQL query I've just pasted I get in the debug:
25942 == mytest@??? R=user_manualroute T=remote_smtp_auth defer
(0): expansion of "${lookup mysql{select
concat('^',users_manualroute.user,'^',users_manualroute.passwd) from
users_manualroute,users,domains where
concat(users.user,'@',domains.domain)='${quote_mysql" failed in plain
authenticator: "${quote_mysql" is not a known operator (or a } is
missing in a variable reference)
Now, when I take off $quote_mysql and sending $authenticated_id as unquoted:
client_send = ${lookup mysql{select
concat('^',users_manualroute.user,'^',users_manualroute.passwd) \
from users_manualroute,users,domains \
where
concat(users.user,'@',domains.domain)='$authenticated_id' \
and users.domain_id=domains.id \
and users.active='on' and domains.active='on' \
and users_manualroute.host LIKE '%.%'}}
I then get:
18883 key="select
concat('^',users_manualroute.user,'^',users_manualroute.passwd) from
users_manualroute,users,domains where
concat(users.user,'@',domains.domain)='myothertest@???' and
users.domain_id=domains.id and users.active='on' and domains.active='on'
and users_manualroute.host LIKE '%.%'" partial=-1 affix=NULL starflags=0
18883 LRU list:
18883 internal_search_find: file="NULL"
18883 type=mysql key="select
concat('^',users_manualroute.user,'^',users_manualroute.passwd) from
users_manualroute,users,domains where
concat(users.user,'@',domains.domain)='myothertest@???' and
users.domain_id=domains.id and users.active='on' and domains.active='on'
and users_manualroute.host LIKE '%.%'"
18883 database lookup required for select
concat('^',users_manualroute.user,'^',users_manualroute.passwd) from
users_manualroute,users,domains where
concat(users.user,'@',domains.domain)='myothertest@???' and
users.domain_id=domains.id and users.active='on' and domains.active='on'
and users_manualroute.host LIKE '%.%'
18883 MYSQL query: select
concat('^',users_manualroute.user,'^',users_manualroute.passwd) from
users_manualroute,users,domains where
concat(users.user,'@',domains.domain)='myothertest@???' and
users.domain_id=domains.id and users.active='on' and domains.active='on'
and users_manualroute.host LIKE '%.%'
18883 MYSQL new connection: host=localhost port=0
socket=/var/run/mysqld/mysqld.sock database=mail user=exim
18883 lookup yielded: ^testuser^testpass
Exim debug version info:
Exim version 4.62 uid=0 gid=0 pid=28015 D=fbb95cfd
Berkeley DB: Sleepycat Software: Berkeley DB 4.2.52: (December 3, 2003)
Support for: crypteq iconv() IPv6 PAM Perl TCPwrappers OpenSSL
Content_Scanning Old_Demime Experimental_SPF Experimental_SRS
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb
dsearch mysql passwd pgsql sqlite
Authenticators: cram_md5 cyrus_sasl plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Bottom line:
${quote_mysql:$authenticated_id} refuses to work for me in the plain
authenticator even tho I use it at plenty other places (routers,
transports); when taking out the quote_mysql everything works fine, any
hint will be appreciated!
Thank you! Tomer.