Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
17164522
Commit
17164522
authored
Jan 27, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add prop checks for root access management
parent
54827cac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
7 deletions
+33
-7
su.c
su.c
+27
-1
su.h
su.h
+6
-6
No files found.
su.c
View file @
17164522
...
...
@@ -39,6 +39,7 @@
#include <selinux/selinux.h>
#include <arpa/inet.h>
#include <sys/auxv.h>
#include <sys/system_properties.h>
#include "su.h"
#include "utils.h"
...
...
@@ -754,7 +755,6 @@ int su_main_nodaemon(int argc, char **argv) {
usage
(
2
);
}
}
hacks_init
();
if
(
optind
<
argc
&&
!
strcmp
(
argv
[
optind
],
"-"
))
{
ctx
.
to
.
login
=
1
;
optind
++
;
...
...
@@ -789,6 +789,8 @@ int su_main_nodaemon(int argc, char **argv) {
deny
(
&
ctx
);
}
hacks_init
();
read_options
(
&
ctx
);
user_init
(
&
ctx
);
...
...
@@ -825,6 +827,30 @@ int su_main_nodaemon(int argc, char **argv) {
deny
(
&
ctx
);
}
// Add prop check
char
value
[
PROP_VALUE_MAX
];
__system_property_get
(
ROOT_ACCESS_PROP
,
value
);
if
(
strlen
(
value
))
{
int
prop_status
=
atoi
(
value
);
switch
(
prop_status
)
{
case
ROOT_ACCESS_DISABLED
:
exit
(
EXIT_FAILURE
);
case
ROOT_ACCESS_APPS_ONLY
:
if
(
ctx
.
from
.
uid
==
AID_SHELL
)
exit
(
EXIT_FAILURE
);
break
;
case
ROOT_ACCESS_ADB_ONLY
:
if
(
ctx
.
from
.
uid
!=
AID_SHELL
)
exit
(
EXIT_FAILURE
);
break
;
case
ROOT_ACCESS_APPS_AND_ADB
:
default:
break
;
}
}
else
{
exit
(
EXIT_FAILURE
);
}
ctx
.
umask
=
umask
(
027
);
mkdir
(
REQUESTOR_CACHE_PATH
,
0770
);
...
...
su.h
View file @
17164522
...
...
@@ -39,11 +39,11 @@
#define AID_RADIO (get_radio_uid())
#endif
// CyanogenMod-specific behavior
#define
CM_
ROOT_ACCESS_DISABLED 0
#define
CM_
ROOT_ACCESS_APPS_ONLY 1
#define
CM_
ROOT_ACCESS_ADB_ONLY 2
#define
CM_
ROOT_ACCESS_APPS_AND_ADB 3
#define ROOT_ACCESS_PROP "persist.sys.root_access"
#define ROOT_ACCESS_DISABLED 0
#define ROOT_ACCESS_APPS_ONLY 1
#define ROOT_ACCESS_ADB_ONLY 2
#define ROOT_ACCESS_APPS_AND_ADB 3
// DO NOT CHANGE LINE BELOW, java package name will always be the same
#define JAVA_PACKAGE_NAME "com.topjohnwu.magisk"
...
...
@@ -76,7 +76,7 @@
#define str(a) #a
#ifndef VERSION_CODE
#define VERSION_CODE
1
#define VERSION_CODE
6
#endif
#define VERSION "MAGISKSU:" xstr(VERSION_CODE)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment