Module Name: othersrc
Committed By: lukem
Date: Tue Jan 29 12:51:38 UTC 2019
Modified Files:
othersrc/libexec/tnftpd: Makefile.am configure.ac
othersrc/libexec/tnftpd/libnetbsd: Makefile.am
othersrc/libexec/tnftpd/ls: Makefile.am
othersrc/libexec/tnftpd/src: Makefile.am pfilter.c
Log Message:
implement --with-blacklist
Add --with-blacklist to enable NetBSD's blacklistd(8) support.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/Makefile.am
cvs rdiff -u -r1.39 -r1.40 othersrc/libexec/tnftpd/configure.ac
cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/Makefile.am
cvs rdiff -u -r1.4 -r1.5 othersrc/libexec/tnftpd/ls/Makefile.am
cvs rdiff -u -r1.4 -r1.5 othersrc/libexec/tnftpd/src/Makefile.am
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/libexec/tnftpd/src/pfilter.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/libexec/tnftpd/Makefile.am
diff -u othersrc/libexec/tnftpd/Makefile.am:1.3 othersrc/libexec/tnftpd/Makefile.am:1.4
--- othersrc/libexec/tnftpd/Makefile.am:1.3 Thu Mar 21 02:56:56 2013
+++ othersrc/libexec/tnftpd/Makefile.am Tue Jan 29 12:51:38 2019
@@ -1,9 +1,11 @@
-## $NetBSD: Makefile.am,v 1.3 2013/03/21 02:56:56 lukem Exp $
+## $NetBSD: Makefile.am,v 1.4 2019/01/29 12:51:38 lukem Exp $
ACLOCAL_AMFLAGS = -I buildaux
SUBDIRS = examples libnetbsd ls src
-EXTRA_DIST = \
- todo \
+noinst_HEADERS = \
tnftpd.h
+
+EXTRA_DIST = \
+ todo
Index: othersrc/libexec/tnftpd/configure.ac
diff -u othersrc/libexec/tnftpd/configure.ac:1.39 othersrc/libexec/tnftpd/configure.ac:1.40
--- othersrc/libexec/tnftpd/configure.ac:1.39 Tue Jan 29 12:28:44 2019
+++ othersrc/libexec/tnftpd/configure.ac Tue Jan 29 12:51:38 2019
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.39 2019/01/29 12:28:44 lukem Exp $
+# $NetBSD: configure.ac,v 1.40 2019/01/29 12:51:38 lukem Exp $
#
# Process this file with autoconf to produce a configure script.
@@ -9,7 +9,7 @@ AC_COPYRIGHT([
Copyright (c) 2001-2019 The NetBSD Foundation, Inc.
All rights reserved.
])
-AC_REVISION([$Revision: 1.39 $])
+AC_REVISION([$Revision: 1.40 $])
AS_SHELL_SANITIZE()
@@ -28,18 +28,28 @@ LT_INIT()
#
# Arguments for which features are included.
#
+
AC_ARG_ENABLE([ipv6],
[AS_HELP_STRING([--enable-ipv6],
[enable IPv6 support (if your OS supports it)
[default=enabled]])],
[opt_ipv6=$enableval],
[opt_ipv6=yes])
+
AC_ARG_ENABLE([builtinls],
[AS_HELP_STRING([--enable-builtinls],
[enable built-in /bin/ls
[default=enabled]])],
[opt_builtinls=$enableval],
[opt_builtinls=yes])
+
+AC_ARG_WITH([blacklist],
+ [AS_HELP_STRING([--with-blacklist],
+ [enable support for NetBSD blacklist daemon
+ [default=auto]])],
+ [],
+ [with_blacklist=auto])
+
AC_ARG_WITH([pam],
[AS_HELP_STRING([--with-pam],
[enable support for Pluggable Authentication
@@ -47,6 +57,7 @@ AC_ARG_WITH([pam],
[default=auto]])],
[],
[with_pam=auto])
+
AC_ARG_WITH([sia],
[AS_HELP_STRING([--with-sia],
[enable support for Tru64 Security Integration
@@ -54,6 +65,7 @@ AC_ARG_WITH([sia],
[default=auto]])],
[],
[with_sia=auto])
+
AC_ARG_WITH([skey],
[AS_HELP_STRING([--with-skey],
[enable support for S/Key authentication
@@ -77,6 +89,8 @@ AH_TEMPLATE([HAVE_PRINTF_LONG_LONG],
*printf() supports %lld or %qd to print them.])
AH_TEMPLATE([NO_INTERNAL_LS],
[Define if not using in-built /bin/ls code.])
+AH_TEMPLATE([USE_BLACKLIST],
+ [Define if using blacklist.])
AH_TEMPLATE([USE_INET6],
[Define if using IPv6 support.])
AH_TEMPLATE([USE_PAM],
@@ -368,6 +382,22 @@ AS_IF([test "$ac_cv_have_decl_AI_NUMERIC
AC_MSG_RESULT([no - using local version])],
[AC_MSG_RESULT([using local version])])])
+# Check for blacklist.
+#
+AS_IF([test "$with_blacklist" != no],
+ [AC_MSG_NOTICE([--with-blacklist=$with_blacklist; checking for required blacklist features])
+ AC_CHECK_LIB([blacklist],
+ [blacklist_open],
+ [LIBS="-lblacklist $LIBS"
+ AC_DEFINE([USE_BLACKLIST], [1])
+ AC_MSG_NOTICE([enabling blacklist support])
+ with_blacklist=yes],
+ [AS_IF([test "$with_blacklist" != auto],
+ [AC_MSG_FAILURE(
+ [--with-blacklist was given, but blacklist_open() was not found])])
+ AC_MSG_NOTICE([disabling --with-blacklist])
+ with_blacklist=no])])
+
# Check for PAM.
#
AS_IF([test "$with_pam" != no],
@@ -409,7 +439,7 @@ AS_IF([test "$with_sia" != no],
AS_IF([test "$with_skey" != no],
[AS_IF([test "$with_pam" != no],
[AC_MSG_ERROR([--with-skey is not compatible with --with-pam])])
- AC_MSG_NOTICE([--with-skey=$with_skey; checking for required features])
+ AC_MSG_NOTICE([--with-skey=$with_skey; checking for required S/Key features])
AC_CHECK_LIB([skey],
[skey_haskey],
[LIBS="-lskey $LIBS"
@@ -457,6 +487,7 @@ AC_MSG_NOTICE([Package: $P
AC_MSG_NOTICE([Prefix: $prefix])
AC_MSG_NOTICE([IPv6 support: $opt_ipv6])
AC_MSG_NOTICE([Built-in /bin/ls: $opt_builtinls])
+AC_MSG_NOTICE([blacklist support: $with_blacklist])
AC_MSG_NOTICE([PAM authentication: $with_pam])
AC_MSG_NOTICE([SIA authentication: $with_sia])
AC_MSG_NOTICE([S/Key authentication: $with_skey])
Index: othersrc/libexec/tnftpd/libnetbsd/Makefile.am
diff -u othersrc/libexec/tnftpd/libnetbsd/Makefile.am:1.3 othersrc/libexec/tnftpd/libnetbsd/Makefile.am:1.4
--- othersrc/libexec/tnftpd/libnetbsd/Makefile.am:1.3 Thu Mar 21 03:24:04 2013
+++ othersrc/libexec/tnftpd/libnetbsd/Makefile.am Tue Jan 29 12:51:38 2019
@@ -1,4 +1,4 @@
-## $NetBSD: Makefile.am,v 1.3 2013/03/21 03:24:04 lukem Exp $
+## $NetBSD: Makefile.am,v 1.4 2019/01/29 12:51:38 lukem Exp $
noinst_LTLIBRARIES = libnetbsd.la
@@ -12,7 +12,7 @@ AM_CPPFLAGS = \
libnetbsd_la_LIBADD = $(LTLIBOBJS)
-EXTRA_DIST = \
+noinst_HEADERS = \
arpa_ftp.h \
ftpfnmatch.h \
ftpfts.h \
Index: othersrc/libexec/tnftpd/ls/Makefile.am
diff -u othersrc/libexec/tnftpd/ls/Makefile.am:1.4 othersrc/libexec/tnftpd/ls/Makefile.am:1.5
--- othersrc/libexec/tnftpd/ls/Makefile.am:1.4 Thu Mar 21 03:24:04 2013
+++ othersrc/libexec/tnftpd/ls/Makefile.am Tue Jan 29 12:51:38 2019
@@ -1,4 +1,4 @@
-## $NetBSD: Makefile.am,v 1.4 2013/03/21 03:24:04 lukem Exp $
+## $NetBSD: Makefile.am,v 1.5 2019/01/29 12:51:38 lukem Exp $
noinst_LTLIBRARIES = libls.la
@@ -22,6 +22,6 @@ AM_CPPFLAGS = \
libls_la_LIBADD = \
../libnetbsd/libnetbsd.la
-EXTRA_DIST = \
+noinst_HEADERS = \
extern.h \
ls.h
Index: othersrc/libexec/tnftpd/src/Makefile.am
diff -u othersrc/libexec/tnftpd/src/Makefile.am:1.4 othersrc/libexec/tnftpd/src/Makefile.am:1.5
--- othersrc/libexec/tnftpd/src/Makefile.am:1.4 Thu Mar 21 03:24:04 2013
+++ othersrc/libexec/tnftpd/src/Makefile.am Tue Jan 29 12:51:38 2019
@@ -1,4 +1,4 @@
-## $NetBSD: Makefile.am,v 1.4 2013/03/21 03:24:04 lukem Exp $
+## $NetBSD: Makefile.am,v 1.5 2019/01/29 12:51:38 lukem Exp $
libexec_PROGRAMS = tnftpd
@@ -7,8 +7,15 @@ tnftpd_SOURCES = \
conf.c \
ftpd.c \
ftpcmd.y \
+ pfilter.c \
popen.c
+noinst_HEADERS = \
+ extern.h \
+ pathnames.h \
+ pfilter.h \
+ version.h
+
AM_CPPFLAGS = \
-DHAVE_TNFTPD_H=1 \
-D_DEFAULT_CONFDIR=\"${sysconfdir}\" \
@@ -42,11 +49,8 @@ seddotin = \
${seddotin} $< > $@
EXTRA_DIST = \
- extern.h \
ftpd.conf.manin \
ftpusers.manin \
logutmp.c \
logwtmp.c \
- pathnames.h \
- tnftpd.manin \
- version.h
+ tnftpd.manin
Index: othersrc/libexec/tnftpd/src/pfilter.c
diff -u othersrc/libexec/tnftpd/src/pfilter.c:1.1.1.1 othersrc/libexec/tnftpd/src/pfilter.c:1.2
--- othersrc/libexec/tnftpd/src/pfilter.c:1.1.1.1 Tue Jan 29 11:52:39 2019
+++ othersrc/libexec/tnftpd/src/pfilter.c Tue Jan 29 12:51:38 2019
@@ -1,24 +1,39 @@
+/* $NetBSD: pfilter.c,v 1.2 2019/01/29 12:51:38 lukem Exp $ */
+
+#if defined(HAVE_TNFTPD_H)
+#include "tnftpd.h"
+#endif
+
#include <stdio.h>
+
+#if USE_BLACKLIST
#include <blacklist.h>
+#endif
#include "pfilter.h"
+#if USE_BLACKLIST
static struct blacklist *blstate;
+#endif
void
pfilter_open(void)
{
+#if USE_BLACKLIST
if (blstate == NULL)
blstate = blacklist_open();
+#endif
}
void
pfilter_notify(int what, const char *msg)
{
+#if USE_BLACKLIST
pfilter_open();
if (blstate == NULL)
return;
blacklist_r(blstate, what, 0, msg);
+#endif
}