selinux: use string_to_security_class() instead of class ID

SELinux recommends to use string_to_security_class() instead of referencing
class IDs directly. This also fixes a build issue for systems that don't
include flask.h by default.

References:
https://selinuxproject.org/page/NB_Imp_SELinux-aware_Apps#Implementing_SELinux-aware_Applications_2
76913d8adb
This commit is contained in:
Davide Cavalca 2017-02-02 21:20:05 +01:00 committed by Panu Matilainen
parent d63ec5b1a1
commit 007a405b98
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ static rpmRC selinux_scriptlet_fork_post(rpmPlugin plugin,
goto exit;
if (getfilecon(path, &fcon) < 0)
goto exit;
if (security_compute_create(mycon, fcon, SECCLASS_PROCESS, &newcon) < 0)
if (security_compute_create(mycon, fcon, string_to_security_class("process"), &newcon) < 0)
goto exit;
if (rstreq(mycon, newcon)) {