mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
chcon: do not validate security context if SELinux is disabled
* src/chcon.c (main): Skip call of security_check_context() in case SELinux is disabled to avoid unnecessary failure. Bug: https://bugzilla.redhat.com/1777831
This commit is contained in:
1 parent
ad591a52b4
commit
5118a2e392
1 file changed
+3
-1
+3
-1
@@ -18,6 +18,7 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
#include <selinux/selinux.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "dev-ino.h"
|
||||
@@ -557,7 +558,8 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
specified_context = argv[optind++];
|
||||
if (security_check_context (se_const (specified_context)) < 0)
|
||||
if (0 < is_selinux_enabled ()
|
||||
&& security_check_context (se_const (specified_context)) < 0)
|
||||
die (EXIT_FAILURE, errno, _("invalid context: %s"),
|
||||
quote (specified_context));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user