SENDERCHECK patch
Hugo Monteiro <[email protected]>
| Newsgroups | gmane.mail.qmail.ldap |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I've written a small patch that extends the SENDERCHECK facility. It
allows the definition of SENDERCHECK="AUTH", besides the already
existent STRICT and LOOSE.
The behaviour of SENDERCHECK is the same, except that when set to
"AUTH", if the sender address is local, and is verified in LDAP, the
server will require that the sender is authenticated.
I have written this patch because of the increasing number of spambots
forging valid local addresses. Many times using the same sender as the
recipient.
Maybe this would be a good idea incorporate in a future qmail-ldap
release..?
Best regards,
Hugo Monteiro.
--- dev/qmail-smtpd.c 2009-06-23 22:40:53.000000000 +0100
+++ current/qmail-smtpd.c 2009-06-27 21:04:06.000000000 +0100
@@ -418,6 +418,7 @@
sendercheck = 1;
if (!case_diffs("LOOSE",env_get("SENDERCHECK"))) sendercheck = 2;
if (!case_diffs("STRICT",env_get("SENDERCHECK"))) sendercheck = 3;
+ if (!case_diffs("AUTH",env_get("SENDERCHECK"))) sendercheck = 4;
}
if (env_get("RCPTCHECK")) rcptcheck = 1;
if (env_get("LDAPSOFTOK")) ldapsoftok = 1;
@@ -496,6 +497,7 @@
if (sendercheck == 1) logstring(3," ");
if (sendercheck == 2) logstring(3,"-loose ");
if (sendercheck == 3) logstring(3,"-strict ");
+ if (sendercheck == 4) logstring(3,"-auth ");
if (rcptcheck) logstring(3,"rcptcheck ");
if (ldapsoftok) logstring(3,"ldapsoftok ");
if (flagauth) logstring(3, "smtp-auth");
@@ -1132,6 +1134,12 @@
switch (ldaplookup(addr.s, &s)) {
case 1: /* valid */
logline(4,"sender verify OK");
+ if (sendercheck == 4 && !flagauthok) {
+ out("530 authentication needed\r\n");
+ logline(3, "auth needed");
+ if (errdisconnect) err_quit();
+ return;
+ }
break;
case 0: /* invalid */
logline2(2, "bad sender: ", addr.s);
--
ci.fct.unl.pt:~# cat .signature
Hugo Monteiro
Email : [email protected]
Telefone : +351 212948300 Ext.15307
Web : http://hmonteiro.net
Centro de Informática
Faculdade de Ciências e Tecnologia da
Universidade Nova de Lisboa
Quinta da Torre 2829-516 Caparica Portugal
Telefone: +351 212948596 Fax: +351 212948548
www.ci.fct.unl.pt [email protected]
ci.fct.unl.pt:~# _