mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
su: do not notify app when UID has no policy
With reactive su prompting removed, root requests from UIDs without an existing policy in the database are rejected immediately. Previously, RootSettings defaulted log and notify to true, causing the daemon to notify the manager app whenever an unconfigured UID attempted to run su. Derive Default for RootSettings so that policy defaults to Deny with log and notify initialized to false, preventing unwanted notifications to the app when no database policy exists. Also simplify SuInfo::allow and SuInfo::deny to leverage Default. Assisted-by: Gemini 3.8 Flash
This commit is contained in:
@@ -53,8 +53,7 @@ impl SuInfo {
|
||||
fn allow(uid: i32) -> SuInfo {
|
||||
let settings = RootSettings {
|
||||
policy: SuPolicy::Allow,
|
||||
log: false,
|
||||
notify: false,
|
||||
..Default::default()
|
||||
};
|
||||
SuInfo {
|
||||
uid,
|
||||
@@ -64,14 +63,8 @@ impl SuInfo {
|
||||
}
|
||||
|
||||
fn deny(uid: i32) -> SuInfo {
|
||||
let settings = RootSettings {
|
||||
policy: SuPolicy::Deny,
|
||||
log: false,
|
||||
notify: false,
|
||||
};
|
||||
SuInfo {
|
||||
uid,
|
||||
settings,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,23 +12,13 @@ impl Default for SuPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, Default)]
|
||||
pub struct RootSettings {
|
||||
pub policy: SuPolicy,
|
||||
pub log: bool,
|
||||
pub notify: bool,
|
||||
}
|
||||
|
||||
impl Default for RootSettings {
|
||||
fn default() -> Self {
|
||||
RootSettings {
|
||||
policy: SuPolicy::Deny,
|
||||
log: true,
|
||||
notify: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SqlTable for RootSettings {
|
||||
fn on_row(&mut self, columns: &[String], values: &DbValues) {
|
||||
for (i, column) in columns.iter().enumerate() {
|
||||
|
||||
Reference in New Issue
Block a user