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
ca7d09d1
Commit
ca7d09d1
authored
Nov 01, 2015
by
Pierre-Hugues Husson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -n option for noaudit
parent
4ab478c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
sepolicy-inject.c
sepolicy-inject.c
+11
-5
No files found.
sepolicy-inject.c
View file @
ca7d09d1
...
...
@@ -128,7 +128,7 @@ void create_domain(char *d, policydb_t *policy) {
set_attr
(
"domain"
,
value
,
policy
);
}
int
add_rule
(
char
*
s
,
char
*
t
,
char
*
c
,
char
*
p
,
policydb_t
*
policy
)
{
int
add_rule
(
char
*
s
,
char
*
t
,
char
*
c
,
char
*
p
,
int
effect
,
policydb_t
*
policy
)
{
type_datum_t
*
src
,
*
tgt
;
class_datum_t
*
cls
;
perm_datum_t
*
perm
;
...
...
@@ -167,7 +167,7 @@ int add_rule(char *s, char *t, char *c, char *p, policydb_t *policy) {
key
.
source_type
=
src
->
s
.
value
;
key
.
target_type
=
tgt
->
s
.
value
;
key
.
target_class
=
cls
->
s
.
value
;
key
.
specified
=
AVTAB_ALLOWED
;
key
.
specified
=
effect
;
av
=
avtab_search
(
&
policy
->
te_avtab
,
&
key
);
if
(
av
==
NULL
)
{
...
...
@@ -354,7 +354,7 @@ int main(int argc, char **argv)
sidtab_t
sidtab
;
char
ch
;
FILE
*
fp
;
int
permissive_value
=
0
;
int
permissive_value
=
0
,
noaudit
=
0
;
struct
option
long_options
[]
=
{
...
...
@@ -365,6 +365,7 @@ int main(int argc, char **argv)
{
"perm"
,
required_argument
,
NULL
,
'p'
},
{
"fcon"
,
required_argument
,
NULL
,
'f'
},
{
"filetransition"
,
required_argument
,
NULL
,
'g'
},
{
"noaudit"
,
no_argument
,
NULL
,
'n'
},
{
"policy"
,
required_argument
,
NULL
,
'P'
},
{
"output"
,
required_argument
,
NULL
,
'o'
},
{
"permissive"
,
required_argument
,
NULL
,
'Z'
},
...
...
@@ -372,7 +373,7 @@ int main(int argc, char **argv)
{
NULL
,
0
,
NULL
,
0
}
};
while
((
ch
=
getopt_long
(
argc
,
argv
,
"a:f:g:s:t:c:p:P:o:Z:z:"
,
long_options
,
NULL
))
!=
-
1
)
{
while
((
ch
=
getopt_long
(
argc
,
argv
,
"a:f:g:s:t:c:p:P:o:Z:z:
n
"
,
long_options
,
NULL
))
!=
-
1
)
{
switch
(
ch
)
{
case
'a'
:
attr
=
optarg
;
...
...
@@ -409,6 +410,9 @@ int main(int argc, char **argv)
permissive
=
optarg
;
permissive_value
=
0
;
break
;
case
'n'
:
noaudit
=
1
;
break
;
default:
usage
(
argv
[
0
]);
}
...
...
@@ -450,9 +454,11 @@ int main(int argc, char **argv)
add_transition
(
source
,
fcon
,
target
,
class
,
&
policydb
);
}
else
if
(
attr
)
{
add_type
(
source
,
attr
,
&
policydb
);
}
else
if
(
noaudit
)
{
add_rule
(
source
,
target
,
class
,
perm
,
AVTAB_AUDITDENY
,
&
policydb
);
}
else
{
create_domain
(
source
,
&
policydb
);
if
(
add_rule
(
source
,
target
,
class
,
perm
,
&
policydb
))
{
if
(
add_rule
(
source
,
target
,
class
,
perm
,
AVTAB_ALLOWED
,
&
policydb
))
{
fprintf
(
stderr
,
"Could not add rule
\n
"
);
return
1
;
}
...
...
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