NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/55725: postscreen(8): Add support for blocklistd(8)



>Number:         55725
>Category:       bin
>Synopsis:       postscreen(8): Add support for blocklistd(8)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 13 07:10:00 +0000 2020
>Originator:     Sunil Nimmagadda
>Release:        current
>Organization:
>Environment:
NetBSD x230.nimmagadda.net 9.99.73 NetBSD 9.99.73 (GENERIC) #0: Thu Oct  8 16:00:09 UTC 2020  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
postscreen(8) when enabled gets to decide which clients are legitimate and drops illegitimate traffic. This diff extends blocklistd(8) support to postscreen(8). It reuses pfilter.[ch] between smtpd(8) and postscreen(8) by moving it to the common util library.
>How-To-Repeat:

>Fix:
diff --git a/external/ibm-public/postfix/dist/src/postscreen/postscreen_misc.c b/external/ibm-public/postfix/dist/src/postscreen/postscreen_misc.c
--- a/external/ibm-public/postfix/dist/src/postscreen/postscreen_misc.c
+++ b/external/ibm-public/postfix/dist/src/postscreen/postscreen_misc.c
@@ -71,6 +71,8 @@
 
 #include <postscreen.h>
 
+#include "pfilter.h"
+
 /* psc_format_delta_time - pretty-formatted delta time */
 
 char   *psc_format_delta_time(VSTRING *buf, struct timeval tv,
@@ -139,6 +141,7 @@
 	if ((state->flags & PSC_STATE_FLAG_HANGUP) == 0)
 	    (void) PSC_SEND_REPLY(state, state->final_reply);
 	msg_info("DISCONNECT [%s]:%s", PSC_CLIENT_ADDR_PORT(state));
+	pfilter_notify(1, vstream_fileno(state->smtp_client_stream));
 	psc_free_session_state(state);
     }
 }
diff --git a/external/ibm-public/postfix/dist/src/smtpd/pfilter.c b/external/ibm-public/postfix/dist/src/util/pfilter.c
rename from external/ibm-public/postfix/dist/src/smtpd/pfilter.c
rename to external/ibm-public/postfix/dist/src/util/pfilter.c
diff --git a/external/ibm-public/postfix/dist/src/smtpd/pfilter.h b/external/ibm-public/postfix/dist/src/util/pfilter.h
rename from external/ibm-public/postfix/dist/src/smtpd/pfilter.h
rename to external/ibm-public/postfix/dist/src/util/pfilter.h
diff --git a/external/ibm-public/postfix/lib/util/Makefile b/external/ibm-public/postfix/lib/util/Makefile
--- a/external/ibm-public/postfix/lib/util/Makefile
+++ b/external/ibm-public/postfix/lib/util/Makefile
@@ -149,6 +149,7 @@
 pass_trigger.c \
 peekfd.c \
 percentm.c \
+pfilter.c \
 poll_fd.c \
 posix_signals.c \
 printable.c \
@@ -223,4 +224,7 @@
 COPTS.unix_recv_fd.c = -Wno-stack-protector
 COPTS.unix_send_fd.c = -Wno-stack-protector
 
+DPADD+=	${LIBBLOCKLIST}
+LDADD+=	-lblocklist
+
 .include <bsd.lib.mk>
diff --git a/external/ibm-public/postfix/libexec/postscreen/Makefile b/external/ibm-public/postfix/libexec/postscreen/Makefile
--- a/external/ibm-public/postfix/libexec/postscreen/Makefile
+++ b/external/ibm-public/postfix/libexec/postscreen/Makefile
@@ -21,4 +21,7 @@
 DPADD+= ${LIBPTLS} ${LIBSSL} ${LIBCRYPTO}
 LDADD+= ${LIBPTLS} -lssl -lcrypto
 
+DPADD+=	${LIBBLOCKLIST}
+LDADD+=	-lblocklist
+
 .include <bsd.prog.mk>
diff --git a/external/ibm-public/postfix/libexec/smtpd/Makefile b/external/ibm-public/postfix/libexec/smtpd/Makefile
--- a/external/ibm-public/postfix/libexec/smtpd/Makefile
+++ b/external/ibm-public/postfix/libexec/smtpd/Makefile
@@ -11,7 +11,6 @@
 .PATH:	${DIST}
 
 SRCS+= \
-pfilter.c \
 smtpd.c \
 smtpd_chat.c \
 smtpd_check.c \



Home | Main Index | Thread Index | Old Index