Rename project

This commit is contained in:
topjohnwu 2017-03-18 16:52:38 +08:00
parent 9f35fa0fa3
commit ca75dd0728
6 changed files with 33 additions and 31 deletions

View File

@ -1,7 +1,7 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := sepolicy-inject LOCAL_MODULE := magiskpolicy
LOCAL_STATIC_LIBRARIES := libsepol LOCAL_STATIC_LIBRARIES := libsepol
LOCAL_SRC_FILES := main.c sepolicy.c rules.c utils.c LOCAL_SRC_FILES := main.c sepolicy.c rules.c utils.c
LOCAL_C_INCLUDES := jni/selinux/libsepol/include/ LOCAL_C_INCLUDES := jni/selinux/libsepol/include/

View File

@ -1,5 +1,5 @@
#ifndef SEPOLICY_INJECT_H #ifndef MAGISKPOLICY_H
#define SEPOLICY_INJECT_H #define MAGISKPOLICY_H
#define ALL NULL #define ALL NULL

52
main.c
View File

@ -1,34 +1,36 @@
#include "sepolicy-inject.h" #include "magiskpolicy.h"
static int syntax_err = 0; static int syntax_err = 0;
static char err_msg[ARG_MAX]; static char err_msg[ARG_MAX];
static void statements() { static void statements() {
fprintf(stderr, "\nSupported policy statements:\n\n");
fprintf(stderr, "\"allow #source-class #target-class permission-class #permission\"\n");
fprintf(stderr, "\"deny #source-class #target-class permission-class #permission\"\n");
fprintf(stderr, "\"auditallow #source-class #target-class permission-class #permission\"\n");
fprintf(stderr, "\"auditdeny #source-class #target-class permission-class #permission\"\n");
fprintf(stderr, "\"create #class\"\n");
fprintf(stderr, "\"permissive #class\"\n");
fprintf(stderr, "\"enforcing #class\"\n");
fprintf(stderr, "\"attradd #class #attribute\"\n");
fprintf(stderr, "\"typetrans source-class target-class permission-class default-class (optional: object-name)\"\n");
fprintf(stderr, "\nsource-class and target-class can be attributes (patches the whole group)\n");
fprintf(stderr, "All sections (except typetrans) can be replaced with \'*\' to patch every possible matches\n");
fprintf(stderr, "Sections marked with \'#\' can be replaced with collections in curly brackets\n");
fprintf(stderr, "e.g: allow { source1 source2 } { target1 target2 } permission-class { permission1 permission2 }\n");
fprintf(stderr, "Will be expanded to:\n");
fprintf(stderr, fprintf(stderr,
"allow source1 target1 permission-class permission1\n\ "\nSupported policy statements:\n"
allow source1 target1 permission-class permission2\n\ "\n"
allow source1 target2 permission-class permission1\n\ "\"allow #source-class #target-class permission-class #permission\"\n"
allow source1 target2 permission-class permission2\n\ "\"deny #source-class #target-class permission-class #permission\"\n"
allow source2 target1 permission-class permission1\n\ "\"auditallow #source-class #target-class permission-class #permission\"\n"
allow source2 target1 permission-class permission2\n\ "\"auditdeny #source-class #target-class permission-class #permission\"\n"
allow source2 target2 permission-class permission1\n\ "\"create #class\"\n"
allow source2 target2 permission-class permission2\n"); "\"permissive #class\"\n"
fprintf(stderr, "\n"); "\"enforcing #class\"\n"
"\"attradd #class #attribute\"\n"
"\"typetrans source-class target-class permission-class default-class (optional: object-name)\"\n"
"\nsource-class and target-class can be attributes (patches the whole group)\n"
"All sections (except typetrans) can be replaced with \'*\' to patch every possible matches\n"
"Sections marked with \'#\' can be replaced with collections in curly brackets\n"
"e.g: allow { source1 source2 } { target1 target2 } permission-class { permission1 permission2 }\n"
"Will be expanded to:\n"
"allow source1 target1 permission-class permission1\n"
"allow source1 target1 permission-class permission2\n"
"allow source1 target2 permission-class permission1\n"
"allow source1 target2 permission-class permission2\n"
"allow source2 target1 permission-class permission1\n"
"allow source2 target1 permission-class permission2\n"
"allow source2 target2 permission-class permission1\n"
"allow source2 target2 permission-class permission2\n"
"\n"
);
} }
static void usage(char *arg0) { static void usage(char *arg0) {

View File

@ -1,4 +1,4 @@
#include "sepolicy-inject.h" #include "magiskpolicy.h"
void samsung() { void samsung() {
deny("init", "kernel", "security", "load_policy"); deny("init", "kernel", "security", "load_policy");

View File

@ -1,4 +1,4 @@
#include "sepolicy-inject.h" #include "magiskpolicy.h"
static void *cmalloc(size_t s) { static void *cmalloc(size_t s) {
void *t = malloc(s); void *t = malloc(s);

View File

@ -1,4 +1,4 @@
#include "sepolicy-inject.h" #include "magiskpolicy.h"
void vec_init(vector *v) { void vec_init(vector *v) {
v->size = 0; v->size = 0;