Discussion:
[bug-mailutils] fallback to "." when gethostname() yield an empty result
Robert Young
2017-10-20 02:25:59 UTC
Permalink
ERROR: An empty_argumented EHLO command issued on a machine without hostname

tmp # date | /usr/bin/mail --debug-level=mailer.prot --exec='set
sendmail=smtps://your_mail:***@smtp.gmail.com' --append='From:
Test <***@gmail.com>' --subject=Test ***@gmail.com
mail: S: 220 smtp.gmail.com ESMTP l191sm18203421pfc.180 - gsmtp
mail: C: EHLO
mail: S: 501-5.5.4 Empty HELO/EHLO argument not allowed, closing connection.
mail: S: 501 5.5.4 https://support.google.com/mail/?p=helo
l191sm18203421pfc.180 - gsmtp
mail: C: HELO
mail: Cannot open mailer: Input/output error
mail: cannot send message: Input/output error
tmp #

PATCH to solve this issue:

--- mailutils-3.3/libproto/mailer/smtp_ehlo.c 2017-01-01
13:47:12.000000000 +0000
+++ mailutils-3.3/libproto/mailer/smtp_ehlo.c 2017-01-01
13:47:12.000000000 +0000
@@ -65,6 +65,7 @@
p++;
else
p = host;
+ if(NULL==p||0==p[0]) p=".";
status = mu_smtp_set_param (smtp, MU_SMTP_PARAM_DOMAIN, p);
MU_SMTP_CHECK_ERROR (smtp, status);
}

PATCHED_TEST:
tmp # date | /usr/bin/mail --debug-level=mailer.prot --exec='set
sendmail=smtps://your_mail:***@smtp.gmail.com
' --append='From: Test <***@gmail.com>' --subject=Test
***@gmail.com
mail: S: 220 smtp.gmail.com ESMTP 62sm28074905pfw.129 - gsmtp
mail: C: EHLO .
mail: S: 250-smtp.gmail.com at your service, [106.184.3.179]
...
mail: S: 250 2.0.0 OK 1508465282 62sm28074905pfw.129 - gsmtp
mail: C: QUIT
mail: S: 221 2.0.0 closing connection 62sm28074905pfw.129 - gsmtp

TEST_RESULT:
Received: from . (li1068-179.members.linode.com. [106.184.3.179])
by smtp.gmail.com with ESMTPSA id
62sm28074905pfw.129.2017.10.19.19.08.00
for <***@gmail.com>
(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
Thu, 19 Oct 2017 19:08:01 -0700 (PDT)
Message-ID: <***@mx.google.com>
...
Sergey Poznyakoff
2017-11-01 09:07:12 UTC
Permalink
Post by Robert Young
ERROR: An empty_argumented EHLO command issued on a machine without hostname
Thanks for reporting.
Single dot is not a valid argument for the EHLO command. RFC mandates
that its argument be either a valid hostname or an IP address in square
brackets. I've fixed this in commit 4e7bcdbae346a26c1addf266a23c1f6cdc74533f.

Regards,
Sergey
Robert Young
2017-11-07 07:50:45 UTC
Permalink
It seems problem NOT solved!

tmp # /usr/bin/mail -V
mail (GNU Mailutils) 3.4

TEST1(empty_hostname):
tmp # hostname ''
tmp # date | /usr/bin/mail --debug-level=mailer.prot --exec='setq
mode=send' --exec='set ignore' --exec='set noquit' --exec='set
noaskcc' --exec='set noasksub' --exec='set nosave' --exec='set
noappenddeadletter' --exec='set nonullbody' --exec='set nonullbodymsg'
--exec='set noxmailer' --exec='set readonly' --exec='set
sendmail=smtps://your_mail:***@smtp.gmail.com' --append='From:
Test <***@gmail.com>' --subject=Test ***@gmail.com
mail: S: 220 smtp.gmail.com ESMTP c1sm1582198pfa.12 - gsmtp
mail: Cannot open mailer: Function not implemented
Segmentation fault
tmp #

TEST2("."==hostname):
tmp # hostname .
tmp # date | /usr/bin/mail --debug-level=mailer.prot --exec='setq
mode=send' --exec='set ignore' --exec='set noquit' --exec='set
noaskcc' --exec='set noasksub' --exec='set nosave' --exec='set
noappenddeadletter' --exec='set nonullbody' --exec='set nonullbodymsg'
--exec='set noxmailer' --exec='set readonly' --exec='set
sendmail=smtps://your_mail:***@smtp.gmail.com' --append='From:
Test <***@gmail.com>' --subject=Test ***@gmail.com
mail: S: 220 smtp.gmail.com ESMTP m195sm1475229pga.13 - gsmtp
mail: C: EHLO
mail: S: 501-5.5.4 Empty HELO/EHLO argument not allowed, closing connection.
mail: S: 501 5.5.4 https://support.google.com/mail/?p=helo
m195sm1475229pga.13 - gsmtp
mail: C: HELO
mail: Cannot open mailer: Input/output error
Segmentation fault
tmp #

TEST3("myhost"==hostname):
tmp # hostname myhost
tmp # date | /usr/bin/mail --debug-level=mailer.prot --exec='setq
mode=send' --exec='set ignore' --exec='set noquit' --exec='set
noaskcc' --exec='set noasksub' --exec='set nosave' --exec='set
noappenddeadletter' --exec='set nonullbody' --exec='set nonullbodymsg'
--exec='set noxmailer' --exec='set readonly' --exec='set
sendmail=smtps://your_mail:***@smtp.gmail.com' --append='From:
Test <***@gmail.com>' --subject=Test ***@gmail.com
mail: S: 220 smtp.gmail.com ESMTP v15sm1512791pfa.50 - gsmtp
mail: C: EHLO myhost
mail: S: 250-smtp.gmail.com at your service, [106.184.3.179]
...
mail: C: .
mail: S: 250 2.0.0 OK 1510040860 v15sm1512791pfa.50 - gsmtp
mail: C: QUIT
mail: S: 221 2.0.0 closing connection v15sm1512791pfa.50 - gsmtp
Post by Sergey Poznyakoff
Post by Robert Young
ERROR: An empty_argumented EHLO command issued on a machine without hostname
Thanks for reporting.
Single dot is not a valid argument for the EHLO command. RFC mandates
that its argument be either a valid hostname or an IP address in square
brackets. I've fixed this in commit 4e7bcdbae346a26c1addf266a23c1f6cdc74533f.
Regards,
Sergey
Sergey Poznyakoff
2017-11-08 11:10:58 UTC
Permalink
Hi Robert,

Running your test[1] on my test box without hostname[2], I get:

mail: S: 220 ulysses.gnu.org.ua ESMTP server ready
mail: C: EHLO [10.102.42.241]
[...irrelevant output omitted...]
mail: C: QUIT
mail: S: 221 2.0.0 ulysses.gnu.org.ua closing connection

and the message gets delivered correctly.

Perhaps I could get more insight into your problem if I saw your
config.log file.

Regards,
Sergey

[1] FWIW, the '--exec=setq mode=send' option is useless,
[2] hostname '' on GNU/Linus gives 'the specified hostname is
invalid'. I had to write a small program to clear the hostname instead.
Sergey Poznyakoff
2017-11-08 14:19:27 UTC
Permalink
Hi Robert,

I was able to reproduce the problem. Please pull
7172ec8e493bc3467d669336c7a6b75913a2985f to fix.

Regards,
Sergey

Loading...