Skip to content

Commit

Permalink
selinux: use string_to_security_class() instead of class ID
Browse files Browse the repository at this point in the history
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
SELinuxProject/selinux@76913d8
  • Loading branch information
davide125 authored and pmatilai committed Feb 8, 2017
1 parent d63ec5b commit 007a405
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/selinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 007a405

Please sign in to comment.