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
bb5a6a1c
Commit
bb5a6a1c
authored
Sep 13, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-organize folders
parent
b614b067
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
48 additions
and
2899 deletions
+48
-2899
.gitmodules
.gitmodules
+3
-3
Android.mk
jni/Android.mk
+24
-24
Android.mk
jni/external/Android.mk
+13
-2
busybox
jni/external/busybox
+0
-0
ndk-compression
jni/external/ndk-compression
+0
-0
selinux
jni/external/selinux
+0
-0
av_permissions.h
jni/external/selinux/av_permissions.h
+0
-1029
avc.h
jni/external/selinux/avc.h
+0
-511
context.h
jni/external/selinux/context.h
+0
-50
flask.h
jni/external/selinux/flask.h
+0
-118
get_context_list.h
jni/external/selinux/get_context_list.h
+0
-82
get_default_type.h
jni/external/selinux/get_default_type.h
+0
-23
label.h
jni/external/selinux/label.h
+0
-190
restorecon.h
jni/external/selinux/restorecon.h
+0
-187
selinux.h
jni/external/selinux/selinux.h
+0
-673
selinux_stub.c
jni/external/stubs/selinux_stub.c
+8
-7
sqlite3_stub.c
jni/external/stubs/sqlite3_stub.c
+0
-0
No files found.
.gitmodules
View file @
bb5a6a1c
[submodule "jni/selinux"]
[submodule "jni/selinux"]
path = jni/selinux
path = jni/
external/
selinux
url = https://github.com/topjohnwu/selinux.git
url = https://github.com/topjohnwu/selinux.git
[submodule "jni/su"]
[submodule "jni/su"]
path = jni/su
path = jni/su
url = https://github.com/topjohnwu/MagiskSU.git
url = https://github.com/topjohnwu/MagiskSU.git
[submodule "jni/ndk-compression"]
[submodule "jni/ndk-compression"]
path = jni/ndk-compression
path = jni/
external/
ndk-compression
url = https://github.com/topjohnwu/ndk-compression.git
url = https://github.com/topjohnwu/ndk-compression.git
[submodule "jni/magiskpolicy"]
[submodule "jni/magiskpolicy"]
path = jni/magiskpolicy
path = jni/magiskpolicy
...
@@ -14,5 +14,5 @@
...
@@ -14,5 +14,5 @@
path = MagiskManager
path = MagiskManager
url = https://github.com/topjohnwu/MagiskManager.git
url = https://github.com/topjohnwu/MagiskManager.git
[submodule "jni/busybox"]
[submodule "jni/busybox"]
path = jni/busybox
path = jni/
external/
busybox
url = https://github.com/topjohnwu/ndk-busybox.git
url = https://github.com/topjohnwu/ndk-busybox.git
jni/Android.mk
View file @
bb5a6a1c
LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)
# Some handy paths
JNI_ROOT := jni
SELINUX_PATH := jni/external/selinux
COMPRESS_LIB := jni/external/ndk-compression
LIBSELINUX := $(SELINUX_PATH)/libselinux/include
LIBSEPOL := $(SELINUX_PATH)/libsepol/include $(SELINUX_PATH)/libsepol/cil/include
LIBZ := $(COMPRESS_LIB)/zlib
LIBLZMA := $(COMPRESS_LIB)/xz/src/liblzma/api
LIBLZ4 := $(COMPRESS_LIB)/lz4/lib
LIBBZ2 := $(COMPRESS_LIB)/bzip2
########################
########################
# Binaries
# Binaries
########################
########################
...
@@ -11,10 +22,10 @@ LOCAL_STATIC_LIBRARIES := libsepol
...
@@ -11,10 +22,10 @@ LOCAL_STATIC_LIBRARIES := libsepol
LOCAL_SHARED_LIBRARIES := libsqlite libselinux
LOCAL_SHARED_LIBRARIES := libsqlite libselinux
LOCAL_C_INCLUDES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)
/include \
jni
/include \
$(LOCAL_PATH)
/external \
jni
/external \
$(L
OCAL_PATH)/selinux/libsepol/include
\
$(L
IBSELINUX)
\
$(L
OCAL_PATH)/selinux/libsepol/cil/include
$(L
IBSEPOL)
LOCAL_SRC_FILES := \
LOCAL_SRC_FILES := \
daemon/magisk.c \
daemon/magisk.c \
...
@@ -55,12 +66,12 @@ include $(CLEAR_VARS)
...
@@ -55,12 +66,12 @@ include $(CLEAR_VARS)
LOCAL_MODULE := magiskboot
LOCAL_MODULE := magiskboot
LOCAL_STATIC_LIBRARIES := libz liblzma liblz4 libbz2
LOCAL_STATIC_LIBRARIES := libz liblzma liblz4 libbz2
LOCAL_C_INCLUDES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)
/magiskboot \
jni
/magiskboot \
$(LOCAL_PATH)
/include \
jni
/include \
$(L
OCAL_PATH)/ndk-compression/zlib
\
$(L
IBZ)
\
$(L
OCAL_PATH)/ndk-compression/xz/src/liblzma/api
\
$(L
IBLZMA)
\
$(L
OCAL_PATH)/ndk-compression/lz4/lib
\
$(L
IBLZ4)
\
$(L
OCAL_PATH)/ndk-compression/bzip2
$(L
IBBZ2)
LOCAL_SRC_FILES := \
LOCAL_SRC_FILES := \
magiskboot/main.c \
magiskboot/main.c \
...
@@ -92,27 +103,16 @@ ifneq ($(TARGET_ARCH_ABI), arm64-v8a)
...
@@ -92,27 +103,16 @@ ifneq ($(TARGET_ARCH_ABI), arm64-v8a)
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_MODULE := b64xz
LOCAL_MODULE := b64xz
LOCAL_STATIC_LIBRARIES := liblzma
LOCAL_STATIC_LIBRARIES := liblzma
LOCAL_C_INCLUDES := $(L
OCAL_PATH)/ndk-compression/xz/src/liblzma/api
LOCAL_C_INCLUDES := $(L
IBLZMA)
LOCAL_SRC_FILES := b64xz.c
LOCAL_SRC_FILES := b64xz.c
LOCAL_LDFLAGS := -static
LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE)
include $(BUILD_EXECUTABLE)
# Busybox
# Busybox
include jni/busybox/Android.mk
include jni/
external/
busybox/Android.mk
endif
endif
endif
endif
########################
########################
#
Librarie
s
#
External
s
########################
########################
# External shared libraries, include stub libselinux and libsqlite
include jni/external/Android.mk
include jni/external/Android.mk
# libsepol, static library
include jni/selinux/libsepol/Android.mk
# Compression libraries for magiskboot
include jni/ndk-compression/zlib/Android.mk
include jni/ndk-compression/xz/src/liblzma/Android.mk
include jni/ndk-compression/lz4/lib/Android.mk
include jni/ndk-compression/bzip2/Android.mk
jni/external/Android.mk
View file @
bb5a6a1c
LOCAL_PATH:= $(call my-dir)
LOCAL_PATH:= $(call my-dir)
EXTERNAL := $(LOCAL_PATH)
# libsqlite.so (stub)
# libsqlite.so (stub)
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_MODULE:= libsqlite
LOCAL_MODULE:= libsqlite
LOCAL_SRC_FILES := sqlite3_stub.c
LOCAL_SRC_FILES := s
tubs/s
qlite3_stub.c
include $(BUILD_SHARED_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
# libselinux.so (stub)
# libselinux.so (stub)
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_MODULE:= libselinux
LOCAL_MODULE:= libselinux
LOCAL_SRC_FILES := selinux_stub.c
LOCAL_C_INCLUDES := $(LIBSELINUX)
LOCAL_SRC_FILES := stubs/selinux_stub.c
include $(BUILD_SHARED_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
# libsepol, static library
include $(SELINUX_PATH)/libsepol/Android.mk
# Compression libraries for magiskboot
include $(COMPRESS_LIB)/zlib/Android.mk
include $(COMPRESS_LIB)/xz/src/liblzma/Android.mk
include $(COMPRESS_LIB)/lz4/lib/Android.mk
include $(COMPRESS_LIB)/bzip2/Android.mk
busybox
@
90c9c4fd
File moved
ndk-compression
@
b5cefe45
File moved
selinux
@
2fefdfc4
File moved
jni/external/selinux/av_permissions.h
deleted
100644 → 0
View file @
b614b067
This diff is collapsed.
Click to expand it.
jni/external/selinux/avc.h
deleted
100644 → 0
View file @
b614b067
This diff is collapsed.
Click to expand it.
jni/external/selinux/context.h
deleted
100644 → 0
View file @
b614b067
#ifndef _SELINUX_CONTEXT_H_
#define _SELINUX_CONTEXT_H_
#ifdef __cplusplus
extern
"C"
{
#endif
/*
* Functions to deal with security contexts in user space.
*/
typedef
struct
{
void
*
ptr
;
}
context_s_t
;
typedef
context_s_t
*
context_t
;
/* Return a new context initialized to a context string */
extern
context_t
context_new
(
const
char
*
);
/*
* Return a pointer to the string value of the context_t
* Valid until the next call to context_str or context_free
* for the same context_t*
*/
extern
char
*
context_str
(
context_t
);
/* Free the storage used by a context */
extern
void
context_free
(
context_t
);
/* Get a pointer to the string value of a context component */
extern
const
char
*
context_type_get
(
context_t
);
extern
const
char
*
context_range_get
(
context_t
);
extern
const
char
*
context_role_get
(
context_t
);
extern
const
char
*
context_user_get
(
context_t
);
/* Set a context component. Returns nonzero if unsuccessful */
extern
int
context_type_set
(
context_t
,
const
char
*
);
extern
int
context_range_set
(
context_t
,
const
char
*
);
extern
int
context_role_set
(
context_t
,
const
char
*
);
extern
int
context_user_set
(
context_t
,
const
char
*
);
#ifdef __cplusplus
}
#endif
#endif
jni/external/selinux/flask.h
deleted
100644 → 0
View file @
b614b067
/* This file is automatically generated. Do not edit. */
#ifndef _SELINUX_FLASK_H_
#define _SELINUX_FLASK_H_
#warning "Please remove any #include's of this header in your source code."
#warning "Instead, use string_to_security_class() to map the class name to a value."
/*
* Security object class definitions
*/
#define SECCLASS_SECURITY 1
#define SECCLASS_PROCESS 2
#define SECCLASS_SYSTEM 3
#define SECCLASS_CAPABILITY 4
#define SECCLASS_FILESYSTEM 5
#define SECCLASS_FILE 6
#define SECCLASS_DIR 7
#define SECCLASS_FD 8
#define SECCLASS_LNK_FILE 9
#define SECCLASS_CHR_FILE 10
#define SECCLASS_BLK_FILE 11
#define SECCLASS_SOCK_FILE 12
#define SECCLASS_FIFO_FILE 13
#define SECCLASS_SOCKET 14
#define SECCLASS_TCP_SOCKET 15
#define SECCLASS_UDP_SOCKET 16
#define SECCLASS_RAWIP_SOCKET 17
#define SECCLASS_NODE 18
#define SECCLASS_NETIF 19
#define SECCLASS_NETLINK_SOCKET 20
#define SECCLASS_PACKET_SOCKET 21
#define SECCLASS_KEY_SOCKET 22
#define SECCLASS_UNIX_STREAM_SOCKET 23
#define SECCLASS_UNIX_DGRAM_SOCKET 24
#define SECCLASS_SEM 25
#define SECCLASS_MSG 26
#define SECCLASS_MSGQ 27
#define SECCLASS_SHM 28
#define SECCLASS_IPC 29
#define SECCLASS_PASSWD 30
#define SECCLASS_X_DRAWABLE 31
#define SECCLASS_X_SCREEN 32
#define SECCLASS_X_GC 33
#define SECCLASS_X_FONT 34
#define SECCLASS_X_COLORMAP 35
#define SECCLASS_X_PROPERTY 36
#define SECCLASS_X_SELECTION 37
#define SECCLASS_X_CURSOR 38
#define SECCLASS_X_CLIENT 39
#define SECCLASS_X_DEVICE 40
#define SECCLASS_X_SERVER 41
#define SECCLASS_X_EXTENSION 42
#define SECCLASS_NETLINK_ROUTE_SOCKET 43
#define SECCLASS_NETLINK_FIREWALL_SOCKET 44
#define SECCLASS_NETLINK_TCPDIAG_SOCKET 45
#define SECCLASS_NETLINK_NFLOG_SOCKET 46
#define SECCLASS_NETLINK_XFRM_SOCKET 47
#define SECCLASS_NETLINK_SELINUX_SOCKET 48
#define SECCLASS_NETLINK_AUDIT_SOCKET 49
#define SECCLASS_NETLINK_IP6FW_SOCKET 50
#define SECCLASS_NETLINK_DNRT_SOCKET 51
#define SECCLASS_DBUS 52
#define SECCLASS_NSCD 53
#define SECCLASS_ASSOCIATION 54
#define SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET 55
#define SECCLASS_APPLETALK_SOCKET 56
#define SECCLASS_PACKET 57
#define SECCLASS_KEY 58
#define SECCLASS_CONTEXT 59
#define SECCLASS_DCCP_SOCKET 60
#define SECCLASS_MEMPROTECT 61
#define SECCLASS_DB_DATABASE 62
#define SECCLASS_DB_TABLE 63
#define SECCLASS_DB_PROCEDURE 64
#define SECCLASS_DB_COLUMN 65
#define SECCLASS_DB_TUPLE 66
#define SECCLASS_DB_BLOB 67
#define SECCLASS_PEER 68
#define SECCLASS_CAPABILITY2 69
#define SECCLASS_X_RESOURCE 70
#define SECCLASS_X_EVENT 71
#define SECCLASS_X_SYNTHETIC_EVENT 72
#define SECCLASS_X_APPLICATION_DATA 73
/*
* Security identifier indices for initial entities
*/
#define SECINITSID_KERNEL 1
#define SECINITSID_SECURITY 2
#define SECINITSID_UNLABELED 3
#define SECINITSID_FS 4
#define SECINITSID_FILE 5
#define SECINITSID_FILE_LABELS 6
#define SECINITSID_INIT 7
#define SECINITSID_ANY_SOCKET 8
#define SECINITSID_PORT 9
#define SECINITSID_NETIF 10
#define SECINITSID_NETMSG 11
#define SECINITSID_NODE 12
#define SECINITSID_IGMP_PACKET 13
#define SECINITSID_ICMP_SOCKET 14
#define SECINITSID_TCP_SOCKET 15
#define SECINITSID_SYSCTL_MODPROBE 16
#define SECINITSID_SYSCTL 17
#define SECINITSID_SYSCTL_FS 18
#define SECINITSID_SYSCTL_KERNEL 19
#define SECINITSID_SYSCTL_NET 20
#define SECINITSID_SYSCTL_NET_UNIX 21
#define SECINITSID_SYSCTL_VM 22
#define SECINITSID_SYSCTL_DEV 23
#define SECINITSID_KMOD 24
#define SECINITSID_POLICY 25
#define SECINITSID_SCMP_PACKET 26
#define SECINITSID_DEVNULL 27
#define SECINITSID_NUM 27
#endif
jni/external/selinux/get_context_list.h
deleted
100644 → 0
View file @
b614b067
#ifndef _SELINUX_GET_SID_LIST_H_
#define _SELINUX_GET_SID_LIST_H_
#include <selinux/selinux.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#define SELINUX_DEFAULTUSER "user_u"
/* Get an ordered list of authorized security contexts for a user session
for 'user' spawned by 'fromcon' and set *conary to refer to the
NULL-terminated array of contexts. Every entry in the list will
be authorized by the policy, but the ordering is subject to user
customizable preferences. Returns number of entries in *conary.
If 'fromcon' is NULL, defaults to current context.
Caller must free via freeconary. */
extern
int
get_ordered_context_list
(
const
char
*
user
,
char
*
fromcon
,
char
***
list
);
/* As above, but use the provided MLS level rather than the
default level for the user. */
int
get_ordered_context_list_with_level
(
const
char
*
user
,
const
char
*
level
,
char
*
fromcon
,
char
***
list
);
/* Get the default security context for a user session for 'user'
spawned by 'fromcon' and set *newcon to refer to it. The context
will be one of those authorized by the policy, but the selection
of a default is subject to user customizable preferences.
If 'fromcon' is NULL, defaults to current context.
Returns 0 on success or -1 otherwise.
Caller must free via freecon. */
extern
int
get_default_context
(
const
char
*
user
,
char
*
fromcon
,
char
**
newcon
);
/* As above, but use the provided MLS level rather than the
default level for the user. */
int
get_default_context_with_level
(
const
char
*
user
,
const
char
*
level
,
char
*
fromcon
,
char
**
newcon
);
/* Same as get_default_context, but only return a context
that has the specified role. If no reachable context exists
for the user with that role, then return -1. */
int
get_default_context_with_role
(
const
char
*
user
,
const
char
*
role
,
char
*
fromcon
,
char
**
newcon
);
/* Same as get_default_context, but only return a context
that has the specified role and level. If no reachable context exists
for the user with that role, then return -1. */
int
get_default_context_with_rolelevel
(
const
char
*
user
,
const
char
*
role
,
const
char
*
level
,
char
*
fromcon
,
char
**
newcon
);
/* Given a list of authorized security contexts for the user,
query the user to select one and set *newcon to refer to it.
Caller must free via freecon.
Returns 0 on sucess or -1 otherwise. */
extern
int
query_user_context
(
char
**
list
,
char
**
newcon
);
/* Allow the user to manually enter a context as a fallback
if a list of authorized contexts could not be obtained.
Caller must free via freecon.
Returns 0 on success or -1 otherwise. */
extern
int
manual_user_enter_context
(
const
char
*
user
,
char
**
newcon
);
#ifdef __cplusplus
}
#endif
#endif
jni/external/selinux/get_default_type.h
deleted
100644 → 0
View file @
b614b067
/* get_default_type.h - contains header information and function prototypes
* for functions to get the default type for a role
*/
#ifndef _SELINUX_GET_DEFAULT_TYPE_H_
#define _SELINUX_GET_DEFAULT_TYPE_H_
#ifdef __cplusplus
extern
"C"
{
#endif
/* Return path to default type file. */
const
char
*
selinux_default_type_path
(
void
);
/* Get the default type (domain) for 'role' and set 'type' to refer to it.
Caller must free via free().
Return 0 on success or -1 otherwise. */
int
get_default_type
(
const
char
*
role
,
char
**
type
);
#ifdef __cplusplus
}
#endif
#endif
/* ifndef _GET_DEFAULT_TYPE_H_ */
jni/external/selinux/label.h
deleted
100644 → 0
View file @
b614b067
/*
* Labeling interface for userspace object managers and others.
*
* Author : Eamon Walsh <ewalsh@tycho.nsa.gov>
*/
#ifndef _SELABEL_H_
#define _SELABEL_H_
#include <stdbool.h>
#include <sys/types.h>
#include <selinux/selinux.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/*
* Opaque type used for all label handles.
*/
struct
selabel_handle
;
/*
* Available backends.
*/
/* file contexts */
#define SELABEL_CTX_FILE 0
/* media contexts */
#define SELABEL_CTX_MEDIA 1
/* x contexts */
#define SELABEL_CTX_X 2
/* db objects */
#define SELABEL_CTX_DB 3
/* Android property service contexts */
#define SELABEL_CTX_ANDROID_PROP 4
/* Android service contexts */
#define SELABEL_CTX_ANDROID_SERVICE 5
/*
* Available options
*/
/* no-op option, useful for unused slots in an array of options */
#define SELABEL_OPT_UNUSED 0
/* validate contexts before returning them (boolean value) */
#define SELABEL_OPT_VALIDATE 1
/* don't use local customizations to backend data (boolean value) */
#define SELABEL_OPT_BASEONLY 2
/* specify an alternate path to use when loading backend data */
#define SELABEL_OPT_PATH 3
/* select a subset of the search space as an optimization (file backend) */
#define SELABEL_OPT_SUBSET 4
/* require a hash calculation on spec files */
#define SELABEL_OPT_DIGEST 5
/* total number of options */
#define SELABEL_NOPT 6
/*
* Label operations
*/
/**
* selabel_open - Create a labeling handle.
* @backend: one of the constants specifying a supported labeling backend.
* @opts: array of selabel_opt structures specifying label options or NULL.
* @nopts: number of elements in opts array or zero for no options.
*
* Open a labeling backend for use. The available backend identifiers are
* listed above. Options may be provided via the opts parameter; available
* options are listed above. Not all options may be supported by every
* backend. Return value is the created handle on success or NULL with
* @errno set on failure.
*/
struct
selabel_handle
*
selabel_open
(
unsigned
int
backend
,
const
struct
selinux_opt
*
opts
,
unsigned
nopts
);
/**
* selabel_close - Close a labeling handle.
* @handle: specifies handle to close
*
* Destroy the specified handle, closing files, freeing allocated memory,
* etc. The handle may not be further used after it has been closed.
*/
void
selabel_close
(
struct
selabel_handle
*
handle
);
/**
* selabel_lookup - Perform labeling lookup operation.
* @handle: specifies backend instance to query
* @con: returns the appropriate context with which to label the object
* @key: string input to lookup operation
* @type: numeric input to the lookup operation
*
* Perform a labeling lookup operation. Return %0 on success, -%1 with
* @errno set on failure. The key and type arguments are the inputs to the
* lookup operation; appropriate values are dictated by the backend in use.
* The result is returned in the memory pointed to by @con and must be freed
* by the user with freecon().
*/
int
selabel_lookup
(
struct
selabel_handle
*
handle
,
char
**
con
,
const
char
*
key
,
int
type
);
int
selabel_lookup_raw
(
struct
selabel_handle
*
handle
,
char
**
con
,
const
char
*
key
,
int
type
);
bool
selabel_partial_match
(
struct
selabel_handle
*
handle
,
const
char
*
key
);
int
selabel_lookup_best_match
(
struct
selabel_handle
*
rec
,
char
**
con
,
const
char
*
key
,
const
char
**
aliases
,
int
type
);
int
selabel_lookup_best_match_raw
(
struct
selabel_handle
*
rec
,
char
**
con
,
const
char
*
key
,
const
char
**
aliases
,
int
type
);
/**
* selabel_digest - Retrieve the SHA1 digest and the list of specfiles used to
* generate the digest. The SELABEL_OPT_DIGEST option must
* be set in selabel_open() to initiate the digest generation.
* @handle: specifies backend instance to query
* @digest: returns a pointer to the SHA1 digest.
* @digest_len: returns length of digest in bytes.
* @specfiles: a list of specfiles used in the SHA1 digest generation.
* The list is NULL terminated and will hold @num_specfiles entries.
* @num_specfiles: number of specfiles in the list.
*
* Return %0 on success, -%1 with @errno set on failure.
*/
int
selabel_digest
(
struct
selabel_handle
*
rec
,
unsigned
char
**
digest
,
size_t
*
digest_len
,
char
***
specfiles
,
size_t
*
num_specfiles
);
enum
selabel_cmp_result
{
SELABEL_SUBSET
,
SELABEL_EQUAL
,
SELABEL_SUPERSET
,
SELABEL_INCOMPARABLE
};
/**
* selabel_cmp - Compare two label configurations.
* @h1: handle for the first label configuration
* @h2: handle for the first label configuration
*
* Compare two label configurations.
* Return %SELABEL_SUBSET if @h1 is a subset of @h2, %SELABEL_EQUAL
* if @h1 is identical to @h2, %SELABEL_SUPERSET if @h1 is a superset
* of @h2, and %SELABEL_INCOMPARABLE if @h1 and @h2 are incomparable.
*/
enum
selabel_cmp_result
selabel_cmp
(
struct
selabel_handle
*
h1
,
struct
selabel_handle
*
h2
);
/**
* selabel_stats - log labeling operation statistics.
* @handle: specifies backend instance to query
*
* Log a message with information about the number of queries performed,
* number of unused matching entries, or other operational statistics.
* Message is backend-specific, some backends may not output a message.
*/
void
selabel_stats
(
struct
selabel_handle
*
handle
);
/*
* Type codes used by specific backends
*/
/* X backend */
#define SELABEL_X_PROP 1
#define SELABEL_X_EXT 2
#define SELABEL_X_CLIENT 3
#define SELABEL_X_EVENT 4
#define SELABEL_X_SELN 5
#define SELABEL_X_POLYPROP 6
#define SELABEL_X_POLYSELN 7
/* DB backend */
#define SELABEL_DB_DATABASE 1
#define SELABEL_DB_SCHEMA 2
#define SELABEL_DB_TABLE 3
#define SELABEL_DB_COLUMN 4
#define SELABEL_DB_SEQUENCE 5
#define SELABEL_DB_VIEW 6
#define SELABEL_DB_PROCEDURE 7
#define SELABEL_DB_BLOB 8
#define SELABEL_DB_TUPLE 9
#define SELABEL_DB_LANGUAGE 10
#define SELABEL_DB_EXCEPTION 11
#define SELABEL_DB_DATATYPE 12
#ifdef __cplusplus
}
#endif
#endif
/* _SELABEL_H_ */
jni/external/selinux/restorecon.h
deleted
100644 → 0
View file @
b614b067
#ifndef _RESTORECON_H_
#define _RESTORECON_H_
#include <sys/types.h>
#include <stdarg.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/**
* selinux_restorecon - Relabel files.
* @pathname: specifies file/directory to relabel.
* @restorecon_flags: specifies the actions to be performed when relabeling.
*
* selinux_restorecon(3) will automatically call
* selinux_restorecon_default_handle(3) and selinux_restorecon_set_sehandle(3)
* first time through to set the selabel_open(3) parameters to use the
* currently loaded policy file_contexts and request their computed digest.
*
* Should other selabel_open(3) parameters be required see
* selinux_restorecon_set_sehandle(3).
*/
extern
int
selinux_restorecon
(
const
char
*
pathname
,
unsigned
int
restorecon_flags
);
/*
* restorecon_flags options
*/
/*
* Force the checking of labels even if the stored SHA1
* digest matches the specfiles SHA1 digest.
*/
#define SELINUX_RESTORECON_IGNORE_DIGEST 0x0001
/*
* Do not change file labels.
*/
#define SELINUX_RESTORECON_NOCHANGE 0x0002
/*
* If set set change file label to that in spec file.
* If not only change type component to that in spec file.
*/
#define SELINUX_RESTORECON_SET_SPECFILE_CTX 0x0004
/*
* Recursively descend directories.
*/
#define SELINUX_RESTORECON_RECURSE 0x0008
/*
* Log changes to selinux log. Note that if VERBOSE and
* PROGRESS are set, then PROGRESS will take precedence.
*/
#define SELINUX_RESTORECON_VERBOSE 0x0010
/*
* If SELINUX_RESTORECON_PROGRESS is true and
* SELINUX_RESTORECON_MASS_RELABEL is true, then output approx % complete,
* else output the number of files in 1k blocks processed to stdout.
*/
#define SELINUX_RESTORECON_PROGRESS 0x0020
/*
* Convert passed-in pathname to canonical pathname.
*/
#define SELINUX_RESTORECON_REALPATH 0x0040
/*
* Prevent descending into directories that have a different
* device number than the pathname from which the descent began.
*/
#define SELINUX_RESTORECON_XDEV 0x0080
/*
* Attempt to add an association between an inode and a specification.
* If there is already an association for the inode and it conflicts
* with the specification, then use the last matching specification.
*/
#define SELINUX_RESTORECON_ADD_ASSOC 0x0100
/*
* Abort on errors during the file tree walk.
*/
#define SELINUX_RESTORECON_ABORT_ON_ERROR 0x0200
/*
* Log any label changes to syslog.
*/
#define SELINUX_RESTORECON_SYSLOG_CHANGES 0x0400
/*
* Log what spec matched each file.
*/
#define SELINUX_RESTORECON_LOG_MATCHES 0x0800
/*
* Ignore files that do not exist.
*/
#define SELINUX_RESTORECON_IGNORE_NOENTRY 0x1000
/*
* Do not read /proc/mounts to obtain a list of non-seclabel
* mounts to be excluded from relabeling checks.
*/
#define SELINUX_RESTORECON_IGNORE_MOUNTS 0x2000
/*
* Set if there is a mass relabel required.
* See SELINUX_RESTORECON_PROGRESS flag for details.
*/
#define SELINUX_RESTORECON_MASS_RELABEL 0x4000
/**
* selinux_restorecon_set_sehandle - Set the global fc handle.
* @hndl: specifies handle to set as the global fc handle.
*
* Called by a process that has already called selabel_open(3) with it's
* required parameters, or if selinux_restorecon_default_handle(3) has been
* called to set the default selabel_open(3) parameters.
*/
// extern void selinux_restorecon_set_sehandle(struct selabel_handle *hndl);
/**
* selinux_restorecon_default_handle - Sets default selabel_open(3) parameters
* to use the currently loaded policy and
* file_contexts, also requests the digest.
*
* Return value is the created handle on success or NULL with @errno set on
* failure.
*/
extern
struct
selabel_handle
*
selinux_restorecon_default_handle
(
void
);
/**
* selinux_restorecon_set_exclude_list - Add a list of directories that are
* to be excluded from relabeling.
* @exclude_list: containing a NULL terminated list of one or more
* directories not to be relabeled.
*/
extern
void
selinux_restorecon_set_exclude_list
(
const
char
**
exclude_list
);
/**
* selinux_restorecon_set_alt_rootpath - Use alternate rootpath.
* @alt_rootpath: containing the alternate rootpath to be used.
*
* Return %0 on success, -%1 with @errno set on failure.
*/
extern
int
selinux_restorecon_set_alt_rootpath
(
const
char
*
alt_rootpath
);
/**
* selinux_restorecon_xattr - Read/remove RESTORECON_LAST xattr entries.
* @pathname: specifies directory path to check.
* @xattr_flags: specifies the actions to be performed.
* @xattr_list: a linked list of struct dir_xattr structures containing
* the directory, digest and result of the action on the
* RESTORECON_LAST entry.
*
* selinux_restorecon_xattr(3) will automatically call
* selinux_restorecon_default_handle(3) and selinux_restorecon_set_sehandle(3)
* first time through to set the selabel_open(3) parameters to use the
* currently loaded policy file_contexts and request their computed digest.
*
* Should other selabel_open(3) parameters be required see
* selinux_restorecon_set_sehandle(3), however note that a file_contexts
* computed digest is required for selinux_restorecon_xattr().
*/
enum
digest_result
{
MATCH
=
0
,
NOMATCH
,
DELETED_MATCH
,
DELETED_NOMATCH
,
ERROR
};
struct
dir_xattr
{
char
*
directory
;
char
*
digest
;
/* A hex encoded string that can be printed. */
enum
digest_result
result
;
struct
dir_xattr
*
next
;
};
extern
int
selinux_restorecon_xattr
(
const
char
*
pathname
,
unsigned
int
xattr_flags
,
struct
dir_xattr
***
xattr_list
);
/*
* xattr_flags options
*/
/* Recursively descend directories. */
#define SELINUX_RESTORECON_XATTR_RECURSE 0x0001
/* Delete non-matching digests from each directory in pathname. */
#define SELINUX_RESTORECON_XATTR_DELETE_NONMATCH_DIGESTS 0x0002
/* Delete all digests found in pathname. */
#define SELINUX_RESTORECON_XATTR_DELETE_ALL_DIGESTS 0x0004
/* Do not read /proc/mounts. */
#define SELINUX_RESTORECON_XATTR_IGNORE_MOUNTS 0x0008
#ifdef __cplusplus
}
#endif
#endif
jni/external/selinux/selinux.h
deleted
100644 → 0
View file @
b614b067
This diff is collapsed.
Click to expand it.
jni/external/selinux_stub.c
→
jni/external/s
tubs/s
elinux_stub.c
View file @
bb5a6a1c
#include <stdbool.h>
#include <stdbool.h>
#include "selinux/avc.h"
#include <selinux/avc.h>
#include "selinux/context.h"
#include <selinux/context.h>
#include "selinux/get_context_list.h"
#include <selinux/get_context_list.h>
#include "selinux/get_default_type.h"
#include <selinux/get_default_type.h>
#include "selinux/restorecon.h"
#include <selinux/label.h>
#include "selinux/selinux.h"
#include <selinux/restorecon.h>
#include <selinux/selinux.h>
int
is_selinux_enabled
(
void
)
{
return
0
;
}
int
is_selinux_enabled
(
void
)
{
return
0
;
}
int
is_selinux_mls_enabled
(
void
)
{
return
0
;
}
int
is_selinux_mls_enabled
(
void
)
{
return
0
;
}
void
freecon
(
char
*
con
)
{
}
void
freecon
(
char
*
con
)
{
}
...
@@ -225,7 +226,7 @@ int selinux_raw_to_trans_context(const char * raw,
...
@@ -225,7 +226,7 @@ int selinux_raw_to_trans_context(const char * raw,
int
selinux_raw_context_to_color
(
const
char
*
raw
,
int
selinux_raw_context_to_color
(
const
char
*
raw
,
char
**
color_str
)
{
return
0
;
}
char
**
color_str
)
{
return
0
;
}
int
getseuserbyname
(
const
char
*
linuxuser
,
char
**
seuser
,
char
**
level
)
{
return
0
;
}
int
getseuserbyname
(
const
char
*
linuxuser
,
char
**
seuser
,
char
**
level
)
{
return
0
;
}
int
getseuser
(
const
char
*
username
,
const
char
*
service
,
int
getseuser
(
const
char
*
username
,
const
char
*
service
,
char
**
r_seuser
,
char
**
r_level
)
{
return
0
;
}
char
**
r_seuser
,
char
**
r_level
)
{
return
0
;
}
int
selinux_file_context_cmp
(
const
char
*
a
,
int
selinux_file_context_cmp
(
const
char
*
a
,
const
char
*
b
)
{
return
0
;
}
const
char
*
b
)
{
return
0
;
}
...
...
jni/external/sqlite3_stub.c
→
jni/external/s
tubs/s
qlite3_stub.c
View file @
bb5a6a1c
File moved
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