xref: /netbsd-src/libexec/ftpd/pfilter.c (revision 564e323839beff5f5f2b3e5f42dfad288863a0d7)
1 /*	$NetBSD: pfilter.c,v 1.4 2020/07/04 05:18:37 lukem Exp $	*/
2 
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <blocklist.h>
6 
7 #include "pfilter.h"
8 
9 static struct blocklist *blstate;
10 
11 void
pfilter_open(void)12 pfilter_open(void)
13 {
14 	if (blstate == NULL)
15 		blstate = blocklist_open();
16 }
17 
18 void
pfilter_notify(int what,const char * msg)19 pfilter_notify(int what, const char *msg)
20 {
21 	pfilter_open();
22 
23 	if (blstate == NULL)
24 		return;
25 
26 	blocklist_r(blstate, what, STDIN_FILENO, msg);
27 }
28