Use SO_PEERSEC to get client secontext

This commit is contained in:
topjohnwu
2021-10-19 23:46:38 -07:00
parent fe41df87bb
commit 8d0dc37ec0
7 changed files with 47 additions and 43 deletions

View File

@@ -25,7 +25,7 @@ Actions:
exit(1);
}
void denylist_handler(int client, ucred *cred) {
void denylist_handler(int client, const sock_cred *cred) {
if (client < 0) {
revert_unmount();
return;

View File

@@ -243,7 +243,7 @@ int remote_request_unmount() {
// The following code runs in magiskd
static void setup_files(int client, ucred *cred) {
static void setup_files(int client, const sock_cred *cred) {
LOGD("zygisk: setup files for pid=[%d]\n", cred->pid);
char buf[256];
@@ -265,7 +265,7 @@ static void setup_files(int client, ucred *cred) {
int cached_manager_app_id = -1;
static time_t last_modified = 0;
static void get_process_info(int client, ucred *cred) {
static void get_process_info(int client, const sock_cred *cred) {
AppInfo info{};
int uid = read_int(client);
string process = read_string(client);
@@ -315,7 +315,7 @@ static void get_process_info(int client, ucred *cred) {
}
}
static void do_unmount(int client, ucred *cred) {
static void do_unmount(int client, const sock_cred *cred) {
if (denylist_enabled) {
LOGD("zygisk: cleanup mount namespace for pid=[%d]\n", cred->pid);
revert_daemon(cred->pid, client);
@@ -334,7 +334,7 @@ static void send_log_pipe(int fd) {
}
}
void zygisk_handler(int client, ucred *cred) {
void zygisk_handler(int client, const sock_cred *cred) {
int code = read_int(client);
switch (code) {
case ZYGISK_SETUP: