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
222c31b3
Commit
222c31b3
authored
Apr 16, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix checking order
parent
743c4f55
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
su.c
su.c
+29
-29
No files found.
su.c
View file @
222c31b3
...
@@ -311,30 +311,6 @@ int su_daemon_main(int argc, char **argv) {
...
@@ -311,30 +311,6 @@ int su_daemon_main(int argc, char **argv) {
optind
++
;
optind
++
;
}
}
// Check property of root configuration
char
*
root_prop
=
getprop
(
ROOT_ACCESS_PROP
);
if
(
root_prop
)
{
int
prop_status
=
atoi
(
root_prop
);
switch
(
prop_status
)
{
case
ROOT_ACCESS_DISABLED
:
exit
(
EXIT_FAILURE
);
case
ROOT_ACCESS_APPS_ONLY
:
if
(
ctx
.
from
.
uid
==
UID_SHELL
)
exit
(
EXIT_FAILURE
);
break
;
case
ROOT_ACCESS_ADB_ONLY
:
if
(
ctx
.
from
.
uid
!=
UID_SHELL
)
exit
(
EXIT_FAILURE
);
break
;
case
ROOT_ACCESS_APPS_AND_ADB
:
default:
break
;
}
}
else
{
exit
(
EXIT_FAILURE
);
}
free
(
root_prop
);
// The su_context setup is done, now every error leads to deny
// The su_context setup is done, now every error leads to deny
err_handler
=
deny
;
err_handler
=
deny
;
...
@@ -349,11 +325,6 @@ int su_daemon_main(int argc, char **argv) {
...
@@ -349,11 +325,6 @@ int su_daemon_main(int argc, char **argv) {
}
}
}
}
// Allow root to start root
if
(
ctx
.
from
.
uid
==
UID_ROOT
)
{
allow
();
}
// verify superuser is installed
// verify superuser is installed
xstat
(
ctx
.
user
.
base_path
,
&
st
);
xstat
(
ctx
.
user
.
base_path
,
&
st
);
...
@@ -370,6 +341,35 @@ int su_daemon_main(int argc, char **argv) {
...
@@ -370,6 +341,35 @@ int su_daemon_main(int argc, char **argv) {
allow
();
allow
();
}
}
// Check property of root configuration
char
*
root_prop
=
getprop
(
ROOT_ACCESS_PROP
);
if
(
root_prop
)
{
int
prop_status
=
atoi
(
root_prop
);
switch
(
prop_status
)
{
case
ROOT_ACCESS_DISABLED
:
exit
(
EXIT_FAILURE
);
case
ROOT_ACCESS_APPS_ONLY
:
if
(
ctx
.
from
.
uid
==
UID_SHELL
)
exit
(
EXIT_FAILURE
);
break
;
case
ROOT_ACCESS_ADB_ONLY
:
if
(
ctx
.
from
.
uid
!=
UID_SHELL
)
exit
(
EXIT_FAILURE
);
break
;
case
ROOT_ACCESS_APPS_AND_ADB
:
default:
break
;
}
}
else
{
exit
(
EXIT_FAILURE
);
}
free
(
root_prop
);
// Allow root to start root
if
(
ctx
.
from
.
uid
==
UID_ROOT
)
{
allow
();
}
// deny if this is a non owner request and owner mode only
// deny if this is a non owner request and owner mode only
if
(
ctx
.
user
.
multiuser_mode
==
MULTIUSER_MODE_OWNER_ONLY
&&
ctx
.
user
.
android_user_id
!=
0
)
{
if
(
ctx
.
user
.
multiuser_mode
==
MULTIUSER_MODE_OWNER_ONLY
&&
ctx
.
user
.
android_user_id
!=
0
)
{
deny
();
deny
();
...
...
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