aboutsummaryrefslogtreecommitdiff
path: root/contrib/blocklist/port
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/blocklist/port')
-rw-r--r--contrib/blocklist/port/Makefile.am42
-rw-r--r--contrib/blocklist/port/_strtoi.h2
-rw-r--r--contrib/blocklist/port/configure.ac12
-rw-r--r--contrib/blocklist/port/fgetln.c2
-rw-r--r--contrib/blocklist/port/fparseln.c6
-rw-r--r--contrib/blocklist/port/pidfile.c6
-rw-r--r--contrib/blocklist/port/popenve.c6
-rw-r--r--contrib/blocklist/port/port.h32
-rw-r--r--contrib/blocklist/port/sockaddr_snprintf.c6
-rw-r--r--contrib/blocklist/port/strlcat.c7
-rw-r--r--contrib/blocklist/port/strlcpy.c7
-rw-r--r--contrib/blocklist/port/strtoi.c6
-rw-r--r--contrib/blocklist/port/vsyslog_r.c13
13 files changed, 107 insertions, 40 deletions
diff --git a/contrib/blocklist/port/Makefile.am b/contrib/blocklist/port/Makefile.am
index 43bf6c94b420..0e6085f9580f 100644
--- a/contrib/blocklist/port/Makefile.am
+++ b/contrib/blocklist/port/Makefile.am
@@ -1,25 +1,39 @@
#
ACLOCAL_AMFLAGS = -I m4
-lib_LTLIBRARIES = libblacklist.la
-include_HEADERS = ../include/blacklist.h
+lib_LTLIBRARIES = libblocklist.la
+include_HEADERS = $(srcdir)/../include/blocklist.h
-bin_PROGRAMS = blacklistd blacklistctl srvtest cltest
+exampledir = $(datarootdir)/examples
+example_DATA = $(srcdir)/../etc/blocklistd.conf $(srcdir)/../etc/npf.conf $(srcdir)/../etc/ipf.conf
-VPATH = ../bin:../lib:../test:../include
+sbin_PROGRAMS = blocklistd blocklistctl
+noinst_PROGRAMS = srvtest cltest
+libexec_SCRIPTS = $(srcdir)/../libexec/blocklistd-helper
-AM_CPPFLAGS = -I../include -DDOT="."
+man5_MANS = $(srcdir)/../bin/blocklistd.conf.5
+man8_MANS = $(srcdir)/../bin/blocklistd.8 $(srcdir)/../bin/blocklistctl.8
+
+VPATH = $(srcdir)/../port:$(srcdir)/../bin:$(srcdir)/../lib:$(srcdir)/../test:$(srcdir)/../include
+
+AM_CPPFLAGS = -I$(srcdir)/../include -DDOT="."
+AM_CPPFLAGS += -D_PATH_BLCONF=\"$(sysconfdir)/blocklistd.conf\"
+AM_CPPFLAGS += -D_PATH_BLCONTROL=\"$(libexecdir)/blocklistd-helper\"
+AM_CPPFLAGS += -D_PATH_BLSOCK=\"$(runstatedir)/blocklistd.sock\"
+AM_CPPFLAGS += -D_PATH_BLSTATE=\"$(localstatedir)/db/blocklistd.db\"
+AM_CPPFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L -D__EXTENSIONS__
+AM_CPPFLAGS += -D__BSD_VISIBLE=1
AM_CFLAGS = @WARNINGS@
-libblacklist_la_SOURCES = bl.c blacklist.c
-libblacklist_la_LDFLAGS = -no-undefined -version-info 0:0:0
-libblacklist_la_LIBADD = $(LTLIBOBJS)
+libblocklist_la_SOURCES = bl.c blocklist.c
+libblocklist_la_LDFLAGS = -no-undefined -version-info 0:0:0
+libblocklist_la_LIBADD = $(LTLIBOBJS)
SRCS = internal.c support.c run.c conf.c state.c
-blacklistd_SOURCES = blacklistd.c ${SRCS}
-blacklistd_LDADD = libblacklist.la
-blacklistctl_SOURCES = blacklistctl.c ${SRCS}
-blacklistctl_LDADD = libblacklist.la
+blocklistd_SOURCES = blocklistd.c ${SRCS}
+blocklistd_LDADD = libblocklist.la
+blocklistctl_SOURCES = blocklistctl.c ${SRCS}
+blocklistctl_LDADD = libblocklist.la
srvtest_SOURCES = srvtest.c ${SRCS}
-srvtest_LDADD = libblacklist.la
+srvtest_LDADD = libblocklist.la
cltest_SOURCES = cltest.c ${SRCS}
-cltest_LDADD = libblacklist.la
+cltest_LDADD = libblocklist.la
diff --git a/contrib/blocklist/port/_strtoi.h b/contrib/blocklist/port/_strtoi.h
index 4b2b4e80f0d8..f50eefd67ff1 100644
--- a/contrib/blocklist/port/_strtoi.h
+++ b/contrib/blocklist/port/_strtoi.h
@@ -1,4 +1,4 @@
-/* $NetBSD: _strtoi.h,v 1.1 2015/01/22 02:15:59 christos Exp $ */
+/* $NetBSD: _strtoi.h,v 1.1.1.1 2020/06/15 01:52:53 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
diff --git a/contrib/blocklist/port/configure.ac b/contrib/blocklist/port/configure.ac
index eef8065f060a..99ecf8732c93 100644
--- a/contrib/blocklist/port/configure.ac
+++ b/contrib/blocklist/port/configure.ac
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([blacklistd],[0.1],[christos@netbsd.com])
+AC_INIT([blocklistd],[0.1],[christos@netbsd.com])
AM_INIT_AUTOMAKE([subdir-objects foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -7,9 +7,10 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(WARNINGS)
+AC_SUBST(LINK_NTOA)
dnl Checks for programs.
-AC_PROG_CC_STDC
+AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AM_PROG_CC_C_O
AC_C_BIGENDIAN
@@ -18,18 +19,19 @@ AC_PROG_LN_S
LT_INIT([disable-static pic-only])
gl_VISIBILITY
dnl Checks for headers
-AC_HEADER_STDC
AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdint.h fcntl.h stdint.h inttypes.h unistd.h)
AC_CHECK_HEADERS(sys/un.h sys/socket.h limits.h)
AC_CHECK_HEADERS(arpa/inet.h getopt.h err.h)
AC_CHECK_HEADERS(sys/types.h util.h sys/time.h time.h)
-AC_CHECK_HEADERS(netatalk/at.h net/if_dl.h db.h db_185.h)
+AC_CHECK_HEADERS(netatalk/at.h db.h db_185.h)
+AC_CHECK_HEADERS(sys/cdefs.h)
AC_CHECK_LIB(rt, clock_gettime)
AC_CHECK_LIB(db, __db185_open)
AC_CHECK_LIB(util, pidfile)
AC_CHECK_LIB(util, sockaddr_snprintf)
+AC_SEARCH_LIBS(__xnet_connect, socket)
AH_BOTTOM([
#ifndef __NetBSD__
@@ -82,7 +84,7 @@ dnl Checks for functions
AC_CHECK_FUNCS(strerror)
dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(strtoi sockaddr_snprintf popenve clock_gettime strlcpy strlcat getprogname fparseln fgetln pidfile)
+AC_REPLACE_FUNCS(strtoi sockaddr_snprintf popenve clock_gettime strlcpy strlcat getprogname fparseln fgetln pidfile vsyslog_r)
dnl See if we are cross-compiling
AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
diff --git a/contrib/blocklist/port/fgetln.c b/contrib/blocklist/port/fgetln.c
index a41a383a6653..006e19f5279f 100644
--- a/contrib/blocklist/port/fgetln.c
+++ b/contrib/blocklist/port/fgetln.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fgetln.c,v 1.1 2015/01/22 03:48:07 christos Exp $ */
+/* $NetBSD: fgetln.c,v 1.1.1.1 2020/06/15 01:52:54 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
diff --git a/contrib/blocklist/port/fparseln.c b/contrib/blocklist/port/fparseln.c
index 5bfae54b9a9b..22850ea9e304 100644
--- a/contrib/blocklist/port/fparseln.c
+++ b/contrib/blocklist/port/fparseln.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fparseln.c,v 1.1 2015/01/22 03:48:07 christos Exp $ */
+/* $NetBSD: fparseln.c,v 1.2 2025/02/11 17:48:30 christos Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
@@ -27,9 +27,11 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
+#endif
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fparseln.c,v 1.1 2015/01/22 03:48:07 christos Exp $");
+__RCSID("$NetBSD: fparseln.c,v 1.2 2025/02/11 17:48:30 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
diff --git a/contrib/blocklist/port/pidfile.c b/contrib/blocklist/port/pidfile.c
index 4deb2349d20a..1dbbf510c4e3 100644
--- a/contrib/blocklist/port/pidfile.c
+++ b/contrib/blocklist/port/pidfile.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pidfile.c,v 1.2 2016/04/05 12:28:57 christos Exp $ */
+/* $NetBSD: pidfile.c,v 1.2 2025/02/11 17:48:30 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -32,9 +32,11 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
+#endif
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pidfile.c,v 1.2 2016/04/05 12:28:57 christos Exp $");
+__RCSID("$NetBSD: pidfile.c,v 1.2 2025/02/11 17:48:30 christos Exp $");
#endif
#include <sys/param.h>
diff --git a/contrib/blocklist/port/popenve.c b/contrib/blocklist/port/popenve.c
index 20f6b5b86b68..bdff8cdc1de4 100644
--- a/contrib/blocklist/port/popenve.c
+++ b/contrib/blocklist/port/popenve.c
@@ -1,4 +1,4 @@
-/* $NetBSD: popenve.c,v 1.2 2015/01/22 03:10:50 christos Exp $ */
+/* $NetBSD: popenve.c,v 1.2 2025/02/11 17:48:30 christos Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -36,12 +36,14 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
+#endif
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: popenve.c,v 1.2 2015/01/22 03:10:50 christos Exp $");
+__RCSID("$NetBSD: popenve.c,v 1.2 2025/02/11 17:48:30 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
diff --git a/contrib/blocklist/port/port.h b/contrib/blocklist/port/port.h
index f82fb34b40f5..d1a9ac6bd6e5 100644
--- a/contrib/blocklist/port/port.h
+++ b/contrib/blocklist/port/port.h
@@ -1,6 +1,7 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
+#include <sys/param.h>
#include <stdio.h>
#include <inttypes.h>
#include <time.h>
@@ -15,6 +16,22 @@
#define __dead __attribute__((__noreturn__))
#endif
+#ifndef __BEGIN_DECLS
+#define __BEGIN_DECLS
+#endif
+
+#ifndef __END_DECLS
+#define __END_DECLS
+#endif
+
+#ifndef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
#ifndef __RCSID
#define __RCSID(a)
#endif
@@ -27,6 +44,10 @@
#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
#endif
+#ifndef __STRING
+#define __STRING(x) #x
+#endif
+
#ifndef HAVE_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif
@@ -78,9 +99,10 @@ int clock_gettime(int, struct timespec *);
#define CLOCK_REALTIME 0
#endif
-#if !defined(__FreeBSD__)
-#define _PATH_BLCONF "conf"
-#define _PATH_BLCONTROL "control"
-#define _PATH_BLSOCK "blacklistd.sock"
-#define _PATH_BLSTATE "blacklistd.db"
+#ifndef HAVE_VSYSLOG_R
+#define SYSLOG_DATA_INIT { 0 }
+struct syslog_data {
+ int dummy;
+};
+void vsyslog_r(int, struct syslog_data *, const char *, va_list);
#endif
diff --git a/contrib/blocklist/port/sockaddr_snprintf.c b/contrib/blocklist/port/sockaddr_snprintf.c
index 558755b6294b..a37eded14a88 100644
--- a/contrib/blocklist/port/sockaddr_snprintf.c
+++ b/contrib/blocklist/port/sockaddr_snprintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sockaddr_snprintf.c,v 1.11 2016/06/01 22:57:51 christos Exp $ */
+/* $NetBSD: sockaddr_snprintf.c,v 1.2 2025/02/11 17:48:30 christos Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -32,9 +32,11 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
+#endif
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sockaddr_snprintf.c,v 1.11 2016/06/01 22:57:51 christos Exp $");
+__RCSID("$NetBSD: sockaddr_snprintf.c,v 1.2 2025/02/11 17:48:30 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
diff --git a/contrib/blocklist/port/strlcat.c b/contrib/blocklist/port/strlcat.c
index d3c69b5fab78..8cabd654e6b0 100644
--- a/contrib/blocklist/port/strlcat.c
+++ b/contrib/blocklist/port/strlcat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strlcat.c,v 1.2 2015/01/22 03:48:07 christos Exp $ */
+/* $NetBSD: strlcat.c,v 1.2 2025/02/11 17:48:30 christos Exp $ */
/* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */
/*
@@ -22,9 +22,12 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
+#endif
+
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strlcat.c,v 1.2 2015/01/22 03:48:07 christos Exp $");
+__RCSID("$NetBSD: strlcat.c,v 1.2 2025/02/11 17:48:30 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef _LIBC
diff --git a/contrib/blocklist/port/strlcpy.c b/contrib/blocklist/port/strlcpy.c
index 6646e1ce9696..3de72a640c59 100644
--- a/contrib/blocklist/port/strlcpy.c
+++ b/contrib/blocklist/port/strlcpy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strlcpy.c,v 1.2 2015/01/22 03:48:07 christos Exp $ */
+/* $NetBSD: strlcpy.c,v 1.2 2025/02/11 17:48:30 christos Exp $ */
/* $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $ */
/*
@@ -22,9 +22,12 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
+#endif
+
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strlcpy.c,v 1.2 2015/01/22 03:48:07 christos Exp $");
+__RCSID("$NetBSD: strlcpy.c,v 1.2 2025/02/11 17:48:30 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef _LIBC
diff --git a/contrib/blocklist/port/strtoi.c b/contrib/blocklist/port/strtoi.c
index 5514f1a00a32..b0bed7058cc3 100644
--- a/contrib/blocklist/port/strtoi.c
+++ b/contrib/blocklist/port/strtoi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strtoi.c,v 1.3 2015/01/22 03:10:50 christos Exp $ */
+/* $NetBSD: strtoi.c,v 1.2 2025/02/11 17:48:31 christos Exp $ */
/*-
* Copyright (c) 2005 The DragonFly Project. All rights reserved.
@@ -33,8 +33,10 @@
#include "config.h"
#endif
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
-__RCSID("$NetBSD: strtoi.c,v 1.3 2015/01/22 03:10:50 christos Exp $");
+#endif
+__RCSID("$NetBSD: strtoi.c,v 1.2 2025/02/11 17:48:31 christos Exp $");
#if defined(_KERNEL)
#include <sys/param.h>
diff --git a/contrib/blocklist/port/vsyslog_r.c b/contrib/blocklist/port/vsyslog_r.c
new file mode 100644
index 000000000000..848f31b04453
--- /dev/null
+++ b/contrib/blocklist/port/vsyslog_r.c
@@ -0,0 +1,13 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <syslog.h>
+#include <stdarg.h>
+
+void
+vsyslog_r(int priority, struct syslog_data *sd __unused, const char *fmt, va_list ap)
+{
+ vsyslog(priority, fmt, ap);
+}
+