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