From ca75dd07283ff5fb9fec32f106ba8c58642742a0 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 18 Mar 2017 16:52:38 +0800 Subject: [PATCH] Rename project --- Android.mk | 2 +- sepolicy-inject.h => magiskpolicy.h | 4 +-- main.c | 52 +++++++++++++++-------------- rules.c | 2 +- sepolicy.c | 2 +- utils.c | 2 +- 6 files changed, 33 insertions(+), 31 deletions(-) rename sepolicy-inject.h => magiskpolicy.h (97%) diff --git a/Android.mk b/Android.mk index e6065b6d1..d35a32f89 100644 --- a/Android.mk +++ b/Android.mk @@ -1,7 +1,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := sepolicy-inject +LOCAL_MODULE := magiskpolicy LOCAL_STATIC_LIBRARIES := libsepol LOCAL_SRC_FILES := main.c sepolicy.c rules.c utils.c LOCAL_C_INCLUDES := jni/selinux/libsepol/include/ diff --git a/sepolicy-inject.h b/magiskpolicy.h similarity index 97% rename from sepolicy-inject.h rename to magiskpolicy.h index f0c2ba00a..32e92f4e0 100644 --- a/sepolicy-inject.h +++ b/magiskpolicy.h @@ -1,5 +1,5 @@ -#ifndef SEPOLICY_INJECT_H -#define SEPOLICY_INJECT_H +#ifndef MAGISKPOLICY_H +#define MAGISKPOLICY_H #define ALL NULL diff --git a/main.c b/main.c index 19b488fe3..814d65b46 100644 --- a/main.c +++ b/main.c @@ -1,34 +1,36 @@ -#include "sepolicy-inject.h" +#include "magiskpolicy.h" static int syntax_err = 0; static char err_msg[ARG_MAX]; 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, -"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"); - fprintf(stderr, "\n"); + "\nSupported policy statements:\n" + "\n" + "\"allow #source-class #target-class permission-class #permission\"\n" + "\"deny #source-class #target-class permission-class #permission\"\n" + "\"auditallow #source-class #target-class permission-class #permission\"\n" + "\"auditdeny #source-class #target-class permission-class #permission\"\n" + "\"create #class\"\n" + "\"permissive #class\"\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) { diff --git a/rules.c b/rules.c index 2ae8a5b2a..220c7e9a0 100644 --- a/rules.c +++ b/rules.c @@ -1,4 +1,4 @@ -#include "sepolicy-inject.h" +#include "magiskpolicy.h" void samsung() { deny("init", "kernel", "security", "load_policy"); diff --git a/sepolicy.c b/sepolicy.c index 246aca401..a5bfc9975 100644 --- a/sepolicy.c +++ b/sepolicy.c @@ -1,4 +1,4 @@ -#include "sepolicy-inject.h" +#include "magiskpolicy.h" static void *cmalloc(size_t s) { void *t = malloc(s); diff --git a/utils.c b/utils.c index e5e740000..51f9c11f3 100644 --- a/utils.c +++ b/utils.c @@ -1,4 +1,4 @@ -#include "sepolicy-inject.h" +#include "magiskpolicy.h" void vec_init(vector *v) { v->size = 0;