Please find attached helo.diff which adds proper HELO support to the
esmtpd.
I've tested this locally and it appears to do what it needs to do.
It might not be 100% correct, but it appears to be OK.
On Wed, 25 Jun 2003, Jon Nelson wrote:
> Courier SMTPd has a bug in it that I ran into yesterday.
>
> It returns an EHLO-style response to the HELO command, which is
> expressly forbidden in the RFC 2821, section 3.2, reproduced here
> (highlighting mine):
>
>
> 3.2. Client Initiation
>
> Once the server has sent the welcoming message and the client has
> received it, the client normally sends the EHLO command to the server,
> indicating the client's identity. In addition to opening the session,
> use of EHLO indicates that the client is able to process service
> extensions and requests that the server provide a list of the extensions
> it supports. Older SMTP systems which are unable to support service
> extensions and contemporary clients which do not require service
> extensions in the mail session being initiated, MAY use HELO instead of
> EHLO.
>
> ***
> Servers MUST NOT return the extended EHLO-style response to a HELO
> command.
> ***
>
> For a particular connection attempt, if the server returns a
> "command not recognized" response to EHLO, the client SHOULD be able to
> fall back and send HELO.
>
>
> Here is the evidence:
>
> [EMAIL PROTECTED] jnelson $ socat - tcp4:localhost:25,crlf
> 220 myhost.net ESMTP
> HELO testhost
> 250-myhost.net Ok.
> 250-STARTTLS
> 250-XCOURIEREXTENSIONS
> 250-XVERP=Courier
> 250-XEXDATA
> 250-XSECURITY=NONE,STARTTLS
> 250-PIPELINING
> 250-8BITMIME
> 250-SIZE
> 250 DSN
> QUIT
> 221 Bye.
> [EMAIL PROTECTED] jnelson $
>
>
> This bug prevents several older clients from working properly.
--
Feast your Vulcan squinties on that!
Jon Nelson <[EMAIL PROTECTED]>
C and Python Code Gardener
diff -ur courier-0.42.2.20030622.orig/courier/module.esmtp/courieresmtpd.c
courier-0.42.2.20030622/courier/module.esmtp/courieresmtpd.c
--- courier-0.42.2.20030622.orig/courier/module.esmtp/courieresmtpd.c 2003-01-04
22:08:12.000000000 -0600
+++ courier-0.42.2.20030622/courier/module.esmtp/courieresmtpd.c 2003-06-27
10:10:18.000000000 -0500
@@ -173,6 +173,17 @@
addiovec(e, sizeof(e)-1);
}
+static void helo(const char *heloname, int hasauth, int hastls, int tls)
+{
+const char *me=config_me();
+
+ addiovec("250 ", 4);
+ addiovec(me, strlen(me));
+ addiovec(" Ok.\r\n", 6);
+ helobuf[0]=0;
+ strncat(helobuf, heloname, sizeof(helobuf)-1);
+}
+
extern char **environ;
static void badfork()
@@ -961,9 +972,7 @@
}
if (strcmp(line, "QUIT") == 0) break;
- if ((strncmp(line, "EHLO ", 5) == 0 ||
- strncmp(line, "HELO ", 5) == 0) &&
- line[5])
+ if (strncmp(line, "EHLO ", 5) == 0 && line[5])
{
ehlo(line+5, argc > 1, starttls, tls);
iovflush();
@@ -971,6 +980,14 @@
startsubmit(tls);
continue;
}
+ else if (strncmp(line, "HELO ", 5) == 0 && line[5])
+ {
+ helo(line+5, argc > 1, starttls, tls);
+ iovflush();
+ cancelsubmit();
+ startsubmit(tls);
+ continue;
+ }
if (strcmp(line, "STARTTLS") == 0)
{
Only in courier-0.42.2.20030622/courier/module.esmtp: courieresmtpd.c~
Only in courier-0.42.2.20030622/courier/module.esmtp: tags