Drop support for ancient libselinux
setexecfilecon() is in libselinux version 2.3 in 2014, we don't need to worry about it's availability anymore. Instead, use it to determine libselinux suitability in the configure check, eliminating another redundant check and a bunch of unused code.
This commit is contained in:
parent
de7e2230be
commit
b1fed31a99
|
@ -636,10 +636,8 @@ esac],
|
|||
AS_IF([test "$with_selinux" = yes],[
|
||||
AC_CHECK_HEADER([selinux/selinux.h],[
|
||||
save_LIBS="$LIBS"
|
||||
AC_CHECK_LIB([selinux],[is_selinux_enabled],[],[
|
||||
AC_MSG_ERROR([--with-selinux given, but is_selinux_enabled not found in libselinux])])
|
||||
AC_CHECK_LIB([selinux],[setexecfilecon],[
|
||||
AC_DEFINE([HAVE_SETEXECFILECON],[1],[Define to 1 if SELinux setexecfilecon is present])])
|
||||
AC_CHECK_LIB([selinux],[setexecfilecon],[],[
|
||||
AC_MSG_ERROR([--with-selinux given, but setexecfilecon not found in libselinux])])
|
||||
LIBS="$save_LIBS"
|
||||
],[
|
||||
AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
|
||||
|
|
|
@ -95,43 +95,6 @@ static rpmRC selinux_psm_pre(rpmPlugin plugin, rpmte te)
|
|||
return rc;
|
||||
}
|
||||
|
||||
#ifndef HAVE_SETEXECFILECON
|
||||
static int setexecfilecon(const char *path, const char *fallback_type)
|
||||
{
|
||||
int rc = -1;
|
||||
char *mycon = NULL, fcon = NULL, newcon = NULL;
|
||||
context_t con = NULL;
|
||||
|
||||
/* Figure the context to for next exec() */
|
||||
if (getcon(&mycon) < 0)
|
||||
goto exit;
|
||||
if (getfilecon(path, &fcon) < 0)
|
||||
goto exit;
|
||||
if (security_compute_create(mycon, fcon,
|
||||
string_to_security_class("process"), &newcon) < 0)
|
||||
goto exit;
|
||||
|
||||
if (rstreq(mycon, newcon)) {
|
||||
con = context_new(mycon);
|
||||
if (!con)
|
||||
goto exit;
|
||||
if (context_type_set(con, fallback_type))
|
||||
goto exit;
|
||||
freecon(newcon);
|
||||
newcon = xstrdup(context_str(con));
|
||||
}
|
||||
|
||||
rc = setexeccon(newcon);
|
||||
|
||||
exit:
|
||||
context_free(con);
|
||||
freecon(newcon);
|
||||
freecon(fcon);
|
||||
freecon(mycon);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
static rpmRC selinux_scriptlet_fork_post(rpmPlugin plugin,
|
||||
const char *path, int type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue