Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Feb 2017 16:47:35 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r313226 - stable/10/libexec/tftpd
Message-ID:  <201702041647.v14GlZ8A075004@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Feb  4 16:47:35 2017
New Revision: 313226
URL: https://svnweb.freebsd.org/changeset/base/313226

Log:
  MFC r311473:
  
  Conditionalize all code that uses tcpd.h behind `LIBWRAP` guard
  
  This will allow the code to stand by itself without libwrap

Modified:
  stable/10/libexec/tftpd/Makefile
  stable/10/libexec/tftpd/tftpd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/tftpd/Makefile
==============================================================================
--- stable/10/libexec/tftpd/Makefile	Sat Feb  4 16:45:44 2017	(r313225)
+++ stable/10/libexec/tftpd/Makefile	Sat Feb  4 16:47:35 2017	(r313226)
@@ -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>

Modified: stable/10/libexec/tftpd/tftpd.c
==============================================================================
--- stable/10/libexec/tftpd/tftpd.c	Sat Feb  4 16:45:44 2017	(r313225)
+++ stable/10/libexec/tftpd/tftpd.c	Sat Feb  4 16:47:35 2017	(r313226)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702041647.v14GlZ8A075004>