|
|
742536 |
From b8f375c2c8140e759122bca3e3469386d3ba5184 Mon Sep 17 00:00:00 2001
|
|
|
742536 |
From: "Dmitry V. Levin" <ldv@strace.io>
|
|
|
742536 |
Date: Mon, 29 Nov 2021 08:00:00 +0000
|
|
|
742536 |
Subject: [PATCH 168/174] m4: fix st_SELINUX check
|
|
|
742536 |
|
|
|
742536 |
* m4/st_selinux.m4: Make sure selinux support is enabled only if
|
|
|
742536 |
all expected functions are provided by libselinux.
|
|
|
742536 |
|
|
|
742536 |
Fixes: v5.12~49 "Implement --secontext[=full] option to display SELinux contexts"
|
|
|
742536 |
---
|
|
|
742536 |
m4/st_selinux.m4 | 36 ++++++++++++++++--------------------
|
|
|
742536 |
1 file changed, 16 insertions(+), 20 deletions(-)
|
|
|
742536 |
|
|
|
742536 |
diff --git a/m4/st_selinux.m4 b/m4/st_selinux.m4
|
|
|
742536 |
index da72a48..7b24eba 100644
|
|
|
742536 |
--- a/m4/st_selinux.m4
|
|
|
742536 |
+++ b/m4/st_selinux.m4
|
|
|
742536 |
@@ -34,29 +34,25 @@ AS_IF([test "x$with_libselinux" != xno],
|
|
|
742536 |
AS_IF([test "x$found_selinux_h" = xyes],
|
|
|
742536 |
[saved_LDFLAGS="$LDFLAGS"
|
|
|
742536 |
LDFLAGS="$LDFLAGS $libselinux_LDFLAGS"
|
|
|
742536 |
- AC_CHECK_LIB([selinux],[getpidcon],
|
|
|
742536 |
- [libselinux_LIBS="-lselinux"
|
|
|
742536 |
- enable_secontext=yes
|
|
|
742536 |
- ],
|
|
|
742536 |
- [if test "x$with_libselinux" != xcheck; then
|
|
|
742536 |
- AC_MSG_FAILURE([failed to find getpidcon in libselinux])
|
|
|
742536 |
- fi
|
|
|
742536 |
- ]
|
|
|
742536 |
- )
|
|
|
742536 |
- AC_CHECK_LIB([selinux],[getfilecon],
|
|
|
742536 |
- [libselinux_LIBS="-lselinux"
|
|
|
742536 |
- enable_secontext=yes
|
|
|
742536 |
- ],
|
|
|
742536 |
- [if test "x$with_libselinux" != xcheck; then
|
|
|
742536 |
- AC_MSG_FAILURE([failed to find getfilecon in libselinux])
|
|
|
742536 |
- fi
|
|
|
742536 |
- ]
|
|
|
742536 |
+ missing=
|
|
|
742536 |
+ for func in getpidcon getfilecon; do
|
|
|
742536 |
+ AC_CHECK_LIB([selinux], [$func], [:],
|
|
|
742536 |
+ [missing="$missing $func"])
|
|
|
742536 |
+ done
|
|
|
742536 |
+ AS_IF([test "x$missing" = x],
|
|
|
742536 |
+ [libselinux_LIBS="-lselinux"
|
|
|
742536 |
+ enable_secontext=yes
|
|
|
742536 |
+ ],
|
|
|
742536 |
+ [AS_IF([test "x$with_libselinux" != xcheck],
|
|
|
742536 |
+ [AC_MSG_FAILURE([failed to find in libselinux:$missing])]
|
|
|
742536 |
+ )
|
|
|
742536 |
+ ]
|
|
|
742536 |
)
|
|
|
742536 |
LDFLAGS="$saved_LDFLAGS"
|
|
|
742536 |
],
|
|
|
742536 |
- [if test "x$with_libselinux" != xcheck; then
|
|
|
742536 |
- AC_MSG_FAILURE([failed to find selinux.h])
|
|
|
742536 |
- fi
|
|
|
742536 |
+ [AS_IF([test "x$with_libselinux" != xcheck],
|
|
|
742536 |
+ [AC_MSG_FAILURE([failed to find selinux.h])]
|
|
|
742536 |
+ )
|
|
|
742536 |
]
|
|
|
742536 |
)
|
|
|
742536 |
]
|
|
|
742536 |
--- old/configure 2022-02-07 20:17:58.364068436 +0100
|
|
|
742536 |
+++ new/configure 2022-02-07 20:19:17.092067347 +0100
|
|
|
742536 |
@@ -18437,9 +18437,12 @@
|
|
|
742536 |
if test "x$found_selinux_h" = xyes; then :
|
|
|
742536 |
saved_LDFLAGS="$LDFLAGS"
|
|
|
742536 |
LDFLAGS="$LDFLAGS $libselinux_LDFLAGS"
|
|
|
742536 |
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpidcon in -lselinux" >&5
|
|
|
742536 |
-$as_echo_n "checking for getpidcon in -lselinux... " >&6; }
|
|
|
742536 |
-if ${ac_cv_lib_selinux_getpidcon+:} false; then :
|
|
|
742536 |
+ missing=
|
|
|
742536 |
+ for func in getpidcon getfilecon; do
|
|
|
742536 |
+ as_ac_Lib=`$as_echo "ac_cv_lib_selinux_$func" | $as_tr_sh`
|
|
|
742536 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $func in -lselinux" >&5
|
|
|
742536 |
+$as_echo_n "checking for $func in -lselinux... " >&6; }
|
|
|
742536 |
+if eval \${$as_ac_Lib+:} false; then :
|
|
|
742536 |
$as_echo_n "(cached) " >&6
|
|
|
742536 |
else
|
|
|
742536 |
ac_check_lib_save_LIBS=$LIBS
|
|
|
742536 |
@@ -18453,101 +18456,59 @@
|
|
|
742536 |
#ifdef __cplusplus
|
|
|
742536 |
extern "C"
|
|
|
742536 |
#endif
|
|
|
742536 |
-char getpidcon ();
|
|
|
742536 |
+char $func ();
|
|
|
742536 |
int
|
|
|
742536 |
main ()
|
|
|
742536 |
{
|
|
|
742536 |
-return getpidcon ();
|
|
|
742536 |
+return $func ();
|
|
|
742536 |
;
|
|
|
742536 |
return 0;
|
|
|
742536 |
}
|
|
|
742536 |
_ACEOF
|
|
|
742536 |
if ac_fn_c_try_link "$LINENO"; then :
|
|
|
742536 |
- ac_cv_lib_selinux_getpidcon=yes
|
|
|
742536 |
+ eval "$as_ac_Lib=yes"
|
|
|
742536 |
else
|
|
|
742536 |
- ac_cv_lib_selinux_getpidcon=no
|
|
|
742536 |
+ eval "$as_ac_Lib=no"
|
|
|
742536 |
fi
|
|
|
742536 |
rm -f core conftest.err conftest.$ac_objext \
|
|
|
742536 |
conftest$ac_exeext conftest.$ac_ext
|
|
|
742536 |
LIBS=$ac_check_lib_save_LIBS
|
|
|
742536 |
fi
|
|
|
742536 |
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_getpidcon" >&5
|
|
|
742536 |
-$as_echo "$ac_cv_lib_selinux_getpidcon" >&6; }
|
|
|
742536 |
-if test "x$ac_cv_lib_selinux_getpidcon" = xyes; then :
|
|
|
742536 |
- libselinux_LIBS="-lselinux"
|
|
|
742536 |
- enable_secontext=yes
|
|
|
742536 |
-
|
|
|
742536 |
+eval ac_res=\$$as_ac_Lib
|
|
|
742536 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
|
|
742536 |
+$as_echo "$ac_res" >&6; }
|
|
|
742536 |
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
|
|
|
742536 |
+ :
|
|
|
742536 |
else
|
|
|
742536 |
- if test "x$with_libselinux" != xcheck; then
|
|
|
742536 |
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
|
742536 |
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
|
|
742536 |
-as_fn_error $? "failed to find getpidcon in libselinux
|
|
|
742536 |
-See \`config.log' for more details" "$LINENO" 5; }
|
|
|
742536 |
- fi
|
|
|
742536 |
-
|
|
|
742536 |
-
|
|
|
742536 |
+ missing="$missing $func"
|
|
|
742536 |
fi
|
|
|
742536 |
|
|
|
742536 |
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getfilecon in -lselinux" >&5
|
|
|
742536 |
-$as_echo_n "checking for getfilecon in -lselinux... " >&6; }
|
|
|
742536 |
-if ${ac_cv_lib_selinux_getfilecon+:} false; then :
|
|
|
742536 |
- $as_echo_n "(cached) " >&6
|
|
|
742536 |
-else
|
|
|
742536 |
- ac_check_lib_save_LIBS=$LIBS
|
|
|
742536 |
-LIBS="-lselinux $LIBS"
|
|
|
742536 |
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
|
742536 |
-/* end confdefs.h. */
|
|
|
742536 |
-
|
|
|
742536 |
-/* Override any GCC internal prototype to avoid an error.
|
|
|
742536 |
- Use char because int might match the return type of a GCC
|
|
|
742536 |
- builtin and then its argument prototype would still apply. */
|
|
|
742536 |
-#ifdef __cplusplus
|
|
|
742536 |
-extern "C"
|
|
|
742536 |
-#endif
|
|
|
742536 |
-char getfilecon ();
|
|
|
742536 |
-int
|
|
|
742536 |
-main ()
|
|
|
742536 |
-{
|
|
|
742536 |
-return getfilecon ();
|
|
|
742536 |
- ;
|
|
|
742536 |
- return 0;
|
|
|
742536 |
-}
|
|
|
742536 |
-_ACEOF
|
|
|
742536 |
-if ac_fn_c_try_link "$LINENO"; then :
|
|
|
742536 |
- ac_cv_lib_selinux_getfilecon=yes
|
|
|
742536 |
-else
|
|
|
742536 |
- ac_cv_lib_selinux_getfilecon=no
|
|
|
742536 |
-fi
|
|
|
742536 |
-rm -f core conftest.err conftest.$ac_objext \
|
|
|
742536 |
- conftest$ac_exeext conftest.$ac_ext
|
|
|
742536 |
-LIBS=$ac_check_lib_save_LIBS
|
|
|
742536 |
-fi
|
|
|
742536 |
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_getfilecon" >&5
|
|
|
742536 |
-$as_echo "$ac_cv_lib_selinux_getfilecon" >&6; }
|
|
|
742536 |
-if test "x$ac_cv_lib_selinux_getfilecon" = xyes; then :
|
|
|
742536 |
+ done
|
|
|
742536 |
+ if test "x$missing" = x; then :
|
|
|
742536 |
libselinux_LIBS="-lselinux"
|
|
|
742536 |
- enable_secontext=yes
|
|
|
742536 |
+ enable_secontext=yes
|
|
|
742536 |
|
|
|
742536 |
else
|
|
|
742536 |
- if test "x$with_libselinux" != xcheck; then
|
|
|
742536 |
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
|
742536 |
+ if test "x$with_libselinux" != xcheck; then :
|
|
|
742536 |
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
|
742536 |
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
|
|
742536 |
-as_fn_error $? "failed to find getfilecon in libselinux
|
|
|
742536 |
+as_fn_error $? "failed to find in libselinux:$missing
|
|
|
742536 |
See \`config.log' for more details" "$LINENO" 5; }
|
|
|
742536 |
- fi
|
|
|
742536 |
-
|
|
|
742536 |
|
|
|
742536 |
fi
|
|
|
742536 |
|
|
|
742536 |
+
|
|
|
742536 |
+fi
|
|
|
742536 |
LDFLAGS="$saved_LDFLAGS"
|
|
|
742536 |
|
|
|
742536 |
else
|
|
|
742536 |
- if test "x$with_libselinux" != xcheck; then
|
|
|
742536 |
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
|
742536 |
+ if test "x$with_libselinux" != xcheck; then :
|
|
|
742536 |
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
|
742536 |
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
|
|
742536 |
as_fn_error $? "failed to find selinux.h
|
|
|
742536 |
See \`config.log' for more details" "$LINENO" 5; }
|
|
|
742536 |
- fi
|
|
|
742536 |
+
|
|
|
742536 |
+fi
|
|
|
742536 |
|
|
|
742536 |
|
|
|
742536 |
fi
|
|
|
742536 |
--
|
|
|
742536 |
2.1.4
|
|
|
742536 |
|