diff --git a/Android.mk b/Android.mk index a72ed6db5..67f231b38 100644 --- a/Android.mk +++ b/Android.mk @@ -5,6 +5,6 @@ LOCAL_MODULE := su LOCAL_MODULE_TAGS := eng debug optional LOCAL_STATIC_LIBRARIES := libselinux 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 include $(BUILD_EXECUTABLE) diff --git a/hacks.c b/hacks.c deleted file mode 100644 index cbb5c6d08..000000000 --- a/hacks.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include -#include -#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; - } - } -} diff --git a/su.c b/su.c index 0c72b3c93..1b963dc89 100644 --- a/su.c +++ b/su.c @@ -479,8 +479,6 @@ static __attribute__ ((noreturn)) void allow(struct su_context *ctx) { char *arg0; int argc, err; - hacks_update_context(ctx); - umask(ctx->umask); int send_to_app = 1; @@ -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), (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); } else { setexeccon("u:r:su:s0"); @@ -803,8 +801,6 @@ int su_main_nodaemon(int argc, char **argv) { deny(&ctx); } - - hacks_init(); read_options(&ctx); user_init(&ctx); diff --git a/su.h b/su.h index 9a8e3fa74..bdbd423bb 100644 --- a/su.h +++ b/su.h @@ -179,9 +179,6 @@ int su_main_nodaemon(int argc, char *argv[]); // deadbeat dad fork. int fork_zero_fucks(); -void hacks_init(); -void hacks_update_context(struct su_context* ctxt); - // fallback to using /system/bin/log. // can't use liblog.so because this is a static binary. #ifndef LOGE