Path: blob/main/contrib/blocklist/diff/postfix.diff
47431 views
Index: dist/src/smtpd/pfilter.c1===================================================================2RCS file: dist/src/smtpd/pfilter.c3diff -N dist/src/smtpd/pfilter.c4--- /dev/null 1 Jan 1970 00:00:00 -00005+++ dist/src/smtpd/pfilter.c 1 Feb 2018 03:29:09 -00006@@ -0,0 +1,19 @@7+#include "pfilter.h"8+#include <stdio.h> /* for NULL */9+#include <blocklist.h>10+11+static struct blocklist *blstate;12+13+void14+pfilter_notify(int a, int fd)15+{16+ if (blstate == NULL)17+ blstate = blocklist_open();18+ if (blstate == NULL)19+ return;20+ (void)blocklist_r(blstate, a, fd, "smtpd");21+ if (a == 0) {22+ blocklist_close(blstate);23+ blstate = NULL;24+ }25+}26Index: dist/src/smtpd/pfilter.h27===================================================================28RCS file: dist/src/smtpd/pfilter.h29diff -N dist/src/smtpd/pfilter.h30--- /dev/null 1 Jan 1970 00:00:00 -000031+++ dist/src/smtpd/pfilter.h 1 Feb 2018 03:29:09 -000032@@ -0,0 +1,2 @@33+34+void pfilter_notify(int, int);35Index: dist/src/smtpd/smtpd.c36===================================================================37RCS file: /cvsroot/src/external/ibm-public/postfix/dist/src/smtpd/smtpd.c,v38retrieving revision 1.1439diff -u -r1.14 smtpd.c40--- dist/src/smtpd/smtpd.c 14 Feb 2017 01:16:48 -0000 1.1441+++ dist/src/smtpd/smtpd.c 1 Feb 2018 03:29:09 -000042@@ -1197,6 +1197,8 @@43#include <smtpd_milter.h>44#include <smtpd_expand.h>4546+#include "pfilter.h"47+48/*49* Tunable parameters. Make sure that there is some bound on the length of50* an SMTP command, so that the mail system stays in control even when a51@@ -5048,6 +5050,7 @@52if (state->error_count >= var_smtpd_hard_erlim) {53state->reason = REASON_ERROR_LIMIT;54state->error_mask |= MAIL_ERROR_PROTOCOL;55+ pfilter_notify(1, vstream_fileno(state->client));56smtpd_chat_reply(state, "421 4.7.0 %s Error: too many errors",57var_myhostname);58break;59Index: libexec/smtpd/Makefile60===================================================================61RCS file: /cvsroot/src/external/ibm-public/postfix/libexec/smtpd/Makefile,v62retrieving revision 1.663diff -u -r1.6 Makefile64--- libexec/smtpd/Makefile 21 May 2017 15:28:40 -0000 1.665+++ libexec/smtpd/Makefile 1 Feb 2018 03:29:09 -000066@@ -13,11 +13,14 @@67SRCS= smtpd.c smtpd_token.c smtpd_check.c smtpd_chat.c smtpd_state.c \68smtpd_peer.c smtpd_sasl_proto.c smtpd_sasl_glue.c smtpd_proxy.c \69smtpd_xforward.c smtpd_dsn_fix.c smtpd_milter.c smtpd_resolve.c \70- smtpd_expand.c smtpd_haproxy.c71+ smtpd_expand.c smtpd_haproxy.c pfilter.c7273DPADD+= ${LIBPMASTER} ${LIBPMILTER} ${LIBPGLOBAL} ${LIBPDNS} ${LIBPXSASL}74LDADD+= ${LIBPMASTER} ${LIBPMILTER} ${LIBPGLOBAL} ${LIBPDNS} ${LIBPXSASL}7576+DPADD+= ${LIBBLOCKLIST}77+LDADD+= -lblocklist78+79DPADD+= ${LIBPTLS} ${LIBSSL} ${LIBCRYPTO}80LDADD+= ${LIBPTLS} -lssl -lcrypto8182Index: dist/src/smtpd/smtpd.c83===================================================================84RCS file: /cvsroot/src/external/ibm-public/postfix/dist/src/smtpd/smtpd.c,v85retrieving revision 1.1786diff -u -u -r1.17 smtpd.c87--- dist/src/smtpd/smtpd.c 18 Mar 2020 19:05:20 -0000 1.1788+++ dist/src/smtpd/smtpd.c 25 Sep 2020 12:51:52 -000089@@ -5795,6 +5795,8 @@90|| strcmp(state->reason, REASON_LOST_CONNECTION)) {91msg_info("%s after %s from %s",92state->reason, state->where, state->namaddr);93+ if (strcmp(state->where, SMTPD_CMD_AUTH) == 0)94+ pfilter_notify(1, vstream_fileno(state->client));95}96}979899100