mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
su: remove obsolete access and reauth settings
With reactive su request prompts removed and superuser permissions granted explicitly ahead of time in the app, the legacy 4-way superuser access mode (Disabled, Apps only, ADB only, Apps & ADB) and pre-O reauthentication after upgrade settings are no longer applicable. ADB shell (com.android.shell) is now an explicit policy entry managed directly in the Superuser tab, making global access filters redundant and prone to conflicting state. Furthermore, revoking policy on package upgrade without reactive prompting silently breaks root for upgraded apps. - Remove RootAccess enum and root_access checks from magiskd. - Remove su access mode and reauthenticate settings from Manager app. - Drop ACTION_PACKAGE_REPLACED from Receiver and manifests. - Purge obsolete string resources across all translations. Assisted-by: Gemini 3.8 Flash
This commit is contained in:
@@ -41,7 +41,6 @@ use std::time::Duration;
|
||||
pub static MAGISKD: OnceLock<MagiskD> = OnceLock::new();
|
||||
|
||||
pub const AID_ROOT: i32 = 0;
|
||||
pub const AID_SHELL: i32 = 2000;
|
||||
pub const AID_APP_START: i32 = 10000;
|
||||
pub const AID_APP_END: i32 = 19999;
|
||||
pub const AID_USER_OFFSET: i32 = 100000;
|
||||
|
||||
@@ -57,7 +57,6 @@ where
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
pub struct DbSettings {
|
||||
pub root_access: RootAccess,
|
||||
pub multiuser_mode: MultiuserMode,
|
||||
pub mnt_ns: MntNsMode,
|
||||
pub boot_count: i32,
|
||||
@@ -65,16 +64,6 @@ pub struct DbSettings {
|
||||
pub zygisk: bool,
|
||||
}
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone, Default, FromPrimitive)]
|
||||
pub enum RootAccess {
|
||||
Disabled,
|
||||
AppsOnly,
|
||||
AdbOnly,
|
||||
#[default]
|
||||
AppsAndAdb,
|
||||
}
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone, Default, FromPrimitive)]
|
||||
pub enum MultiuserMode {
|
||||
@@ -93,7 +82,6 @@ impl Default for MntNsMode {
|
||||
impl DbEntryKey {
|
||||
fn to_str(self) -> &'static str {
|
||||
match self {
|
||||
DbEntryKey::RootAccess => "root_access",
|
||||
DbEntryKey::SuMultiuserMode => "multiuser_mode",
|
||||
DbEntryKey::SuMntNs => "mnt_ns",
|
||||
DbEntryKey::DenylistConfig => "denylist",
|
||||
@@ -117,7 +105,6 @@ impl SqlTable for DbSettings {
|
||||
}
|
||||
}
|
||||
match key {
|
||||
"root_access" => self.root_access = RootAccess::from_i32(value).unwrap_or_default(),
|
||||
"multiuser_mode" => {
|
||||
self.multiuser_mode = MultiuserMode::from_i32(value).unwrap_or_default()
|
||||
}
|
||||
@@ -251,7 +238,6 @@ impl MagiskD {
|
||||
}
|
||||
// Get default values
|
||||
let mut val = match key {
|
||||
DbEntryKey::RootAccess => RootAccess::default() as i32,
|
||||
DbEntryKey::SuMultiuserMode => MultiuserMode::default() as i32,
|
||||
DbEntryKey::SuMntNs => MntNsMode::default().repr,
|
||||
DbEntryKey::DenylistConfig => 0,
|
||||
|
||||
@@ -85,7 +85,6 @@ pub mod ffi {
|
||||
}
|
||||
|
||||
enum DbEntryKey {
|
||||
RootAccess,
|
||||
SuMultiuserMode,
|
||||
SuMntNs,
|
||||
DenylistConfig,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::db::RootSettings;
|
||||
use crate::daemon::{AID_APP_START, AID_ROOT, AID_SHELL, MagiskD, to_app_id, to_user_id};
|
||||
use crate::db::{DbSettings, MultiuserMode, RootAccess};
|
||||
use crate::daemon::{AID_APP_START, AID_ROOT, MagiskD, to_app_id, to_user_id};
|
||||
use crate::db::{DbSettings, MultiuserMode};
|
||||
use crate::ffi::{SuPolicy, SuRequest, exec_root_shell};
|
||||
use crate::socket::IpcRead;
|
||||
use base::{LoggedResult, ResultExt, WriteExt, debug, error, exit_on_error, libc, warn};
|
||||
@@ -207,23 +207,6 @@ impl MagiskD {
|
||||
return Ok(Arc::new(SuInfo::allow(uid)));
|
||||
}
|
||||
|
||||
// Check su access settings
|
||||
match cfg.root_access {
|
||||
RootAccess::Disabled => {
|
||||
warn!("Root access is disabled!");
|
||||
return Ok(Arc::new(SuInfo::deny(uid)));
|
||||
}
|
||||
RootAccess::AdbOnly if uid != AID_SHELL => {
|
||||
warn!("Root access limited to ADB only!");
|
||||
return Ok(Arc::new(SuInfo::deny(uid)));
|
||||
}
|
||||
RootAccess::AppsOnly if uid == AID_SHELL => {
|
||||
warn!("Root access is disabled for ADB!");
|
||||
return Ok(Arc::new(SuInfo::deny(uid)));
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
// Finally, the SuInfo
|
||||
Ok(Arc::new(SuInfo {
|
||||
uid,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::daemon::{
|
||||
AID_APP_END, AID_APP_START, AID_ROOT, AID_SHELL, MagiskD, to_app_id, to_user_id,
|
||||
AID_APP_END, AID_APP_START, AID_ROOT, MagiskD, to_app_id, to_user_id,
|
||||
};
|
||||
use crate::db::DbArg::Integer;
|
||||
use crate::db::{MultiuserMode, RootAccess, SqlTable, SqliteResult, SqliteReturn};
|
||||
use crate::db::{MultiuserMode, SqlTable, SqliteResult, SqliteReturn};
|
||||
use crate::ffi::{DbValues, SuPolicy};
|
||||
use base::ResultExt;
|
||||
|
||||
@@ -92,14 +92,6 @@ impl MagiskD {
|
||||
Err(_) => return false,
|
||||
};
|
||||
|
||||
// Check user root access settings
|
||||
match cfg.root_access {
|
||||
RootAccess::Disabled => return false,
|
||||
RootAccess::AppsOnly if uid == AID_SHELL => return false,
|
||||
RootAccess::AdbOnly if uid != AID_SHELL => return false,
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Check multiuser settings
|
||||
match cfg.multiuser_mode {
|
||||
MultiuserMode::OwnerOnly if to_user_id(uid) != 0 => return false,
|
||||
|
||||
Reference in New Issue
Block a user