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
6582a4ab
Commit
6582a4ab
authored
Sep 05, 2021
by
LoveSy
Committed by
John Wu
Jan 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make magiskpolicy supports multiple --apply
parent
a699dab5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
magiskpolicy.cpp
native/jni/magiskpolicy/magiskpolicy.cpp
+7
-4
No files found.
native/jni/magiskpolicy/magiskpolicy.cpp
View file @
6582a4ab
#include <utils.hpp>
#include <utils.hpp>
#include <vector>
#include <magiskpolicy.hpp>
#include <magiskpolicy.hpp>
#include "sepolicy.hpp"
#include "sepolicy.hpp"
...
@@ -23,6 +24,7 @@ Options:
...
@@ -23,6 +24,7 @@ Options:
Magisk selinux environment
Magisk selinux environment
--apply FILE apply rules from FILE, read and parsed
--apply FILE apply rules from FILE, read and parsed
line by line as policy statements
line by line as policy statements
(multiple --apply allows)
If neither --load or --compile-split is specified, it will load
If neither --load or --compile-split is specified, it will load
from current live policies (/sys/fs/selinux/policy)
from current live policies (/sys/fs/selinux/policy)
...
@@ -34,7 +36,7 @@ from current live policies (/sys/fs/selinux/policy)
...
@@ -34,7 +36,7 @@ from current live policies (/sys/fs/selinux/policy)
int
magiskpolicy_main
(
int
argc
,
char
*
argv
[])
{
int
magiskpolicy_main
(
int
argc
,
char
*
argv
[])
{
cmdline_logging
();
cmdline_logging
();
const
char
*
out_file
=
nullptr
;
const
char
*
out_file
=
nullptr
;
const
char
*
rule_file
=
nullptr
;
std
::
vector
<
std
::
string_view
>
rule_files
;
sepolicy
*
sepol
=
nullptr
;
sepolicy
*
sepol
=
nullptr
;
bool
magisk
=
false
;
bool
magisk
=
false
;
bool
live
=
false
;
bool
live
=
false
;
...
@@ -78,7 +80,7 @@ int magiskpolicy_main(int argc, char *argv[]) {
...
@@ -78,7 +80,7 @@ int magiskpolicy_main(int argc, char *argv[]) {
}
else
if
(
option
==
"apply"
sv
)
{
}
else
if
(
option
==
"apply"
sv
)
{
if
(
argv
[
i
+
1
]
==
nullptr
)
if
(
argv
[
i
+
1
]
==
nullptr
)
usage
(
argv
[
0
]);
usage
(
argv
[
0
]);
rule_file
=
argv
[
i
+
1
]
;
rule_file
s
.
emplace_back
(
argv
[
i
+
1
])
;
++
i
;
++
i
;
}
else
if
(
option
==
"help"
sv
)
{
}
else
if
(
option
==
"help"
sv
)
{
statement_help
();
statement_help
();
...
@@ -99,8 +101,9 @@ int magiskpolicy_main(int argc, char *argv[]) {
...
@@ -99,8 +101,9 @@ int magiskpolicy_main(int argc, char *argv[]) {
if
(
magisk
)
if
(
magisk
)
sepol
->
magisk_rules
();
sepol
->
magisk_rules
();
if
(
rule_file
)
if
(
!
rule_files
.
empty
())
sepol
->
load_rule_file
(
rule_file
);
for
(
const
auto
&
rule_file
:
rule_files
)
sepol
->
load_rule_file
(
rule_file
.
data
());
for
(;
i
<
argc
;
++
i
)
for
(;
i
<
argc
;
++
i
)
sepol
->
parse_statement
(
argv
[
i
]);
sepol
->
parse_statement
(
argv
[
i
]);
...
...
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