Commit d0567d29 authored by topjohnwu's avatar topjohnwu

Update su to match Linux's implementation

parent 4db0ad32
...@@ -27,8 +27,8 @@ static void *request_handler(void *args) { ...@@ -27,8 +27,8 @@ static void *request_handler(void *args) {
free(args); free(args);
client_request req = read_int(client); client_request req = read_int(client);
struct ucred credentials; struct ucred credential;
get_client_cred(client, &credentials); get_client_cred(client, &credential);
switch (req) { switch (req) {
case LAUNCH_MAGISKHIDE: case LAUNCH_MAGISKHIDE:
...@@ -39,7 +39,7 @@ static void *request_handler(void *args) { ...@@ -39,7 +39,7 @@ static void *request_handler(void *args) {
case POST_FS: case POST_FS:
case POST_FS_DATA: case POST_FS_DATA:
case LATE_START: case LATE_START:
if (credentials.uid != 0) { if (credential.uid != 0) {
write_int(client, ROOT_REQUIRED); write_int(client, ROOT_REQUIRED);
close(client); close(client);
return NULL; return NULL;
...@@ -65,7 +65,7 @@ static void *request_handler(void *args) { ...@@ -65,7 +65,7 @@ static void *request_handler(void *args) {
ls_hide_list(client); ls_hide_list(client);
break; break;
case SUPERUSER: case SUPERUSER:
su_daemon_receiver(client); su_daemon_receiver(client, &credential);
break; break;
case CHECK_VERSION: case CHECK_VERSION:
write_string(client, MAGISK_VER_STR); write_string(client, MAGISK_VER_STR);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <pthread.h> #include <pthread.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/socket.h>
extern int is_daemon_init, seperate_vendor; extern int is_daemon_init, seperate_vendor;
...@@ -77,6 +78,6 @@ void ls_hide_list(int client); ...@@ -77,6 +78,6 @@ void ls_hide_list(int client);
* Superuser * * Superuser *
*************/ *************/
void su_daemon_receiver(int client); void su_daemon_receiver(int client, struct ucred *credential);
#endif #endif
Subproject commit 8b15e42253091a28c33a5e5e827d7750576d54dd Subproject commit d946e4cf8667e79327b06ca24bbaeae600681c5e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment