7b32422
From c9074247899440fdc69d5bbe1271b98fb427d333 Mon Sep 17 00:00:00 2001
7b32422
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
7b32422
Date: Thu, 30 Nov 2017 15:04:33 +0100
7b32422
Subject: [PATCH] Allow disabling TCP wrappers
7b32422
MIME-Version: 1.0
7b32422
Content-Type: text/plain; charset=UTF-8
7b32422
Content-Transfer-Encoding: 8bit
7b32422
7b32422
This adds ./confifure --disable-tcpwrappers option to disable use of
7b32422
internal and external TCP wrappers library.
7b32422
7b32422
<https://bugzilla.redhat.com/show_bug.cgi?id=1518781>
7b32422
7b32422
Signed-off-by: Petr Písař <ppisar@redhat.com>
7b32422
---
7b32422
 configure.ac       | 44 ++++++++++++++++++++++++++++----------------
7b32422
 server/Makefile.in |  5 +----
7b32422
 2 files changed, 29 insertions(+), 20 deletions(-)
7b32422
7b32422
diff --git a/configure.ac b/configure.ac
7b32422
index 9e89acd..d2edb0e 100644
7b32422
--- a/configure.ac
7b32422
+++ b/configure.ac
7b32422
@@ -49,6 +49,15 @@ AC_CHECK_LIB(resolv, res_search)
7b32422
 AC_CHECK_LIB(socket, connect)
7b32422
 AC_CHECK_LIB(inet, connect)
7b32422
 
7b32422
+AC_ARG_ENABLE(tcpwrappers, AS_HELP_STRING([--disable-tcpwrappers],
7b32422
+              [Do not use TCP Wrappers]))
7b32422
+AC_MSG_CHECKING([whether to enable TCP wrappers])
7b32422
+if test "${enable_tcpwrappers}" = "no"; then
7b32422
+    AC_MSG_RESULT([disabled])
7b32422
+else
7b32422
+    AC_MSG_RESULT([enabled])
7b32422
+    AC_DEFINE(USE_TCP_WRAPPERS, 1, [TCP Wrappers])
7b32422
+
7b32422
 # check for the libwrap library: we (apparently) cannot just use the
7b32422
 # standard AC_CHECK_LIB() macro, because the test program may need to
7b32422
 # define a few variables.  Some OS versions of libwrap don't have this
7b32422
@@ -80,6 +89,7 @@ int main(void)
7b32422
 )
7b32422
 
7b32422
 fi
7b32422
+fi
7b32422
 
7b32422
 dnl Checks for header files.
7b32422
 AC_HEADER_STDC
7b32422
@@ -119,23 +129,25 @@ dnl Optional software.
7b32422
 
7b32422
 AC_ARG_WITH(local-libwrap, AS_HELP_STRING([--with-local-libwrap], 
7b32422
                            [Use local copy of tcpd_wrapper.]))
7b32422
-if test "${with_local_libwrap}" = yes; then
7b32422
-    build_libwrap=yes;
7b32422
-fi
7b32422
-
7b32422
-if test "${build_libwrap}" = "yes"; then
7b32422
-   AC_SUBST(TCPD_EXTRA_CFLAGS)
7b32422
-   LIBWRAP=libwrap
7b32422
-   AC_SUBST(LIBWRAP)
7b32422
-   wrap_dir=../tools/tcpd_wrapper
7b32422
-   WRAP_INCLUDE=-I'$(srcdir)'/$wrap_dir
7b32422
-   WRAP_LIBS="-L$wrap_dir -lwrap"
7b32422
-else
7b32422
-   WRAP_INCLUDE=
7b32422
-   WRAP_LIBS="-lwrap"
7b32422
+if test "${enable_tcpwrappers}" != "no"; then
7b32422
+    if test "${with_local_libwrap}" = yes; then
7b32422
+        build_libwrap=yes;
7b32422
+    fi
7b32422
+
7b32422
+    if test "${build_libwrap}" = "yes"; then
7b32422
+       AC_SUBST(TCPD_EXTRA_CFLAGS)
7b32422
+       LIBWRAP=libwrap
7b32422
+       AC_SUBST(LIBWRAP)
7b32422
+       wrap_dir=../tools/tcpd_wrapper
7b32422
+       WRAP_INCLUDE=-I'$(srcdir)'/$wrap_dir
7b32422
+       WRAP_LIBS="-L$wrap_dir -lwrap"
7b32422
+    else
7b32422
+       WRAP_INCLUDE=
7b32422
+       WRAP_LIBS="-lwrap"
7b32422
+    fi
7b32422
+    AC_SUBST(WRAP_INCLUDE)
7b32422
+    AC_SUBST(WRAP_LIBS)       
7b32422
 fi
7b32422
-AC_SUBST(WRAP_INCLUDE)
7b32422
-AC_SUBST(WRAP_LIBS)       
7b32422
 
7b32422
 
7b32422
 dnl Package options
7b32422
diff --git a/server/Makefile.in b/server/Makefile.in
7b32422
index 0da66ce..fcf4825 100644
7b32422
--- a/server/Makefile.in
7b32422
+++ b/server/Makefile.in
7b32422
@@ -30,10 +30,7 @@ REGEXP_LIBS   = -L../regexp -lregexp
7b32422
 LOCAL_INC     = -I. -I.. -I$(srcdir) $(COMMON_INC) $(WRAP_INC) $(MKDB_INC) $(REGEXP_INC)
7b32422
 LOCAL_LIBS    = $(WRAP_LIBS) $(MKDB_LIBS) $(COMMON_LIBS) $(REGEXP_LIBS)
7b32422
 
7b32422
-# use tcp_wrappers to control access to directives 
7b32422
-USE_TCP_WRAP = -DUSE_TCP_WRAPPERS
7b32422
-
7b32422
-CFLAGS  = @CFLAGS@ $(USE_TCP_WRAP)
7b32422
+CFLAGS  = @CFLAGS@
7b32422
 ALL_CFLAGS = $(CFLAGS) $(LOCAL_INC) @DEFS@ @IPV6INCLUDES@
7b32422
 
7b32422
 LDFLAGS = @LDFLAGS@
7b32422
-- 
7b32422
2.13.6
7b32422