Migrate uid_granted_root to Rust

This commit is contained in:
topjohnwu
2025-01-11 00:11:48 +08:00
committed by John Wu
parent 4d4195c02d
commit 82d1d19267
7 changed files with 83 additions and 62 deletions
+3 -3
View File
@@ -122,23 +122,23 @@ static void connect_companion(int client, bool is_64_bit) {
send_fd(zygiskd_socket, client);
}
extern bool uid_granted_root(int uid);
static void get_process_info(int client, const sock_cred *cred) {
int uid = read_int(client);
string process = read_string(client);
auto &daemon = MagiskD();
uint32_t flags = 0;
if (is_deny_target(uid, process)) {
flags |= PROCESS_ON_DENYLIST;
}
if (MagiskD().get_manager(to_user_id(uid), nullptr, false) == uid) {
if (daemon.get_manager(to_user_id(uid), nullptr, false) == uid) {
flags |= PROCESS_IS_MAGISK_APP;
}
if (denylist_enforced) {
flags |= DENYLIST_ENFORCING;
}
if (uid_granted_root(uid)) {
if (daemon.uid_granted_root(uid)) {
flags |= PROCESS_GRANTED_ROOT;
}