mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-05-29 13:00:13 +02:00
Ensure manager can always bypass su access policy
This fixes https://github.com/topjohnwu/Magisk/issues/9050.
This commit is contained in:
parent
dc0acea47c
commit
fada8b148a
@ -241,6 +241,22 @@ impl MagiskD {
|
||||
_ => uid,
|
||||
};
|
||||
|
||||
let mut access = RootSettings::default();
|
||||
self.get_root_settings(eval_uid, &mut access)?;
|
||||
|
||||
// We need to talk to the manager, get the app info
|
||||
let (mgr_uid, mgr_pkg) =
|
||||
if access.policy == SuPolicy::Query || access.log || access.notify {
|
||||
self.get_manager(to_user_id(eval_uid), true)
|
||||
} else {
|
||||
(-1, String::new())
|
||||
};
|
||||
|
||||
// If it's the manager, allow it silently
|
||||
if to_app_id(uid) == to_app_id(mgr_uid) {
|
||||
return Arc::new(SuInfo::allow(uid));
|
||||
}
|
||||
|
||||
// Check su access settings
|
||||
match cfg.root_access {
|
||||
RootAccess::Disabled => {
|
||||
@ -262,22 +278,6 @@ impl MagiskD {
|
||||
_ => {}
|
||||
};
|
||||
|
||||
let mut access = RootSettings::default();
|
||||
self.get_root_settings(eval_uid, &mut access)?;
|
||||
|
||||
// We need to talk to the manager, get the app info
|
||||
let (mgr_uid, mgr_pkg) =
|
||||
if access.policy == SuPolicy::Query || access.log || access.notify {
|
||||
self.get_manager(to_user_id(eval_uid), true)
|
||||
} else {
|
||||
(-1, String::new())
|
||||
};
|
||||
|
||||
// If it's the manager, allow it silently
|
||||
if to_app_id(uid) == to_app_id(mgr_uid) {
|
||||
return Arc::new(SuInfo::allow(uid));
|
||||
}
|
||||
|
||||
// If still not determined, check if manager exists
|
||||
if access.policy == SuPolicy::Query && mgr_uid < 0 {
|
||||
return Arc::new(SuInfo::deny(uid));
|
||||
|
Loading…
x
Reference in New Issue
Block a user