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.
This commit is contained in:
Renato Botelho 2006-06-08 23:47:10 +00:00
parent 9e4382fcfb
commit 32447622f7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=164861
3 changed files with 54 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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;