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
fe3c66a7
Commit
fe3c66a7
authored
Jan 30, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No need to hack anything...
parent
1d728475
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
58 deletions
+2
-58
Android.mk
Android.mk
+1
-1
hacks.c
hacks.c
+0
-49
su.c
su.c
+1
-5
su.h
su.h
+0
-3
No files found.
Android.mk
View file @
fe3c66a7
...
@@ -5,6 +5,6 @@ LOCAL_MODULE := su
...
@@ -5,6 +5,6 @@ LOCAL_MODULE := su
LOCAL_MODULE_TAGS := eng debug optional
LOCAL_MODULE_TAGS := eng debug optional
LOCAL_STATIC_LIBRARIES := libselinux
LOCAL_STATIC_LIBRARIES := libselinux
LOCAL_C_INCLUDES := jni/selinux/libselinux/include/ jni/selinux/libsepol/include/ jni/su/sqlite3/
LOCAL_C_INCLUDES := jni/selinux/libselinux/include/ jni/selinux/libsepol/include/ jni/su/sqlite3/
LOCAL_SRC_FILES := su.c daemon.c activity.c db.c utils.c pts.c
hacks.c
sqlite3/sqlite3.c
LOCAL_SRC_FILES := su.c daemon.c activity.c db.c utils.c pts.c sqlite3/sqlite3.c
LOCAL_CFLAGS := -DSQLITE_OMIT_LOAD_EXTENSION -std=gnu11
LOCAL_CFLAGS := -DSQLITE_OMIT_LOAD_EXTENSION -std=gnu11
include $(BUILD_EXECUTABLE)
include $(BUILD_EXECUTABLE)
hacks.c
deleted
100644 → 0
View file @
1d728475
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "su.h"
#include "utils.h"
enum
{
H_NO_CONTEXT
=
0x0001
,
};
static
struct
{
const
char
*
package
;
int
flags
;
int
uid
;
}
apps_list
[]
=
{
{
"com.keramidas.TitaniumBackup"
,
H_NO_CONTEXT
,
},
};
void
hacks_init
()
{
char
oldCwd
[
512
];
int
i
;
getcwd
(
oldCwd
,
sizeof
(
oldCwd
));
chdir
(
"/data/data"
);
for
(
i
=
0
;
i
<
(
sizeof
(
apps_list
)
/
sizeof
(
apps_list
[
0
]));
++
i
)
{
apps_list
[
i
].
uid
=
-
1
;
struct
stat
st_buf
;
int
ret
=
stat
(
apps_list
[
i
].
package
,
&
st_buf
);
LOGW
(
"hacks: Testing (%s:%d:%d)"
,
apps_list
[
i
].
package
,
ret
,
st_buf
.
st_uid
);
if
(
ret
)
continue
;
apps_list
[
i
].
uid
=
st_buf
.
st_uid
;
}
}
void
hacks_update_context
(
struct
su_context
*
ctxt
)
{
int
i
;
for
(
i
=
0
;
i
<
(
sizeof
(
apps_list
)
/
sizeof
(
apps_list
[
0
]));
++
i
)
{
LOGW
(
"hacks: Testing (%s:%d), %d"
,
apps_list
[
i
].
package
,
ctxt
->
from
.
uid
);
if
(
apps_list
[
i
].
uid
!=
ctxt
->
from
.
uid
)
continue
;
LOGW
(
"hacks: Found app (%s:%d)"
,
apps_list
[
i
].
package
,
ctxt
->
from
.
uid
);
if
(
apps_list
[
i
].
flags
&
H_NO_CONTEXT
)
{
LOGW
(
"hacks: Disabling context (%s:%d)"
,
apps_list
[
i
].
package
,
ctxt
->
from
.
uid
);
ctxt
->
to
.
context
=
NULL
;
}
}
}
su.c
View file @
fe3c66a7
...
@@ -479,8 +479,6 @@ static __attribute__ ((noreturn)) void allow(struct su_context *ctx) {
...
@@ -479,8 +479,6 @@ static __attribute__ ((noreturn)) void allow(struct su_context *ctx) {
char
*
arg0
;
char
*
arg0
;
int
argc
,
err
;
int
argc
,
err
;
hacks_update_context
(
ctx
);
umask
(
ctx
->
umask
);
umask
(
ctx
->
umask
);
int
send_to_app
=
1
;
int
send_to_app
=
1
;
...
@@ -541,7 +539,7 @@ static __attribute__ ((noreturn)) void allow(struct su_context *ctx) {
...
@@ -541,7 +539,7 @@ static __attribute__ ((noreturn)) void allow(struct su_context *ctx) {
arg0
,
PARG
(
0
),
PARG
(
1
),
PARG
(
2
),
PARG
(
3
),
PARG
(
4
),
PARG
(
5
),
arg0
,
PARG
(
0
),
PARG
(
1
),
PARG
(
2
),
PARG
(
3
),
PARG
(
4
),
PARG
(
5
),
(
ctx
->
to
.
optind
+
6
<
ctx
->
to
.
argc
)
?
" ..."
:
""
);
(
ctx
->
to
.
optind
+
6
<
ctx
->
to
.
argc
)
?
" ..."
:
""
);
if
(
ctx
->
to
.
context
&&
strcmp
(
ctx
->
to
.
context
,
"u:r:su_light:s0"
)
==
0
)
{
if
(
ctx
->
to
.
context
)
{
setexeccon
(
ctx
->
to
.
context
);
setexeccon
(
ctx
->
to
.
context
);
}
else
{
}
else
{
setexeccon
(
"u:r:su:s0"
);
setexeccon
(
"u:r:su:s0"
);
...
@@ -803,8 +801,6 @@ int su_main_nodaemon(int argc, char **argv) {
...
@@ -803,8 +801,6 @@ int su_main_nodaemon(int argc, char **argv) {
deny
(
&
ctx
);
deny
(
&
ctx
);
}
}
hacks_init
();
read_options
(
&
ctx
);
read_options
(
&
ctx
);
user_init
(
&
ctx
);
user_init
(
&
ctx
);
...
...
su.h
View file @
fe3c66a7
...
@@ -179,9 +179,6 @@ int su_main_nodaemon(int argc, char *argv[]);
...
@@ -179,9 +179,6 @@ int su_main_nodaemon(int argc, char *argv[]);
// deadbeat dad fork.
// deadbeat dad fork.
int
fork_zero_fucks
();
int
fork_zero_fucks
();
void
hacks_init
();
void
hacks_update_context
(
struct
su_context
*
ctxt
);
// fallback to using /system/bin/log.
// fallback to using /system/bin/log.
// can't use liblog.so because this is a static binary.
// can't use liblog.so because this is a static binary.
#ifndef LOGE
#ifndef LOGE
...
...
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