|
Link Here
|
|
|
1 |
--- src/smtpd/Makefile.in.orig 2017-02-05 23:36:32 UTC |
| 2 |
+++ src/smtpd/Makefile.in |
| 3 |
@@ -2,14 +2,14 @@ SHELL = /bin/sh |
| 4 |
SRCS = smtpd.c smtpd_token.c smtpd_check.c smtpd_chat.c smtpd_state.c \ |
| 5 |
smtpd_peer.c smtpd_sasl_proto.c smtpd_sasl_glue.c smtpd_proxy.c \ |
| 6 |
smtpd_xforward.c smtpd_dsn_fix.c smtpd_milter.c smtpd_resolve.c \ |
| 7 |
- smtpd_expand.c smtpd_haproxy.c |
| 8 |
+ smtpd_expand.c smtpd_haproxy.c pfilter.c |
| 9 |
OBJS = smtpd.o smtpd_token.o smtpd_check.o smtpd_chat.o smtpd_state.o \ |
| 10 |
smtpd_peer.o smtpd_sasl_proto.o smtpd_sasl_glue.o smtpd_proxy.o \ |
| 11 |
smtpd_xforward.o smtpd_dsn_fix.o smtpd_milter.o smtpd_resolve.o \ |
| 12 |
- smtpd_expand.o smtpd_haproxy.o |
| 13 |
+ smtpd_expand.o smtpd_haproxy.o pfilter.o |
| 14 |
HDRS = smtpd_token.h smtpd_check.h smtpd_chat.h smtpd_sasl_proto.h \ |
| 15 |
smtpd_sasl_glue.h smtpd_proxy.h smtpd_dsn_fix.h smtpd_milter.h \ |
| 16 |
- smtpd_resolve.h smtpd_expand.h |
| 17 |
+ smtpd_resolve.h smtpd_expand.h pfilter.h |
| 18 |
TESTSRC = smtpd_token_test.c |
| 19 |
DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE) |
| 20 |
CFLAGS = $(DEBUG) $(OPT) $(DEFS) |
| 21 |
--- src/smtpd/pfilter.c.orig 2018-02-14 04:29:19 UTC |
| 22 |
+++ src/smtpd/pfilter.c |
| 23 |
@@ -0,0 +1,19 @@ |
| 24 |
+#include "pfilter.h" |
| 25 |
+#include <stdio.h> /* for NULL */ |
| 26 |
+#include <blacklist.h> |
| 27 |
+ |
| 28 |
+static struct blacklist *blstate; |
| 29 |
+ |
| 30 |
+void |
| 31 |
+pfilter_notify(int a, int fd) |
| 32 |
+{ |
| 33 |
+ if (blstate == NULL) |
| 34 |
+ blstate = blacklist_open(); |
| 35 |
+ if (blstate == NULL) |
| 36 |
+ return; |
| 37 |
+ (void)blacklist_r(blstate, a, fd, "smtpd"); |
| 38 |
+ if (a == 0) { |
| 39 |
+ blacklist_close(blstate); |
| 40 |
+ blstate = NULL; |
| 41 |
+ } |
| 42 |
+} |
| 43 |
--- src/smtpd/pfilter.h.orig 2018-02-14 04:29:19 UTC |
| 44 |
+++ src/smtpd/pfilter.h |
| 45 |
@@ -0,0 +1 @@ |
| 46 |
+void pfilter_notify(int, int); |
| 47 |
--- src/smtpd/smtpd_sasl_glue.c.orig 2017-02-19 01:58:21 UTC |
| 48 |
+++ src/smtpd/smtpd_sasl_glue.c |
| 49 |
@@ -147,6 +147,7 @@ |
| 50 |
#include "smtpd.h" |
| 51 |
#include "smtpd_sasl_glue.h" |
| 52 |
#include "smtpd_chat.h" |
| 53 |
+#include "pfilter.h" /* for blacklistd(8) */ |
| 54 |
|
| 55 |
#ifdef USE_SASL_AUTH |
| 56 |
|
| 57 |
@@ -332,6 +333,10 @@ int smtpd_sasl_authenticate(SMTPD_ST |
| 58 |
else |
| 59 |
smtpd_chat_reply(state, "535 5.7.8 Error: authentication failed: %s", |
| 60 |
STR(state->sasl_reply)); |
| 61 |
+ |
| 62 |
+ |
| 63 |
+ /* notify blacklistd of SASL authentication failure */ |
| 64 |
+ pfilter_notify(1, vstream_fileno(state->client)); |
| 65 |
return (-1); |
| 66 |
} |
| 67 |
/* RFC 4954 Section 6. */ |