linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] make capabilities support optional
@ 2010-04-20  8:46 Mike Frysinger
  2010-04-23 16:29 ` Steve Dickson
  0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2010-04-20  8:46 UTC (permalink / raw)
  To: linux-nfs

The new code using libcap is quite minor, so rather than always reqiure
libcap support, make it a normal --enable type flag.  Current default
behavior is retained -- if libcap is found, it is enabled, else it is
disabled like every nfs-utils version in the past.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 aclocal/libcap.m4  |   18 +++++++++++++-----
 support/nsm/file.c |    4 ++++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/aclocal/libcap.m4 b/aclocal/libcap.m4
index eabe507..68a624c 100644
--- a/aclocal/libcap.m4
+++ b/aclocal/libcap.m4
@@ -5,11 +5,19 @@ AC_DEFUN([AC_LIBCAP], [
   dnl look for prctl
   AC_CHECK_FUNC([prctl], , )
 
-  dnl look for the library; do not add to LIBS if found
-  AC_CHECK_LIB([cap], [cap_get_proc], [LIBCAP=-lcap], ,)
-  AC_SUBST(LIBCAP)
+  AC_ARG_ENABLE([caps],
+    [AS_HELP_STRING([--disable-caps], [Disable capabilities support])])
+
+  LIBCAP=
+
+  if test "x$enable_caps" != "xno" ; then
+    dnl look for the library; do not add to LIBS if found
+    AC_CHECK_LIB([cap], [cap_get_proc], [LIBCAP=-lcap], ,)
 
-  AC_CHECK_HEADERS([sys/capability.h], ,
-                   [AC_MSG_ERROR([libcap headers not found.])])
+    AC_CHECK_HEADERS([sys/capability.h], ,
+      [test "x$enable_caps" = "xyes" && AC_MSG_ERROR([libcap headers not found.])])
+  fi
+
+  AC_SUBST(LIBCAP)
 
 ])dnl
diff --git a/support/nsm/file.c b/support/nsm/file.c
index d469219..f4baeb9 100644
--- a/support/nsm/file.c
+++ b/support/nsm/file.c
@@ -67,7 +67,9 @@
 #endif
 
 #include <sys/types.h>
+#ifdef HAVE_SYS_CAPABILITY_H
 #include <sys/capability.h>
+#endif
 #include <sys/prctl.h>
 #include <sys/stat.h>
 
@@ -347,6 +349,7 @@ nsm_is_default_parentdir(void)
 static _Bool
 nsm_clear_capabilities(void)
 {
+#ifdef HAVE_SYS_CAPABILITY_H
 	cap_t caps;
 
 	caps = cap_from_text("cap_net_bind_service=ep");
@@ -362,6 +365,7 @@ nsm_clear_capabilities(void)
 	}
 
 	(void)cap_free(caps);
+#endif
 	return true;
 }
 
-- 
1.7.0.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-04-26 18:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20  8:46 [PATCH] make capabilities support optional Mike Frysinger
2010-04-23 16:29 ` Steve Dickson
     [not found]   ` <4BD1CADD.4050200-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-04-23 17:28     ` Chuck Lever
2010-04-23 18:22       ` Steve Dickson
     [not found]         ` <4BD1E55B.2090703-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-04-23 19:12           ` Chuck Lever
2010-04-23 19:29             ` Mike Frysinger
2010-04-23 20:09               ` Chuck Lever
2010-04-24  4:42                 ` Mike Frysinger
2010-04-26 15:12                   ` Chuck Lever
2010-04-26 16:46                     ` Mike Frysinger
2010-04-26 18:03                       ` Chuck Lever
2010-04-23 22:22             ` Steve Dickson
     [not found]               ` <4BD21DA1.4000001-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-04-26 15:24                 ` Chuck Lever
2010-04-26 16:10                   ` Steve Dickson
     [not found]                     ` <4BD5BAD8.5040209-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-04-26 16:51                       ` Mike Frysinger
2010-04-26 16:54                         ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).