mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-27 12:57:38 +00:00
Cleanup unnecessary functions
This commit is contained in:
parent
3d9a15df44
commit
6a54672b13
@ -19,18 +19,6 @@ static const char *prop_value[] =
|
|||||||
"enforcing", "0", "0", "0",
|
"enforcing", "0", "0", "0",
|
||||||
"1", "user", "release-keys", "0", nullptr };
|
"1", "user", "release-keys", "0", nullptr };
|
||||||
|
|
||||||
void manage_selinux() {
|
|
||||||
char val;
|
|
||||||
int fd = xopen(SELINUX_ENFORCE, O_RDONLY);
|
|
||||||
xxread(fd, &val, sizeof(val));
|
|
||||||
close(fd);
|
|
||||||
// Permissive
|
|
||||||
if (val == '0') {
|
|
||||||
chmod(SELINUX_ENFORCE, 0640);
|
|
||||||
chmod(SELINUX_POLICY, 0440);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void hide_sensitive_props() {
|
void hide_sensitive_props() {
|
||||||
LOGI("hide_policy: Hiding sensitive props\n");
|
LOGI("hide_policy: Hiding sensitive props\n");
|
||||||
|
|
||||||
@ -42,13 +30,6 @@ void hide_sensitive_props() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void clean_magisk_props() {
|
|
||||||
getprop([](const char *name, auto, auto) -> void {
|
|
||||||
if (strstr(name, "magisk"))
|
|
||||||
deleteprop(name);
|
|
||||||
}, nullptr, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lazy_unmount(const char* mountpoint) {
|
static inline void lazy_unmount(const char* mountpoint) {
|
||||||
if (umount2(mountpoint, MNT_DETACH) != -1)
|
if (umount2(mountpoint, MNT_DETACH) != -1)
|
||||||
LOGD("hide_policy: Unmounted (%s)\n", mountpoint);
|
LOGD("hide_policy: Unmounted (%s)\n", mountpoint);
|
||||||
@ -65,8 +46,21 @@ void hide_daemon(int pid) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
LOGD("hide_policy: handling PID=[%d]\n", pid);
|
LOGD("hide_policy: handling PID=[%d]\n", pid);
|
||||||
manage_selinux();
|
|
||||||
clean_magisk_props();
|
char val;
|
||||||
|
int fd = xopen(SELINUX_ENFORCE, O_RDONLY);
|
||||||
|
xxread(fd, &val, sizeof(val));
|
||||||
|
close(fd);
|
||||||
|
// Permissive
|
||||||
|
if (val == '0') {
|
||||||
|
chmod(SELINUX_ENFORCE, 0640);
|
||||||
|
chmod(SELINUX_POLICY, 0440);
|
||||||
|
}
|
||||||
|
|
||||||
|
getprop([](const char *name, auto, auto) -> void {
|
||||||
|
if (strstr(name, "magisk"))
|
||||||
|
deleteprop(name);
|
||||||
|
}, nullptr, false);
|
||||||
|
|
||||||
vector<string> targets;
|
vector<string> targets;
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ void crawl_procfs(DIR *dir, const std::function<bool (int)> &fn);
|
|||||||
// Hide policies
|
// Hide policies
|
||||||
void hide_daemon(int pid);
|
void hide_daemon(int pid);
|
||||||
void hide_sensitive_props();
|
void hide_sensitive_props();
|
||||||
void manage_selinux();
|
|
||||||
|
|
||||||
extern bool hide_enabled;
|
extern bool hide_enabled;
|
||||||
extern pthread_mutex_t monitor_lock;
|
extern pthread_mutex_t monitor_lock;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user