freebsd-ports/mail/qmail/files/extra-patch-spamcontrol-qmail-smtpd.c
Bryan Drewery 92d8ac9962 mail/qmail-spamcontrol: Update to 2.7.31
TLSREMOTE, NEWLINE, and BIGTODO are now mandatory upstream and have been
removed as options.

MOREIPME was removed upstream.

Changes:
  http://www.fehcom.de/qmail/spamcontrol/RELEASE_27.spamcontrol

  CHANGES (2.6 -> 2.7)
  --------------------

  Userland:
  +) ucspi-ssl (> 0.8) mandatory.
  +) Added CRAM-MD5 support for qmail-remote.
  +) Added qmail-smtpam PAM for Recipients extension.
  +) Added sender-domain based TLS settings for qmail-remote.
  :) Changed qmail-remote's 'tlspeerhosts' to' tlsdestinations'.
  -) Removed moreip and notipme feature.
  :) REQUIREAUTH has been collapsed into SMTPAUTH with leading "!",
  :) SMTPAUTH has been enhanced to support: "!" Required; "-" Off.
  :) SMTPAUTH cram-md5 annoucement has to be prefixed with a '+':
     SMTPAUTH='+cram' (to allow future additional AUTH mechanisms).
  :) UCSPITLS has been enhanced to support: "!" Required "-" Off.
  +) Added logging for qmail-popup.
  +) Added CAPA support for qmail-popup/qmail-pop3d.
  :) Unified qmail-smtpd and qmail-popup logging.
  +) SPF and RBLSMTPD hook to display info in Received header.
  +) LOCALMFCHECK='=' requiring 'Mail From:' = 'TCPREMOTEINFO'.

  Internal:
  !) Bigtodo is default now.
  !) Maximum silent concurrency increased to 500.
  #) Aligend with recipients-0.7.2.
  #) Aligned with smtp-authentication 0.7.6.
  %) qmail-smtpd logging and reply messages 'off-shored'.
  ?) qmail-smtpd tls vulnerability VU#555316 fixed.
  ?) qmail-smtpd DNS lookup failures don't result in dropped
     connections anymore.
  %) qmail-remote evalutes in addition Alternative Subject for TLS host verification.
  %) Complete FreeBSD AMD64 support (conf-cc, conf-ld, conf-spamcontrol).
  #) Aligned with mav 0.20.
  +) Added partial clang support.

  ADDITIONAL CHANGES
  ------------------

  +) Added SMTP Authentication based on smtproutes/destination.
  #) Aligned with SMTP Authentication 0.8.0.
  -) Removed obsolete SUBMISSION environment variable and special treatement.
  :) Enhanced badmailfrom with new qualifier '~' for extended addresses
     to filter mismatched domain names.
  +) Added *.3 man pages in setup (dirs were missing before).
  ;) SPF Hook working now.
2014-06-27 02:33:04 +00:00

61 lines
2 KiB
C

--- qmail-smtpd.c.orig 2014-06-26 16:33:05.703716277 -0500
+++ qmail-smtpd.c 2014-06-26 16:40:11.516685934 -0500
@@ -116,6 +116,28 @@ int seenhelo = 0;
char *badmailcond;
char *badhelocond;
+void err_rbl(s1,s2,s3,s4,s5,s6,s7) char *s1, *s2, *s3, *s4, *s5, *s6, *s7; {
+ char *rblmatch;
+ stralloc rblmessage = {0};
+ stralloc new_s1 = {0};
+
+ rblmatch = env_get("RBLMATCH");
+
+ if (!stralloc_copys(&rblmessage,"553 sorry, your IP is listed on a RBL list ")) die_nomem();
+ if (!stralloc_cats(&rblmessage,rblmatch)) die_nomem();
+ if (!stralloc_cats(&rblmessage," (#5.7.1)\r\n")) die_nomem();
+ if (!stralloc_0(&rblmessage)) die_nomem();
+
+ if (!stralloc_copys(&new_s1, s1)) die_nomem();
+ if (!stralloc_cats(&new_s1, " ")) die_nomem();
+ if (!stralloc_cats(&new_s1, rblmatch)) die_nomem();
+ if (!stralloc_0(&new_s1)) die_nomem();
+
+ out(rblmessage.s);
+ smtp_logg(new_s1.s,s2,s3,s4,s5,s6,s7);
+ return;
+ }
+
void dohelo(arg) char *arg;
{
if (!stralloc_copys(&helohost,arg)) die_nomem();
@@ -183,6 +205,8 @@ int tarpitcount = 0;
int tarpitdelay = 0;
char *auth;
+char *rbl2smtpd;
+char *rblmatch;
int smtpauth = 0; /* -1:Cert 0:none 1:login/plain 2:cram 3:login/plain/cram 11:must_login/plain 12:must_2 13:must_3 */
int seenauth = 0;
@@ -344,6 +368,9 @@ void setup()
if (!stralloc_cats(&mailto," ")) die_nomem();
}
+ rbl2smtpd = env_get("RBL2SMTPD");
+ rblmatch = env_get("RBLMATCH");
+
rblsmtpd = env_get("RBLSMTPD");
if (rblsmtpd) {
if (!stralloc_cats(&rblinfo,rblsmtpd)) die_nomem();
@@ -909,6 +936,10 @@ void smtp_rcpt(arg) char *arg; {
return;
}
+ if (!seenauth && rbl2smtpd && rblmatch && str_len(rblmatch) != 0) {
+ err_rbl("Reject::RBL::RBL_Listed:",protocol.s,remoteip,remotehost,helohost.s,mailfrom.s,addr.s);
+ return;
+ }
if (tarpitcount && flagerrcpts >= tarpitcount) { /* Tarpitting et al. */
if (tarpitdelay == 999) flagnotorious++;
err_rcpts("Reject::RCPT::Toomany_Rcptto",protocol.s,remoteip,remotehost,helohost.s,mailfrom.s,addr.s);