mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-03 07:01:53 +00:00
Convert indentation to spaces
The tab war is lost
This commit is contained in:
@@ -8,35 +8,35 @@
|
||||
|
||||
// Daemon command codes
|
||||
enum {
|
||||
START_DAEMON,
|
||||
SUPERUSER,
|
||||
CHECK_VERSION,
|
||||
CHECK_VERSION_CODE,
|
||||
POST_FS_DATA,
|
||||
LATE_START,
|
||||
BOOT_COMPLETE,
|
||||
MAGISKHIDE,
|
||||
SQLITE_CMD,
|
||||
REMOVE_MODULES,
|
||||
GET_PATH,
|
||||
DAEMON_CODE_END,
|
||||
START_DAEMON,
|
||||
SUPERUSER,
|
||||
CHECK_VERSION,
|
||||
CHECK_VERSION_CODE,
|
||||
POST_FS_DATA,
|
||||
LATE_START,
|
||||
BOOT_COMPLETE,
|
||||
MAGISKHIDE,
|
||||
SQLITE_CMD,
|
||||
REMOVE_MODULES,
|
||||
GET_PATH,
|
||||
DAEMON_CODE_END,
|
||||
};
|
||||
|
||||
// Return codes for daemon
|
||||
enum {
|
||||
DAEMON_ERROR = -1,
|
||||
DAEMON_SUCCESS = 0,
|
||||
ROOT_REQUIRED,
|
||||
DAEMON_LAST
|
||||
DAEMON_ERROR = -1,
|
||||
DAEMON_SUCCESS = 0,
|
||||
ROOT_REQUIRED,
|
||||
DAEMON_LAST
|
||||
};
|
||||
|
||||
// Daemon state
|
||||
enum {
|
||||
STATE_NONE,
|
||||
STATE_POST_FS_DATA,
|
||||
STATE_POST_FS_DATA_DONE,
|
||||
STATE_LATE_START_DONE,
|
||||
STATE_BOOT_COMPLETE
|
||||
STATE_NONE,
|
||||
STATE_POST_FS_DATA,
|
||||
STATE_POST_FS_DATA_DONE,
|
||||
STATE_LATE_START_DONE,
|
||||
STATE_BOOT_COMPLETE
|
||||
};
|
||||
|
||||
extern int SDK_INT;
|
||||
|
||||
@@ -9,25 +9,25 @@
|
||||
template <class T, size_t num>
|
||||
class db_data_base {
|
||||
public:
|
||||
T& operator [](std::string_view key) {
|
||||
return data[getKeyIdx(key)];
|
||||
}
|
||||
T& operator [](std::string_view key) {
|
||||
return data[getKeyIdx(key)];
|
||||
}
|
||||
|
||||
const T& operator [](std::string_view key) const {
|
||||
return data[getKeyIdx(key)];
|
||||
}
|
||||
const T& operator [](std::string_view key) const {
|
||||
return data[getKeyIdx(key)];
|
||||
}
|
||||
|
||||
T& operator [](int key) {
|
||||
return data[key];
|
||||
}
|
||||
T& operator [](int key) {
|
||||
return data[key];
|
||||
}
|
||||
|
||||
const T& operator [](int key) const {
|
||||
return data[key];
|
||||
}
|
||||
const T& operator [](int key) const {
|
||||
return data[key];
|
||||
}
|
||||
|
||||
protected:
|
||||
T data[num + 1];
|
||||
virtual int getKeyIdx(std::string_view key) const = 0;
|
||||
T data[num + 1];
|
||||
virtual int getKeyIdx(std::string_view key) const = 0;
|
||||
};
|
||||
|
||||
/***************
|
||||
@@ -46,40 +46,40 @@ protected:
|
||||
|
||||
// Settings keys
|
||||
enum {
|
||||
ROOT_ACCESS = 0,
|
||||
SU_MULTIUSER_MODE,
|
||||
SU_MNT_NS,
|
||||
HIDE_CONFIG
|
||||
ROOT_ACCESS = 0,
|
||||
SU_MULTIUSER_MODE,
|
||||
SU_MNT_NS,
|
||||
HIDE_CONFIG
|
||||
};
|
||||
|
||||
// Values for root_access
|
||||
enum {
|
||||
ROOT_ACCESS_DISABLED = 0,
|
||||
ROOT_ACCESS_APPS_ONLY,
|
||||
ROOT_ACCESS_ADB_ONLY,
|
||||
ROOT_ACCESS_APPS_AND_ADB
|
||||
ROOT_ACCESS_DISABLED = 0,
|
||||
ROOT_ACCESS_APPS_ONLY,
|
||||
ROOT_ACCESS_ADB_ONLY,
|
||||
ROOT_ACCESS_APPS_AND_ADB
|
||||
};
|
||||
|
||||
// Values for multiuser_mode
|
||||
enum {
|
||||
MULTIUSER_MODE_OWNER_ONLY = 0,
|
||||
MULTIUSER_MODE_OWNER_MANAGED,
|
||||
MULTIUSER_MODE_USER
|
||||
MULTIUSER_MODE_OWNER_ONLY = 0,
|
||||
MULTIUSER_MODE_OWNER_MANAGED,
|
||||
MULTIUSER_MODE_USER
|
||||
};
|
||||
|
||||
// Values for mnt_ns
|
||||
enum {
|
||||
NAMESPACE_MODE_GLOBAL = 0,
|
||||
NAMESPACE_MODE_REQUESTER,
|
||||
NAMESPACE_MODE_ISOLATE
|
||||
NAMESPACE_MODE_GLOBAL = 0,
|
||||
NAMESPACE_MODE_REQUESTER,
|
||||
NAMESPACE_MODE_ISOLATE
|
||||
};
|
||||
|
||||
class db_settings : public db_data_base<int, DB_SETTINGS_NUM> {
|
||||
public:
|
||||
db_settings();
|
||||
db_settings();
|
||||
|
||||
protected:
|
||||
int getKeyIdx(std::string_view key) const override;
|
||||
int getKeyIdx(std::string_view key) const override;
|
||||
};
|
||||
|
||||
/**************
|
||||
@@ -95,12 +95,12 @@ protected:
|
||||
|
||||
// Strings keys
|
||||
enum {
|
||||
SU_MANAGER = 0
|
||||
SU_MANAGER = 0
|
||||
};
|
||||
|
||||
class db_strings : public db_data_base<std::string, DB_STRING_NUM> {
|
||||
protected:
|
||||
int getKeyIdx(std::string_view key) const override;
|
||||
int getKeyIdx(std::string_view key) const override;
|
||||
};
|
||||
|
||||
/*************
|
||||
@@ -108,15 +108,15 @@ protected:
|
||||
*************/
|
||||
|
||||
typedef enum {
|
||||
QUERY = 0,
|
||||
DENY = 1,
|
||||
ALLOW = 2,
|
||||
QUERY = 0,
|
||||
DENY = 1,
|
||||
ALLOW = 2,
|
||||
} policy_t;
|
||||
|
||||
struct su_access {
|
||||
policy_t policy;
|
||||
int log;
|
||||
int notify;
|
||||
policy_t policy;
|
||||
int log;
|
||||
int notify;
|
||||
};
|
||||
|
||||
#define DEFAULT_SU_ACCESS (su_access) { \
|
||||
|
||||
@@ -9,52 +9,52 @@ struct policydb;
|
||||
|
||||
class sepolicy {
|
||||
public:
|
||||
typedef const char * c_str;
|
||||
~sepolicy();
|
||||
typedef const char * c_str;
|
||||
~sepolicy();
|
||||
|
||||
// Public static factory functions
|
||||
static sepolicy *from_file(c_str file);
|
||||
static sepolicy *from_split();
|
||||
static sepolicy *compile_split();
|
||||
// Public static factory functions
|
||||
static sepolicy *from_file(c_str file);
|
||||
static sepolicy *from_split();
|
||||
static sepolicy *compile_split();
|
||||
|
||||
// External APIs
|
||||
bool to_file(c_str file);
|
||||
void parse_statement(c_str stmt);
|
||||
void load_rule_file(c_str file);
|
||||
// External APIs
|
||||
bool to_file(c_str file);
|
||||
void parse_statement(c_str stmt);
|
||||
void load_rule_file(c_str file);
|
||||
|
||||
// Operation on types
|
||||
bool type(c_str name, c_str attr);
|
||||
bool attribute(c_str name);
|
||||
bool permissive(c_str type);
|
||||
bool enforce(c_str type);
|
||||
bool typeattribute(c_str type, c_str attr);
|
||||
bool exists(c_str type);
|
||||
// Operation on types
|
||||
bool type(c_str name, c_str attr);
|
||||
bool attribute(c_str name);
|
||||
bool permissive(c_str type);
|
||||
bool enforce(c_str type);
|
||||
bool typeattribute(c_str type, c_str attr);
|
||||
bool exists(c_str type);
|
||||
|
||||
// Access vector rules
|
||||
bool allow(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
bool deny(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
bool auditallow(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
bool dontaudit(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
// Access vector rules
|
||||
bool allow(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
bool deny(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
bool auditallow(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
bool dontaudit(c_str src, c_str tgt, c_str cls, c_str perm);
|
||||
|
||||
// Extended permissions access vector rules
|
||||
bool allowxperm(c_str src, c_str tgt, c_str cls, c_str range);
|
||||
bool auditallowxperm(c_str src, c_str tgt, c_str cls, c_str range);
|
||||
bool dontauditxperm(c_str src, c_str tgt, c_str cls, c_str range);
|
||||
// Extended permissions access vector rules
|
||||
bool allowxperm(c_str src, c_str tgt, c_str cls, c_str range);
|
||||
bool auditallowxperm(c_str src, c_str tgt, c_str cls, c_str range);
|
||||
bool dontauditxperm(c_str src, c_str tgt, c_str cls, c_str range);
|
||||
|
||||
// Type rules
|
||||
bool type_transition(c_str src, c_str tgt, c_str cls, c_str def, c_str obj = nullptr);
|
||||
bool type_change(c_str src, c_str tgt, c_str cls, c_str def);
|
||||
bool type_member(c_str src, c_str tgt, c_str cls, c_str def);
|
||||
// Type rules
|
||||
bool type_transition(c_str src, c_str tgt, c_str cls, c_str def, c_str obj = nullptr);
|
||||
bool type_change(c_str src, c_str tgt, c_str cls, c_str def);
|
||||
bool type_member(c_str src, c_str tgt, c_str cls, c_str def);
|
||||
|
||||
// File system labeling
|
||||
bool genfscon(c_str fs_name, c_str path, c_str ctx);
|
||||
// File system labeling
|
||||
bool genfscon(c_str fs_name, c_str path, c_str ctx);
|
||||
|
||||
// Magisk
|
||||
void magisk_rules();
|
||||
// Magisk
|
||||
void magisk_rules();
|
||||
|
||||
// Deprecate
|
||||
bool create(c_str name) { return type(name, "domain"); }
|
||||
// Deprecate
|
||||
bool create(c_str name) { return type(name, "domain"); }
|
||||
|
||||
protected:
|
||||
policydb *db;
|
||||
policydb *db;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
int setprop(const char *name, const char *value, bool prop_svc = true);
|
||||
std::string getprop(const char *name, bool persist = false);
|
||||
void getprops(void (*callback)(const char *, const char *, void *),
|
||||
void *cookie = nullptr, bool persist = false);
|
||||
void *cookie = nullptr, bool persist = false);
|
||||
int delprop(const char *name, bool persist = false);
|
||||
void load_prop_file(const char *filename, bool prop_svc = true);
|
||||
|
||||
Reference in New Issue
Block a user