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
e1a69b97
Commit
e1a69b97
authored
Oct 25, 2015
by
Pierre-Hugues Husson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix set_attr
parent
a2fd45bb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
sepolicy-inject.c
sepolicy-inject.c
+19
-3
No files found.
sepolicy-inject.c
View file @
e1a69b97
...
...
@@ -37,6 +37,18 @@ void *cmalloc(size_t s) {
return
t
;
}
int
get_attr
(
char
*
type
,
int
value
,
policydb_t
*
policy
)
{
type_datum_t
*
attr
=
hashtab_search
(
policy
->
p_types
.
table
,
type
);
if
(
!
attr
)
exit
(
1
);
if
(
attr
->
flavor
!=
TYPE_ATTRIB
)
exit
(
1
);
return
!!
ebitmap_get_bit
(
&
policy
->
attr_type_map
[
attr
->
s
.
value
-
1
],
value
-
1
);
//return !! ebitmap_get_bit(&policy->type_attr_map[value-1], attr->s.value-1);
}
int
set_attr
(
char
*
type
,
int
value
,
policydb_t
*
policy
)
{
type_datum_t
*
attr
=
hashtab_search
(
policy
->
p_types
.
table
,
type
);
if
(
!
attr
)
...
...
@@ -45,7 +57,9 @@ int set_attr(char *type, int value, policydb_t *policy) {
if
(
attr
->
flavor
!=
TYPE_ATTRIB
)
exit
(
1
);
if
(
ebitmap_set_bit
(
&
attr
->
types
,
value
-
1
,
1
))
if
(
ebitmap_set_bit
(
&
policy
->
type_attr_map
[
value
-
1
],
attr
->
s
.
value
-
1
,
1
))
exit
(
1
);
if
(
ebitmap_set_bit
(
&
policy
->
attr_type_map
[
attr
->
s
.
value
-
1
],
value
-
1
,
1
))
exit
(
1
);
return
0
;
...
...
@@ -218,7 +232,8 @@ int add_type(char *domainS, char *typeS, policydb_t *policy) {
return
1
;
}
return
set_attr
(
typeS
,
domain
->
s
.
value
,
policy
);
set_attr
(
typeS
,
domain
->
s
.
value
,
policy
);
return
0
;
}
int
load_policy
(
char
*
filename
,
policydb_t
*
policydb
,
struct
policy_file
*
pf
)
{
...
...
@@ -362,7 +377,8 @@ int main(int argc, char **argv)
}
else
if
(
fcon
)
{
add_transition
(
source
,
fcon
,
target
,
class
,
&
policydb
);
}
else
if
(
trust
)
{
add_type
(
"su"
,
"mlstrustedobject"
,
&
policydb
);
add_type
(
trust
,
"mlstrustedobject"
,
&
policydb
);
add_type
(
trust
,
"mlstrustedsubject"
,
&
policydb
);
}
else
{
create_domain
(
source
,
&
policydb
);
if
(
add_rule
(
source
,
target
,
class
,
perm
,
&
policydb
))
{
...
...
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