[exim] $domain is set to helo greeting in acl_smtp_mail?

Top Page
Delete this message
Reply to this message
Author: Eli Sand
Date:  
To: exim-users
Subject: [exim] $domain is set to helo greeting in acl_smtp_mail?
Ok, this one is a little baffling to me - wondering if this is expected or
not?

In the docs
(http://www.exim.org/exim-html-current/doc/html/spec_html/ch11.html), under
the info for $domain, it says that $domain should normally *not* be set
during the MAIL ACL (unless a callout was done, and even then $domain should
only exists in the expansion of certain other paramaters - not within the
core MAIL ACL itself... according to the wording of the docs).

I was reviewing my code with regards to the old "$domain isn't set to the
senders domain during MAIL so you can't use $domain in domainlist lookups
used to check if the domain/sender is a local domain or not" issue. My
current "fix" for that problem is that I set $acl_m_domain to
$sender_address_domain during MAIL, and then my local domainslist lookup
simply checks if $acl_m_domain is set and uses that as the lookup key,
otherwise it defaults to using $domain. Works good, but I figured - hey, if
I can get rid of an ACL variable, why not...

So I figured I would test to see if $domain was actually set in MAIL or not
- since I only ever use my "fix" for the problem in the MAIL ACL. The hope
was that $domain would not be set during MAIL, and I could change my
domainlist lookup from using:

${lookup mysql {SELECT `host` FROM `domain` WHERE `host` =
'${quote_mysql:${if def:acl_m_domain {$acl_m_domain}{$domain}}}' LIMIT 1}}

To something a bit nicer like:

${lookup mysql {SELECT `host` FROM `domain` WHERE `host` =
'${quote_mysql:${if def:domain {$domain}{$sender_address_domain}}}' LIMIT
1}}

(that would also relieve me from needing the acl_m_domain variable -
removing a few more lines from my config)

Anyways, after reading the docs it seemed like I *should* be able to do it,
but after some quick tests, it seems like $domain is being set to the HELO
greeting during the MAIL ACL. I used this in my acl_smtp_mail ACL to test:

warn message = This is a test to see if ${domain} is set
condition = ${if def:domain {yes}{no}}

The debugging result was:

13:51:38  2211 expanding: ${if def:domain {yes}{no}}
13:51:38  2211    result: yes
13:51:38  2211 check condition = ${if def:domain {yes}{no}}
13:51:38  2211                 = yes
13:51:38  2211 expanding: This is a test to see if ${domain} is set
13:51:38  2211    result: This is a test to see if my-helo-greeting is set
13:51:38  2211 warn: condition test succeeded


Where "my-helo-greeting" was exactly what I had typed in my session for my
HELO greeting. Is there a reason that $domain is set to the HELO greeting?
If this is intended, where is it documented? If it isn't intended, should
$domain in fact be blank during MAIL as the docs state?

Eli.