Author: ngie
Date: Fri Jan  6 04:27:07 2017
New Revision: 311473
URL: https://svnweb.freebsd.org/changeset/base/311473

Log:
  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

Modified:
  head/libexec/tftpd/Makefile
  head/libexec/tftpd/tftpd.c

Modified: head/libexec/tftpd/Makefile
==============================================================================
--- head/libexec/tftpd/Makefile Fri Jan  6 04:22:25 2017        (r311472)
+++ head/libexec/tftpd/Makefile Fri Jan  6 04:27:07 2017        (r311473)
@@ -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>

Modified: head/libexec/tftpd/tftpd.c
==============================================================================
--- head/libexec/tftpd/tftpd.c  Fri Jan  6 04:22:25 2017        (r311472)
+++ head/libexec/tftpd/tftpd.c  Fri Jan  6 04:27:07 2017        (r311473)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to