mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
selinux tip, remove rust dep 'selinux'
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -1371,9 +1371,19 @@ pub fn is_x11() -> bool {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_selinux_enabled() -> bool {
|
||||
match selinux::kernel_support() {
|
||||
selinux::KernelSupport::Unsupported => false,
|
||||
_ => selinux::current_mode() == selinux::SELinuxMode::Enforcing,
|
||||
pub fn is_selinux_enforcing() -> bool {
|
||||
match run_cmds("getenforce") {
|
||||
Ok(output) => output.trim() == "Enforcing",
|
||||
Err(_) => match run_cmds("sestatus") {
|
||||
Ok(output) => {
|
||||
for line in output.lines() {
|
||||
if line.contains("Current mode:") {
|
||||
return line.contains("enforcing");
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
Err(_) => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user