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