summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-02-04 16:47:35 +0000
committerngie <ngie@FreeBSD.org>2017-02-04 16:47:35 +0000
commit7aa9877e2de269a30c54ddc21ffdbb6f8141f9fa (patch)
tree6ba667cb41d9934e30bb9817e0f88e118cabc292 /libexec
parent91a09280b4ff6cc098c1095dad157e4ed0841a01 (diff)
downloadFreeBSD-src-7aa9877e2de269a30c54ddc21ffdbb6f8141f9fa.zip
FreeBSD-src-7aa9877e2de269a30c54ddc21ffdbb6f8141f9fa.tar.gz
MFC r311473:
Conditionalize all code that uses tcpd.h behind `LIBWRAP` guard This will allow the code to stand by itself without libwrap
Diffstat (limited to 'libexec')
-rw-r--r--libexec/tftpd/Makefile9
-rw-r--r--libexec/tftpd/tftpd.c7
2 files changed, 13 insertions, 3 deletions
diff --git a/libexec/tftpd/Makefile b/libexec/tftpd/Makefile
index f005001..abee70c 100644
--- a/libexec/tftpd/Makefile
+++ b/libexec/tftpd/Makefile
@@ -1,13 +1,18 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
# $FreeBSD$
+.include <bsd.own.mk>
+
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 <bsd.prog.mk>
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 571fa59..26d8105 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
-#include <tcpd.h>
#include <unistd.h>
#include "tftp-file.h"
@@ -75,6 +74,10 @@ __FBSDID("$FreeBSD$");
#include "tftp-transfer.h"
#include "tftp-options.h"
+#ifdef LIBWRAP
+#include <tcpd.h>
+#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
OpenPOWER on IntegriCloud