From 576b1d3c417ddea79481063401837ec0bdb91658 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 28 Apr 2012 17:04:19 +0200 Subject: sendmail: use host rather than NIS domain name for HELO According to RFC 5321 the argument to HELO "contains the fully-qualified domain name of the SMTP client" or its IP address if no FQDN is available. BusyBox sendmail uses the NIS domain name instead which, in many cases, is likely to be the default "(none)". [vda: yes, I checked my machine and its uts.domainname was indeed "(none)"] Using the host name is more likely to satisfy the intent of the RFC while allowing the otherwise unused safe_getdomainname function to be removed. Signed-off-by: Ron Yorston Signed-off-by: Denys Vlasenko --- mailutils/sendmail.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mailutils') diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c index aa381c6..c426e9d 100644 --- a/mailutils/sendmail.c +++ b/mailutils/sendmail.c @@ -118,7 +118,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) char *opt_from; char *s; llist_t *list = NULL; - char *domain = sane_address(safe_getdomainname()); + char *host = sane_address(safe_gethostname()); unsigned nheaders = 0; int code; @@ -222,8 +222,9 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) } // we should start with modern EHLO - if (250 != smtp_checkp("EHLO %s", domain, -1)) - smtp_checkp("HELO %s", domain, 250); + if (250 != smtp_checkp("EHLO %s", host, -1)) + smtp_checkp("HELO %s", host, 250); + free(host); // perform authentication if (opts & OPT_a) { -- cgit v1.1