Skip to content
Permalink
Browse files

Add support for NetBSD's blacklistd(8).

  • Loading branch information...
schmonz committed Jan 1, 2019
1 parent 5f803a8 commit bb45507190e8acf733210ed31957ffc12ae9b077
Showing with 56 additions and 8 deletions.
  1. +26 −6 Makefile
  2. +3 −0 TARGETS
  3. +17 −0 acceptutils_pfilter.c
  4. +1 −0 acceptutils_pfilter.h
  5. +3 −2 authup.c
  6. +6 −0 tryblist.c
@@ -16,6 +16,10 @@ acceptutils_base64.o: \
compile99 acceptutils_base64.c acceptutils_base64.h
./compile99 acceptutils_base64.c

acceptutils_pfilter.o: \
compile99 acceptutils_pfilter.c acceptutils_pfilter.h hasblacklist.h
./compile99 acceptutils_pfilter.c

acceptutils_stralloc.o: \
compile99 acceptutils_stralloc.c acceptutils_stralloc.h
./compile99 acceptutils_stralloc.c
@@ -47,16 +51,18 @@ acceptutils-tests
@prove -v -e '' ./test_fixsmtpio | grep -v '^ok'

authup: \
load authup.o auto_qmail.o acceptutils_base64.o acceptutils_unistd.o acceptutils_ucspitls.o \
acceptutils_stralloc.o commands.o control.o timeoutread.o timeoutwrite.o now.o \
load authup.o auto_qmail.o acceptutils_base64.o acceptutils_pfilter.o \
acceptutils_stralloc.o acceptutils_unistd.o acceptutils_ucspitls.o \
commands.o control.o timeoutread.o timeoutwrite.o now.o \
case.a env.a fd.a getln.a open.a sig.a wait.a stralloc.a alloc.a \
substdio.a error.a str.a fs.a \
socket.lib
./load authup auto_qmail.o acceptutils_base64.o acceptutils_unistd.o acceptutils_ucspitls.o \
acceptutils_stralloc.o commands.o control.o timeoutread.o timeoutwrite.o now.o \
socket.lib blacklist.lib
./load authup auto_qmail.o acceptutils_base64.o acceptutils_pfilter.o \
acceptutils_stralloc.o acceptutils_unistd.o acceptutils_ucspitls.o \
commands.o control.o timeoutread.o timeoutwrite.o now.o \
case.a env.a fd.a getln.a open.a sig.a wait.a stralloc.a alloc.a \
substdio.a error.a str.a fs.a \
`cat socket.lib`
`cat socket.lib` `cat blacklist.lib`

authup.o: \
compile99 authup.c commands.h fd.h sig.h stralloc.h gen_alloc.h \
@@ -66,6 +72,13 @@ env.h control.h error.h scan.h auto_qmail.h acceptutils_unistd.h \
acceptutils_stralloc.h
./compile99 authup.c

blacklist.lib: \
tryblist.c compile load
( ( ./compile tryblist.c && ./load tryblist -lblacklist ) >/dev/null \
2>&1 \
&& echo -lblacklist || exit 0 ) > blacklist.lib
rm -f tryblist.o tryblist

check.h: \
conf-check check_stdint.h
cat `head -1 conf-check`/include/check.h \
@@ -880,6 +893,13 @@ gfrom.o: \
compile gfrom.c str.h gfrom.h
./compile gfrom.c

hasblacklist.h: \
tryblist.c compile load
( ( ./compile tryblist.c && ./load tryblist -lblacklist ) >/dev/null \
2>&1 \
&& echo \#define HASBLACKLIST 1 || exit 0 ) > hasblacklist.h
rm -f tryblist.o tryblist

hasflock.h: \
tryflock.c compile load
( ( ./compile tryflock.c && ./load tryflock ) >/dev/null \
@@ -388,6 +388,7 @@ check
make-compile99
compile99
acceptutils_base64.o
acceptutils_pfilter.o
acceptutils_stralloc.o
acceptutils_ucspitls.o
acceptutils_unistd.o
@@ -413,6 +414,8 @@ check.h
check_stdint.h
libcheck.a
rt.lib
hasblacklist.h
blacklist.lib
test_acceptutils_stralloc.o
test_fixsmtpio_control.o
test_fixsmtpio_eventq.o
@@ -0,0 +1,17 @@
#include "hasblacklist.h"

#if HASBLACKLIST

#include <blacklist.h>

void pfilter_notify(int what,const char *msg) {
blacklist(what, 0, msg);
}

#else

void pfilter_notify(int what,const char *msg) {
;
}

#endif
@@ -0,0 +1 @@
void pfilter_notify(int,const char *);
@@ -21,6 +21,7 @@
#include "open.h"

#include "acceptutils_base64.h"
#include "acceptutils_pfilter.h"
#include "acceptutils_stralloc.h"
#include "acceptutils_ucspitls.h"
#include "acceptutils_unistd.h"
@@ -176,13 +177,13 @@ void exit_according_to_child_exit(int exitcode) {
case EXITCODE_CHECKPASSWORD_UNACCEPTABLE:
case EXITCODE_CHECKPASSWORD_MISUSED:
case EXITCODE_CHECKPASSWORD_TEMPFAIL:
authup_die("badauth");
pfilter_notify(1, PROGNAME); authup_die("badauth");
case EXITCODE_FIXSMTPIO_TIMEOUT:
authup_die("alarm");
case EXITCODE_FIXSMTPIO_PARSEFAIL:
authup_die("control");
default:
_exit(0);
pfilter_notify(0, PROGNAME); _exit(0);
}
}

@@ -0,0 +1,6 @@
#include <blacklist.h>

void main()
{
struct blacklist *blstate = blacklist_open();
}

0 comments on commit bb45507

Please sign in to comment.
You can’t perform that action at this time.