xref: /src/contrib/blocklist/diff/postfix.diff (revision 48e64ca13d4f36795ac718911b805e3e9a726f1b)
1e6a066acSEd MasteIndex: dist/src/smtpd/pfilter.c
2e6a066acSEd Maste===================================================================
3e6a066acSEd MasteRCS file: dist/src/smtpd/pfilter.c
4e6a066acSEd Mastediff -N dist/src/smtpd/pfilter.c
5e6a066acSEd Maste--- /dev/null	1 Jan 1970 00:00:00 -0000
6e6a066acSEd Maste+++ dist/src/smtpd/pfilter.c	1 Feb 2018 03:29:09 -0000
7e6a066acSEd Maste@@ -0,0 +1,19 @@
8e6a066acSEd Maste+#include "pfilter.h"
9e6a066acSEd Maste+#include <stdio.h>	/* for NULL */
10e6a066acSEd Maste+#include <blocklist.h>
11e6a066acSEd Maste+
12e6a066acSEd Maste+static struct blocklist *blstate;
13e6a066acSEd Maste+
14e6a066acSEd Maste+void
15e6a066acSEd Maste+pfilter_notify(int a, int fd)
16e6a066acSEd Maste+{
17e6a066acSEd Maste+	if (blstate == NULL)
18e6a066acSEd Maste+		blstate = blocklist_open();
19e6a066acSEd Maste+	if (blstate == NULL)
20e6a066acSEd Maste+		return;
21e6a066acSEd Maste+	(void)blocklist_r(blstate, a, fd, "smtpd");
22e6a066acSEd Maste+	if (a == 0) {
23e6a066acSEd Maste+		blocklist_close(blstate);
24e6a066acSEd Maste+		blstate = NULL;
25e6a066acSEd Maste+	}
26e6a066acSEd Maste+}
27e6a066acSEd MasteIndex: dist/src/smtpd/pfilter.h
28e6a066acSEd Maste===================================================================
29e6a066acSEd MasteRCS file: dist/src/smtpd/pfilter.h
30e6a066acSEd Mastediff -N dist/src/smtpd/pfilter.h
31e6a066acSEd Maste--- /dev/null	1 Jan 1970 00:00:00 -0000
32e6a066acSEd Maste+++ dist/src/smtpd/pfilter.h	1 Feb 2018 03:29:09 -0000
33e6a066acSEd Maste@@ -0,0 +1,2 @@
34e6a066acSEd Maste+
35e6a066acSEd Maste+void pfilter_notify(int, int);
36e6a066acSEd MasteIndex: dist/src/smtpd/smtpd.c
37e6a066acSEd Maste===================================================================
38e6a066acSEd MasteRCS file: /cvsroot/src/external/ibm-public/postfix/dist/src/smtpd/smtpd.c,v
39e6a066acSEd Masteretrieving revision 1.14
40e6a066acSEd Mastediff -u -r1.14 smtpd.c
41e6a066acSEd Maste--- dist/src/smtpd/smtpd.c	14 Feb 2017 01:16:48 -0000	1.14
42e6a066acSEd Maste+++ dist/src/smtpd/smtpd.c	1 Feb 2018 03:29:09 -0000
43e6a066acSEd Maste@@ -1197,6 +1197,8 @@
44e6a066acSEd Maste #include <smtpd_milter.h>
45e6a066acSEd Maste #include <smtpd_expand.h>
46e6a066acSEd Maste
47e6a066acSEd Maste+#include "pfilter.h"
48e6a066acSEd Maste+
49e6a066acSEd Maste  /*
50e6a066acSEd Maste   * Tunable parameters. Make sure that there is some bound on the length of
51e6a066acSEd Maste   * an SMTP command, so that the mail system stays in control even when a
52e6a066acSEd Maste@@ -5048,6 +5050,7 @@
53e6a066acSEd Maste 	    if (state->error_count >= var_smtpd_hard_erlim) {
54e6a066acSEd Maste 		state->reason = REASON_ERROR_LIMIT;
55e6a066acSEd Maste 		state->error_mask |= MAIL_ERROR_PROTOCOL;
56e6a066acSEd Maste+		pfilter_notify(1, vstream_fileno(state->client));
57e6a066acSEd Maste 		smtpd_chat_reply(state, "421 4.7.0 %s Error: too many errors",
58e6a066acSEd Maste 				 var_myhostname);
59e6a066acSEd Maste 		break;
60e6a066acSEd MasteIndex: libexec/smtpd/Makefile
61e6a066acSEd Maste===================================================================
62e6a066acSEd MasteRCS file: /cvsroot/src/external/ibm-public/postfix/libexec/smtpd/Makefile,v
63e6a066acSEd Masteretrieving revision 1.6
64e6a066acSEd Mastediff -u -r1.6 Makefile
65e6a066acSEd Maste--- libexec/smtpd/Makefile	21 May 2017 15:28:40 -0000	1.6
66e6a066acSEd Maste+++ libexec/smtpd/Makefile	1 Feb 2018 03:29:09 -0000
67e6a066acSEd Maste@@ -13,11 +13,14 @@
68e6a066acSEd Maste SRCS=	smtpd.c smtpd_token.c smtpd_check.c smtpd_chat.c smtpd_state.c \
69e6a066acSEd Maste 	smtpd_peer.c smtpd_sasl_proto.c smtpd_sasl_glue.c smtpd_proxy.c \
70e6a066acSEd Maste 	smtpd_xforward.c smtpd_dsn_fix.c smtpd_milter.c smtpd_resolve.c \
71e6a066acSEd Maste-	smtpd_expand.c smtpd_haproxy.c
72e6a066acSEd Maste+	smtpd_expand.c smtpd_haproxy.c pfilter.c
73e6a066acSEd Maste
74e6a066acSEd Maste DPADD+= ${LIBPMASTER} ${LIBPMILTER} ${LIBPGLOBAL} ${LIBPDNS} ${LIBPXSASL}
75e6a066acSEd Maste LDADD+= ${LIBPMASTER} ${LIBPMILTER} ${LIBPGLOBAL} ${LIBPDNS} ${LIBPXSASL}
76e6a066acSEd Maste
77e6a066acSEd Maste+DPADD+=	${LIBBLOCKLIST}
78e6a066acSEd Maste+LDADD+=	-lblocklist
79e6a066acSEd Maste+
80e6a066acSEd Maste DPADD+=	${LIBPTLS} ${LIBSSL} ${LIBCRYPTO}
81e6a066acSEd Maste LDADD+=	${LIBPTLS} -lssl -lcrypto
82e6a066acSEd Maste
8370f30afdSJose Luis DuranIndex: dist/src/smtpd/smtpd.c
8470f30afdSJose Luis Duran===================================================================
8570f30afdSJose Luis DuranRCS file: /cvsroot/src/external/ibm-public/postfix/dist/src/smtpd/smtpd.c,v
8670f30afdSJose Luis Duranretrieving revision 1.17
8770f30afdSJose Luis Durandiff -u -u -r1.17 smtpd.c
8870f30afdSJose Luis Duran--- dist/src/smtpd/smtpd.c	18 Mar 2020 19:05:20 -0000	1.17
8970f30afdSJose Luis Duran+++ dist/src/smtpd/smtpd.c	25 Sep 2020 12:51:52 -0000
9070f30afdSJose Luis Duran@@ -5795,6 +5795,8 @@
9170f30afdSJose Luis Duran 		   || strcmp(state->reason, REASON_LOST_CONNECTION)) {
9270f30afdSJose Luis Duran 	    msg_info("%s after %s from %s",
9370f30afdSJose Luis Duran 		     state->reason, state->where, state->namaddr);
9470f30afdSJose Luis Duran+	    if (strcmp(state->where, SMTPD_CMD_AUTH) == 0)
9570f30afdSJose Luis Duran+		pfilter_notify(1, vstream_fileno(state->client));
9670f30afdSJose Luis Duran 	}
9770f30afdSJose Luis Duran     }
9870f30afdSJose Luis Duran
99