ksud: make it compilable for non-android

This commit is contained in:
tiann
2023-02-01 19:04:33 +08:00
parent 1cd18a643d
commit 619dd1ace1
10 changed files with 97 additions and 51 deletions

View File

@@ -11,7 +11,7 @@ use nom::{
sequence::Tuple,
IResult, Parser,
};
use std::{vec, path::Path};
use std::{path::Path, vec};
type SeObject<'a> = Vec<&'a str>;
@@ -692,6 +692,7 @@ impl From<AtomicStatement> for FfiPolicy {
}
}
#[cfg(target_os = "android")]
fn apply_one_rule<'a>(statement: &'a PolicyStatement<'a>) -> Result<()> {
let policies: Vec<AtomicStatement> = statement.try_into()?;
@@ -716,6 +717,11 @@ fn apply_one_rule<'a>(statement: &'a PolicyStatement<'a>) -> Result<()> {
Ok(())
}
#[cfg(not(target_os = "android"))]
fn apply_one_rule<'a>(statement: &'a PolicyStatement<'a>) -> Result<()> {
unimplemented!()
}
pub fn live_patch(policy: &str) -> Result<()> {
let result = parse_sepolicy(policy.trim())?;
for statement in result {