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