summaryrefslogtreecommitdiff
path: root/libexec/tftpd
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-01-06 04:27:07 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-01-06 04:27:07 +0000
commit4eb4663b0e9042ce0161d0ffffbbc85ffd799c08 (patch)
tree91bd32954fde61ee6efff0faa936c057a13fdcf2 /libexec/tftpd
parentc02129e1cc85ab5c0ba3846b2d0edacc244be2dd (diff)
downloadsrc-test-4eb4663b0e9042ce0161d0ffffbbc85ffd799c08.tar.gz
src-test-4eb4663b0e9042ce0161d0ffffbbc85ffd799c08.zip
Conditionalize all code that uses tcpd.h behind `LIBWRAP` guard
This will allow the code to stand by itself without libwrap MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=311473
Diffstat (limited to 'libexec/tftpd')
-rw-r--r--libexec/tftpd/Makefile5
-rw-r--r--libexec/tftpd/tftpd.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/libexec/tftpd/Makefile b/libexec/tftpd/Makefile
index 015458c093fec..6f74a29b79c30 100644
--- a/libexec/tftpd/Makefile
+++ b/libexec/tftpd/Makefile
@@ -1,12 +1,17 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
# $FreeBSD$
+.include <src.opts.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
+.if ${MK_TCP_WRAPPERS} != "no"
+CFLAGS+= -DLIBWRAP
LIBADD= wrap
+.endif
.include <bsd.prog.mk>
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 571fa5970db2c..26d81051ab5ac 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