diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-08-03 13:27:07 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-08-03 13:27:28 +0300 |
commit | 7d9cc74142bd638459739b77e12bc6f14acb5c21 (patch) | |
tree | 7f3679860cd6eda5289a61ad1571d36ee4acf8b4 | |
parent | d0b85683e43e50d7fa9bac5f1c29af6d98791af9 (diff) | |
download | mailfromd-7d9cc74142bd638459739b77e12bc6f14acb5c21.tar.gz mailfromd-7d9cc74142bd638459739b77e12bc6f14acb5c21.tar.bz2 |
Minor fixes. Improve callout sequence.
* etc/mailfromd.mf (begin): Unconditionally initialize
ehlo_domain. Provide a comment explaining this.
* mfd/builtin/vars.bi: Set ehlo_domain to the value of
the domain name, instead of the host name.
* mfd/callout.c (callout_io): Try EHLO first and fall back
to HELO if it fails, as requested by RFC 2821, section
3.2 "Client Initiation".
-rw-r--r-- | etc/mailfromd.mf | 11 | ||||
-rw-r--r-- | mfd/builtin/vars.bi | 11 | ||||
-rw-r--r-- | mfd/callout.c | 6 |
3 files changed, 17 insertions, 11 deletions
diff --git a/etc/mailfromd.mf b/etc/mailfromd.mf index 2227e170..eb7bd165 100644 --- a/etc/mailfromd.mf +++ b/etc/mailfromd.mf @@ -23,10 +23,11 @@ require localdomain require rateok set mailfrom_address "<>" -# If mailfromd does not determine local domain correctly, uncomment this -# and replace DOMAIN with your local domain: +# If mailfromd does not determine your local domain correctly, uncomment this, +# replace DOMAIN with your local domain, and comment out the assignment to +# this variable in the `begin' block below. #set ehlo_domain "DOMAIN" - + number gltime interval("1 hour") number need_greylist 0 @@ -35,9 +36,7 @@ number need_greylist 0 */ begin do - if ehlo_domain == "" - set ehlo_domain localdomain() - fi + set ehlo_domain localdomain() done func cachestr() diff --git a/mfd/builtin/vars.bi b/mfd/builtin/vars.bi index a834805f..e8da0d2e 100644 --- a/mfd/builtin/vars.bi +++ b/mfd/builtin/vars.bi @@ -82,12 +82,19 @@ void builtin_post_setup() { struct value val; + char *smtp_hostname; char *smtp_domain; - mu_get_host_name(&smtp_domain); + mu_get_host_name(&smtp_hostname); + smtp_domain = strchr(smtp_hostname, '.'); + if (smtp_domain) + smtp_domain++; + else + smtp_domain = smtp_hostname; + val.type = dtype_string; val.v.literal = string_alloc(smtp_domain, strlen(smtp_domain)); - free(smtp_domain); + free(smtp_hostname); ensure_initialized_variable("ehlo_domain", &val); val.type = dtype_string; diff --git a/mfd/callout.c b/mfd/callout.c index 57d0c3a6..f93290a5 100644 --- a/mfd/callout.c +++ b/mfd/callout.c @@ -430,13 +430,13 @@ callout_io(struct smtp_io_data *io, const char *hostname, mu_address_t addr) return SMTP_MAJOR(io->code) == 4 ? mf_temp_failure : mf_not_found; - smtp_send2(io, "HELO ", io->ehlo); + smtp_send2(io, "EHLO ", io->ehlo); if (smtp_recv(io, smtp_timeout_helo)) return mf_timeout; if (SMTP_MAJOR(io->code) == 5) { - /* Let's try EHLO, then */ - smtp_send2(io, "EHLO ", io->ehlo); + /* Let's try HELO, then */ + smtp_send2(io, "HELO ", io->ehlo); if (smtp_recv(io, smtp_timeout_helo)) return mf_not_found; } |