Update su to match Linux's implementation

This commit is contained in:
topjohnwu 2017-12-18 15:46:18 +08:00
parent 4db0ad32f0
commit d0567d29d2
3 changed files with 7 additions and 6 deletions

View File

@ -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) {
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) {
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);

View File

@ -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);
* Superuser * * Superuser *
*************/ *************/
void su_daemon_receiver(int client); void su_daemon_receiver(int client, struct ucred *credential);
#endif #endif

@ -1 +1 @@
Subproject commit 8b15e42253091a28c33a5e5e827d7750576d54dd Subproject commit d946e4cf8667e79327b06ca24bbaeae600681c5e