Patchwork [2/7] quota: apply patch to obey tcp-wrappers config

login
register
mail settings
Submitter Christopher Larson
Date Nov. 27, 2013, 6:07 p.m.
Message ID <02c0b62bd0784357b13c89b00ef7c64bab9f72a5.1385575572.git.kergoth@gmail.com>
Download mbox | patch
Permalink /patch/62505/
State Accepted
Commit 82e373fb847b08b55176d0bcd78fdebf1c1b8689
Headers show

Comments

Christopher Larson - Nov. 27, 2013, 6:07 p.m.
From: Christopher Larson <chris_larson@mentor.com>

Without this, the tcpwrappers argument wasn't obeyed, and as such the build
wasn't as deterministic as we'd prefer.

Signed-off-by: Christopher Larson <kergoth@gmail.com>
---
 .../quota/quota/config-tcpwrappers.patch           | 75 ++++++++++++++++++++++
 meta/recipes-extended/quota/quota_4.01.bb          |  3 +-
 2 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/quota/quota/config-tcpwrappers.patch

Patch

diff --git a/meta/recipes-extended/quota/quota/config-tcpwrappers.patch b/meta/recipes-extended/quota/quota/config-tcpwrappers.patch
new file mode 100644
index 0000000..94dc3f5
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/config-tcpwrappers.patch
@@ -0,0 +1,75 @@ 
+Upstream-status: Pending
+
+--- quota-tools.orig/configure.in
++++ quota-tools/configure.in
+@@ -151,33 +151,46 @@ AC_SUBST(QUOTA_NETLINK_PROG)
+ AC_SUBST(NETLINKLIBS)
+
+ AC_SEARCH_LIBS(gethostbyname, nsl)
+-AC_MSG_CHECKING(for host_access in -lwrap)
+-AC_CACHE_VAL(ac_cv_lib_wrap_main,
+-	saved_LIBS="$LIBS"
+-	LIBS="$LIBS -lwrap"
+-	[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+-	#include <stdio.h>
+-	#include <sys/types.h>
+-	#include <sys/socket.h>
+-	#include <netinet/in.h>
+-	#include <tcpd.h>
+-	struct request_info request;
+-	int deny_severity, allow_severity;]],[[hosts_access(&request);]])],
+-	dnl We always restore LIBS as we add -lwrap in the next check
+-	[ac_cv_lib_wrap_main=yes; LIBS="$saved_LIBS"; AC_MSG_RESULT(yes)],
+-	[ac_cv_lib_wrap_main=no; LIBS="$saved_LIBS"; AC_MSG_RESULT(no)])
+-	])
+
+-if test ${ac_cv_lib_wrap_main} = yes; then
+-	AC_CHECK_HEADER(tcpd.h,, [
+-		echo 'ERROR: could not find tcpd.h - missing TCP wrappers package'
+-		exit 1
+-	])
+-	LIBS="$LIBS -lwrap"
+-	AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad])
+-	COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS"
++AC_ARG_WITH(tcpwrappers,
++	[  --with-tcpwrappers=[yes/no/try]   Use hosts.allow and hosts.deny for access checking of rpc.rquota [default=yes, if available.]],
++	,
++	with_tcpwrappers="try")
++
++if test "x$with_tcpwrappers" != xno; then
++	AC_MSG_CHECKING(for host_access in -lwrap)
++	AC_CACHE_VAL(ac_cv_lib_wrap_main,
++		saved_LIBS="$LIBS"
++		LIBS="$LIBS -lwrap"
++		[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++		#include <stdio.h>
++		#include <sys/types.h>
++		#include <sys/socket.h>
++		#include <netinet/in.h>
++		#include <tcpd.h>
++		struct request_info request;
++		int deny_severity, allow_severity;]],[[hosts_access(&request);]])],
++		dnl We always restore LIBS as we add -lwrap in the next try
++		[ac_cv_lib_wrap_main=yes; LIBS="$saved_LIBS"; AC_MSG_RESULT(yes)],
++		[ac_cv_lib_wrap_main=no; LIBS="$saved_LIBS"; AC_MSG_RESULT(no)])
++		])
++
++	if test "x$ac_cv_lib_wrap_main" = xyes; then
++		AC_CHECK_HEADER(tcpd.h,, [
++			if test "x$with_tcpwrappers" != xtry; then
++				AC_MSG_ERROR([could not find tcpd.h - missing TCP wrappers package])
++			fi
++		])
++
++		LIBS="$LIBS -lwrap"
++		AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad])
++		COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS"
++	elif test "x$with_tcpwrappers" != xtry; then
++		AC_MSG_ERROR([could not find libwrap - missing TCP wrappers package])
++	fi
+ fi
+
++
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+ AC_C_INLINE
diff --git a/meta/recipes-extended/quota/quota_4.01.bb b/meta/recipes-extended/quota/quota_4.01.bb
index 9835f06..a5f69b3 100644
--- a/meta/recipes-extended/quota/quota_4.01.bb
+++ b/meta/recipes-extended/quota/quota_4.01.bb
@@ -8,7 +8,8 @@  LIC_FILES_CHKSUM = "file://quota.c;beginline=1;endline=33;md5=331c7d77744bfe0ad2
                     file://svc_socket.c;beginline=1;endline=17;md5=24d5a8792da45910786eeac750be8ceb"
 PR = "r1"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/project/linuxquota/quota-tools/${PV}/quota-${PV}.tar.gz"
+SRC_URI = "${SOURCEFORGE_MIRROR}/project/linuxquota/quota-tools/${PV}/quota-${PV}.tar.gz \
+           file://config-tcpwrappers.patch"
 
 SRC_URI[md5sum] = "5c2c31e321d2e1322ce12d69ae5c66d6"
 SRC_URI[sha256sum] = "a36300bbc126b79b745bf937245092808b4585aa3309ef3335d4ab9d873cd206"