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
10712c5e
Commit
10712c5e
authored
Nov 14, 2015
by
Pierre-Hugues Husson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -e option to know if a type/class exists
parent
83c39f57
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
sepolicy-inject.c
sepolicy-inject.c
+23
-2
No files found.
sepolicy-inject.c
View file @
10712c5e
...
...
@@ -423,6 +423,7 @@ int main(int argc, char **argv)
{
char
*
policy
=
NULL
,
*
source
=
NULL
,
*
target
=
NULL
,
*
class
=
NULL
,
*
perm
=
NULL
;
char
*
fcon
=
NULL
,
*
outfile
=
NULL
,
*
permissive
=
NULL
,
*
attr
=
NULL
,
*
filetrans
=
NULL
;
int
exists
=
0
;
policydb_t
policydb
;
struct
policy_file
pf
,
outpf
;
sidtab_t
sidtab
;
...
...
@@ -432,6 +433,7 @@ int main(int argc, char **argv)
struct
option
long_options
[]
=
{
{
"attr"
,
required_argument
,
NULL
,
'a'
},
{
"exists"
,
no_argument
,
NULL
,
'e'
},
{
"source"
,
required_argument
,
NULL
,
's'
},
{
"target"
,
required_argument
,
NULL
,
't'
},
{
"class"
,
required_argument
,
NULL
,
'c'
},
...
...
@@ -446,11 +448,14 @@ 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:n"
,
long_options
,
NULL
))
!=
-
1
)
{
while
((
ch
=
getopt_long
(
argc
,
argv
,
"a:
e
f:g:s:t:c:p:P:o:Z:z:n"
,
long_options
,
NULL
))
!=
-
1
)
{
switch
(
ch
)
{
case
'a'
:
attr
=
optarg
;
break
;
case
'e'
:
exists
=
1
;
break
;
case
'f'
:
fcon
=
optarg
;
break
;
...
...
@@ -491,7 +496,7 @@ int main(int argc, char **argv)
}
}
if
(((
!
source
||
!
target
||
!
class
||
!
perm
)
&&
!
permissive
&&
!
fcon
&&
!
attr
&&!
filetrans
)
||
!
policy
)
if
(((
!
source
||
!
target
||
!
class
||
!
perm
)
&&
!
permissive
&&
!
fcon
&&
!
attr
&&!
filetrans
&&
!
exists
)
||
!
policy
)
usage
(
argv
[
0
]);
if
(
!
outfile
)
...
...
@@ -521,6 +526,22 @@ int main(int argc, char **argv)
fprintf
(
stderr
,
"Could not set bit in permissive map
\n
"
);
return
1
;
}
}
else
if
(
exists
)
{
if
(
source
)
{
type_datum_t
*
tmp
=
hashtab_search
(
policydb
.
p_types
.
table
,
source
);
if
(
!
tmp
)
exit
(
1
);
else
exit
(
0
);
}
else
if
(
class
)
{
class_datum_t
*
tmp
=
hashtab_search
(
policydb
.
p_classes
.
table
,
class
);
if
(
!
tmp
)
exit
(
1
);
else
exit
(
0
);
}
else
{
usage
(
argv
[
0
]);
}
}
else
if
(
filetrans
)
{
if
(
add_file_transition
(
source
,
fcon
,
target
,
class
,
filetrans
,
&
policydb
))
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