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
41b01003
Commit
41b01003
authored
Oct 20, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always ACK before doing anything
parent
6557070a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
su.c
native/jni/su/su.c
+7
-7
su_daemon.c
native/jni/su/su_daemon.c
+6
-4
No files found.
native/jni/su/su.c
View file @
41b01003
...
...
@@ -192,6 +192,13 @@ int su_client_main(int argc, char *argv[]) {
// Tell the daemon we are su
write_int
(
fd
,
SUPERUSER
);
// Wait for ack from daemon
if
(
read_int
(
fd
))
{
// Fast fail
fprintf
(
stderr
,
"%s
\n
"
,
strerror
(
EACCES
));
return
DENY
;
}
// Send su_request
xwrite
(
fd
,
&
su_req
,
4
*
sizeof
(
unsigned
));
write_string
(
fd
,
su_req
.
shell
);
...
...
@@ -220,13 +227,6 @@ int su_client_main(int argc, char *argv[]) {
// Send stderr
send_fd
(
fd
,
(
atty
&
ATTY_ERR
)
?
-
1
:
STDERR_FILENO
);
// Wait for ack from daemon
if
(
read_int
(
fd
))
{
// Fast fail
fprintf
(
stderr
,
"%s
\n
"
,
strerror
(
EACCES
));
return
DENY
;
}
if
(
atty
&
ATTY_IN
)
{
setup_sighandlers
(
sighandler
);
pump_stdin_async
(
ptmx
);
...
...
native/jni/su/su_daemon.c
View file @
41b01003
...
...
@@ -227,8 +227,10 @@ void su_daemon_handler(int client, struct ucred *credential) {
struct
su_info
*
info
=
get_su_info
(
credential
->
uid
);
// Fail fast
if
(
info
->
access
.
policy
==
DENY
&&
!
info
->
access
.
log
&&
!
info
->
access
.
notify
)
{
if
(
info
->
access
.
policy
==
DENY
&&
DB_STR
(
info
,
SU_MANAGER
)[
0
]
==
'\0'
)
{
LOGD
(
"su: fast deny
\n
"
);
write_int
(
client
,
DENY
);
close
(
client
);
return
;
}
...
...
@@ -264,6 +266,9 @@ void su_daemon_handler(int client, struct ucred *credential) {
.
pid
=
credential
->
pid
};
// ack
write_int
(
client
,
0
);
// Become session leader
xsetsid
();
...
...
@@ -334,9 +339,6 @@ void su_daemon_handler(int client, struct ucred *credential) {
xdup2
(
errfd
,
STDERR_FILENO
);
close
(
ptsfd
);
// ack and close
write_int
(
client
,
0
);
close
(
client
);
// Handle namespaces
...
...
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