fallback to "." when gethostname() yield an empty result

Robert Young <[email protected]>
Newsgroups gmane.comp.gnu.mailutils.bugs
Message-ID <CAJjz_NhF9mR0YxD8y=6=hFzCjADmQHsj7L_6a4CcSx=10Cv7_Q@mail.gmail.com>
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:[email protected]' --append='From:
Test <[email protected]>' --subject=Test [email protected]
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:[email protected]
' --append='From: Test <[email protected]>' --subject=Test
[email protected]
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 <[email protected]>
        (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
        Thu, 19 Oct 2017 19:08:01 -0700 (PDT)
Message-ID: <[email protected]>
...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.