Signed-off-by: Ookiineko <chiisaineko@protonmail.com> Co-authored-by: f19 <58457605+F-19-F@users.noreply.github.com> Co-authored-by: Scirese <nuclearlight91@gmail.com>
This commit is contained in:
@@ -53,36 +53,51 @@ if (!is_domain_permissive) {
|
||||
|
||||
void setenforce(bool enforce)
|
||||
{
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 14, 0)
|
||||
#ifdef CONFIG_SECURITY_SELINUX_DEVELOP
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
|
||||
selinux_state.enforcing = enforce;
|
||||
#endif
|
||||
#else
|
||||
selinux_enabled = enforce;
|
||||
selinux_enabled = enforce;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool getenforce()
|
||||
{
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 14, 0)
|
||||
#ifdef CONFIG_SECURITY_SELINUX_DISABLE
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
|
||||
if (selinux_state.disabled) {
|
||||
#else
|
||||
if (selinux_disabled) {
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SECURITY_SELINUX_DEVELOP
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
|
||||
return selinux_state.enforcing;
|
||||
#else
|
||||
return false;
|
||||
return selinux_enabled;
|
||||
#endif
|
||||
#else
|
||||
return selinux_enabled;
|
||||
return true;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
/*
|
||||
* get the subjective security ID of the current task
|
||||
*/
|
||||
static inline u32 current_sid(void)
|
||||
{
|
||||
const struct task_security_struct *tsec = current_security();
|
||||
|
||||
return tsec->sid;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool is_ksu_domain()
|
||||
{
|
||||
return ksu_sid && current_sid() == ksu_sid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user