From 32447622f7bd3a0886d8cd707cf4666ed9701495 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 8 Jun 2006 23:47:10 +0000 Subject: [PATCH] Adapt qmail-smtpd to work fine with new rblsmtpd functionality, checking envvar set by rblsmtpd when IP matched on a RBL list and deny email is user is not authenticated. --- mail/qmail-spamcontrol/Makefile | 2 +- mail/qmail/Makefile | 3 +- .../extra-patch-spamcontrol-qmail-smtpd.c | 51 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 mail/qmail/files/extra-patch-spamcontrol-qmail-smtpd.c diff --git a/mail/qmail-spamcontrol/Makefile b/mail/qmail-spamcontrol/Makefile index 3e32b4af9d7b..f94ca9daf0f1 100644 --- a/mail/qmail-spamcontrol/Makefile +++ b/mail/qmail-spamcontrol/Makefile @@ -7,7 +7,7 @@ PORTNAME= qmail PORTVERSION= ${QMAIL_VERSION}.${SPAMCONTROL_VERSION} -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= mail MASTER_SITES+= http://www.fehcom.de/qmail/spamcontrol/:spamcontrol PKGNAMESUFFIX= -spamcontrol diff --git a/mail/qmail/Makefile b/mail/qmail/Makefile index 1426a36662e2..826728232ca0 100644 --- a/mail/qmail/Makefile +++ b/mail/qmail/Makefile @@ -494,7 +494,8 @@ post-patch: . for option in ${SELECTED_OPTIONS} @${ECHO_CMD} ${option} >> ${WRKSRC}/conf-spamcontrol . endfor - @cd ${WRKSRC} && ./install_spamcontrol.sh + @cd ${WRKSRC} && ./install_spamcontrol.sh && \ + ${PATCH} < ${FILESDIR}/extra-patch-spamcontrol-qmail-smtpd.c .elif defined(SLAVE_TLS) @${HEAD} -105 ${DISTDIR}/${DIST_SUBDIR}/qmail-1.03-tls-${TLS_PATCH_DATE}-renato.patch > \ ${WRKDIR}/TLS.readme diff --git a/mail/qmail/files/extra-patch-spamcontrol-qmail-smtpd.c b/mail/qmail/files/extra-patch-spamcontrol-qmail-smtpd.c new file mode 100644 index 000000000000..48676daf1d26 --- /dev/null +++ b/mail/qmail/files/extra-patch-spamcontrol-qmail-smtpd.c @@ -0,0 +1,51 @@ +--- qmail-smtpd.c.orig Sun Jun 4 18:50:11 2006 ++++ qmail-smtpd.c Sun Jun 4 18:54:15 2006 +@@ -129,6 +129,18 @@ + logs(s1,s2,s3,s4,s5,s6,s7); + return; + } ++void err_rbl(s1,s2,s3,s4,s5,s6,s7) char *s1, *s2, *s3, *s4, *s5, *s6, *s7; { ++ stralloc rblmessage = {0}; ++ ++ if (!stralloc_copys(&rblmessage,"553 sorry, your IP is listed on a RBL list ")) die_nomem(); ++ if (!stralloc_cats(&rblmessage,env_get("RBLMATCH"))) die_nomem(); ++ if (!stralloc_cats(&rblmessage," (#5.7.1)\r\n")) die_nomem(); ++ if (!stralloc_0(&rblmessage)) die_nomem(); ++ ++ out(rblmessage.s); ++ logs(s1,s2,s3,s4,s5,s6,s7); ++ return; ++ } + void err_brcptto(s1,s2,s3,s4,s5,s6,s7) char *s1, *s2, *s3, *s4, *s5, *s6, *s7; { + out("550 sorry, your envelope recipient is in my badrcptto list (#5.7.1)\r\n"); + logs(s1,s2,s3,s4,s5,s6,s7); +@@ -270,6 +282,8 @@ + + char *auth; + char *reqauth; ++char *rbl2smtpd; ++char *rblmatch; + int smtpauth = 0; + int seenauth = 0; + +@@ -388,6 +402,9 @@ + if(env_get("UCSPITLS")) starttls = 1; + if(starttls) reqttls = env_get("REQUIRETLS"); + ++ rbl2smtpd = env_get("RBL2SMTPD"); ++ rblmatch = env_get("RBLMATCH"); ++ + #ifdef RELAYMAILFROM + if (!relayclient) { + relaymailfromok = control_readfile(&relaymailfrom,"control/relaymailfrom",0); +@@ -910,6 +927,10 @@ + flagerrcpts++; + 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) { + err_rcpts("Reject::RCPT::Toomany_Rcptto:",protocol.s,remoteip,remotehost,helohost.s,mailfrom.s,addr.s); + return;