patch to force helo or ehlo before any smtp command
Mario Remy Almeida <[email protected]>
| Newsgroups | gmane.mail.qmail.ldap |
|---|---|
| Organization | ISA |
| Message-ID | <1222588712.2588.42.camel@mario> |
Hi All, I have a patch to force helo or ehlo before any smtp command, Apply this patch to qmail-1.03 after qmail-ldap-1.03-20060201.patch is applied Regards, Remy
force_helo_or_ehol.patch
(text/x-patch, 1.5 KB)
diff -urN qmail-1.03.orig/qmail-smtpd.c qmail-1.03/qmail-smtpd.c
--- qmail-1.03.orig/qmail-smtpd.c 2008-09-26 11:46:23.000000000 +0400
+++ qmail-1.03/qmail-smtpd.c 2008-09-28 09:56:37.000000000 +0400
@@ -176,6 +176,7 @@
void err_relay(void) { out("553 sorry, we don't relay for ["); out(remoteip); out("] (#5.7.1)\r\n"); }
void err_wantmail(void) { out("503 MAIL first (#5.5.1)\r\n"); logline(4,"'mail from' first"); }
void err_wantrcpt(void) { out("503 RCPT first (#5.5.1)\r\n"); logline(4,"'rcpt to' first"); }
+void err_wanthelo(void) { out("503 EHLO/HELO first (#5.5.1)\r\n"); logline(4,"'ehlo/helo' first"); }
void err_noop(char *arg) { out("250 ok\r\n"); logline(4,"'noop'"); }
void err_vrfy(char *arg) { out("252 send some mail, i'll try my best\r\n"); logline2(4,"vrfy for: ",arg); }
@@ -662,6 +663,7 @@
}
int seenmail = 0;
+int helo = 0;
stralloc mailfrom = {0};
stralloc rcptto = {0};
unsigned int rcptcount;
@@ -835,6 +837,7 @@
void smtp_helo(char *arg)
{
smtp_line("250 ");
+ helo = 1;
seenmail = 0; dohelo(arg);
logline2(4, "remote helo: ", arg);
}
@@ -842,6 +845,7 @@
void smtp_ehlo(char *arg)
{
smtp_line("250-");
+ helo = 1;
out("250-PIPELINING\r\n");
if (databytes != 0) {
smtpsize[fmt_ulong(smtpsize, databytes)] = 0;
@@ -883,6 +887,13 @@
char *rblname;
int bounceflag = 0;
+ /* check for helo/ehlo syntax*/
+ if(!helo)
+ {
+ err_wanthelo();
+ if (errdisconnect) err_quit();
+ return;
+ }
/* address syntax check */
if (!addrparse(arg))
{