From 4d2f459e33ef058aed5c5bc1cf986b6fde035dec Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 4 Feb 2017 16:47:35 +0000 Subject: [PATCH] MFC r311473: Conditionalize all code that uses tcpd.h behind `LIBWRAP` guard This will allow the code to stand by itself without libwrap git-svn-id: svn://svn.freebsd.org/base/stable/10@313226 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- libexec/tftpd/Makefile | 9 +++++++-- libexec/tftpd/tftpd.c | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libexec/tftpd/Makefile b/libexec/tftpd/Makefile index f005001bb..abee70c70 100644 --- a/libexec/tftpd/Makefile +++ b/libexec/tftpd/Makefile @@ -1,13 +1,18 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ +.include + PROG= tftpd MAN= tftpd.8 SRCS= tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c SRCS+= tftpd.c WFORMAT=0 -DPADD= ${LIBWRAP} -LDADD= -lwrap +.if ${MK_TCP_WRAPPERS} != "no" +CFLAGS+= -DLIBWRAP +DPADD+= ${LIBWRAP} +LDADD+= -lwrap +.endif .include diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index 571fa5970..26d81051a 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "tftp-file.h" @@ -75,6 +74,10 @@ __FBSDID("$FreeBSD$"); #include "tftp-transfer.h" #include "tftp-options.h" +#ifdef LIBWRAP +#include +#endif + static void tftp_wrq(int peer, char *, ssize_t); static void tftp_rrq(int peer, char *, ssize_t); @@ -281,6 +284,7 @@ main(int argc, char *argv[]) } } +#ifdef LIBWRAP /* * See if the client is allowed to talk to me. * (This needs to be done before the chroot()) @@ -329,6 +333,7 @@ main(int argc, char *argv[]) "Full access allowed" "in /etc/hosts.allow"); } +#endif /* * Since we exit here, we should do that only after the above -- 2.42.0