]> granicus.if.org Git - procps-ng/commitdiff
ps: making the libselinux support configurable
authorJaromir Capik <jcapik@redhat.com>
Wed, 7 Aug 2013 15:52:38 +0000 (17:52 +0200)
committerJaromir Capik <jcapik@redhat.com>
Wed, 7 Aug 2013 15:52:38 +0000 (17:52 +0200)
Previously the libselinux support was present
in the sources, but disabled with a preprocessor
condition (#if 0).
From now the libselinux support can be enabled with
the --enable-libselinux switch available
in the configuration script. That way is more
flexible than local patches modifying the condition
value from 0 to 1.

configure.ac
ps/output.c

index 06daec2f34c317cb69ad26ceac246596e2fe96b9..b3725be2f59081421b392f6aa7358d99a2aafdc3 100644 (file)
@@ -111,6 +111,14 @@ if test "$enable_watch8bit" = "yes"; then
   AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
 fi
 
+AC_ARG_ENABLE([libselinux],
+              AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
+              [enable_libselinux=$enableval],
+              [enable_libselinux="no"])
+if test "$enable_libselinux" = "yes"; then
+  AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
+fi
+
 # Optional packages - AC_ARG_WITH
 AC_ARG_WITH([ncurses],
   AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
index 0203d5c4d597a5d80a83a4d9291fc8b29437f520..b7b21d15c235d99e9fd12b1739fabdc6eaa31d55 100644 (file)
@@ -1282,6 +1282,8 @@ fail:
 /****************** FLASK & seLinux security stuff **********************/
 // move the bulk of this to libproc sometime
 
+#if !ENABLE_LIBSELINUX
+
 static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
   char filename[48];
   size_t len;
@@ -1310,7 +1312,8 @@ fail:
   return 1;
 }
 
-#if 0
+#else
+
 // This needs more study, considering:
 // 1. the static linking option (maybe disable this in that case)
 // 2. the -z and -Z option issue
@@ -1345,6 +1348,7 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const
   }
   return len;
 }
+
 #endif