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
51a5c3c6
Commit
51a5c3c6
authored
Nov 03, 2015
by
Pierre-Hugues Husson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indent
parent
d6cda9df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
sepolicy-inject.c
sepolicy-inject.c
+12
-15
No files found.
sepolicy-inject.c
View file @
51a5c3c6
/*
/*
* This was derived from public domain works with updates to
* This was derived from public domain works with updates to
* work with more modern SELinux libraries.
* work with more modern SELinux libraries.
*
*
* It is released into the public domain.
* It is released into the public domain.
*
*
*/
*/
#include <getopt.h>
#include <getopt.h>
...
@@ -134,7 +134,7 @@ int add_rule(char *s, char *t, char *c, char *p, int effect, policydb_t *policy)
...
@@ -134,7 +134,7 @@ int add_rule(char *s, char *t, char *c, char *p, int effect, policydb_t *policy)
perm_datum_t
*
perm
;
perm_datum_t
*
perm
;
avtab_datum_t
*
av
;
avtab_datum_t
*
av
;
avtab_key_t
key
;
avtab_key_t
key
;
src
=
hashtab_search
(
policy
->
p_types
.
table
,
s
);
src
=
hashtab_search
(
policy
->
p_types
.
table
,
s
);
if
(
src
==
NULL
)
{
if
(
src
==
NULL
)
{
fprintf
(
stderr
,
"source type %s does not exist
\n
"
,
s
);
fprintf
(
stderr
,
"source type %s does not exist
\n
"
,
s
);
...
@@ -177,14 +177,14 @@ int add_rule(char *s, char *t, char *c, char *p, int effect, policydb_t *policy)
...
@@ -177,14 +177,14 @@ int add_rule(char *s, char *t, char *c, char *p, int effect, policydb_t *policy)
if
(
ret
)
{
if
(
ret
)
{
fprintf
(
stderr
,
"Error inserting into avtab
\n
"
);
fprintf
(
stderr
,
"Error inserting into avtab
\n
"
);
return
1
;
return
1
;
}
}
}
}
av
->
data
|=
1U
<<
(
perm
->
s
.
value
-
1
);
av
->
data
|=
1U
<<
(
perm
->
s
.
value
-
1
);
return
0
;
return
0
;
}
}
int
add_transition
(
char
*
srcS
,
char
*
origS
,
char
*
tgtS
,
char
*
c
,
policydb_t
*
policy
)
{
int
add_transition
(
char
*
srcS
,
char
*
origS
,
char
*
tgtS
,
char
*
c
,
policydb_t
*
policy
)
{
type_datum_t
*
src
,
*
tgt
,
*
orig
;
type_datum_t
*
src
,
*
tgt
,
*
orig
;
class_datum_t
*
cls
;
class_datum_t
*
cls
;
...
@@ -343,7 +343,6 @@ int load_policy(char *filename, policydb_t *policydb, struct policy_file *pf) {
...
@@ -343,7 +343,6 @@ int load_policy(char *filename, policydb_t *policydb, struct policy_file *pf) {
return
0
;
return
0
;
}
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
...
@@ -355,8 +354,7 @@ int main(int argc, char **argv)
...
@@ -355,8 +354,7 @@ int main(int argc, char **argv)
int
ch
;
int
ch
;
FILE
*
fp
;
FILE
*
fp
;
int
permissive_value
=
0
,
noaudit
=
0
;
int
permissive_value
=
0
,
noaudit
=
0
;
struct
option
long_options
[]
=
{
struct
option
long_options
[]
=
{
{
"attr"
,
required_argument
,
NULL
,
'a'
},
{
"attr"
,
required_argument
,
NULL
,
'a'
},
{
"source"
,
required_argument
,
NULL
,
's'
},
{
"source"
,
required_argument
,
NULL
,
's'
},
...
@@ -469,19 +467,18 @@ int main(int argc, char **argv)
...
@@ -469,19 +467,18 @@ int main(int argc, char **argv)
fprintf
(
stderr
,
"Could not open outfile
\n
"
);
fprintf
(
stderr
,
"Could not open outfile
\n
"
);
return
1
;
return
1
;
}
}
policy_file_init
(
&
outpf
);
policy_file_init
(
&
outpf
);
outpf
.
type
=
PF_USE_STDIO
;
outpf
.
type
=
PF_USE_STDIO
;
outpf
.
fp
=
fp
;
outpf
.
fp
=
fp
;
if
(
policydb_write
(
&
policydb
,
&
outpf
))
{
if
(
policydb_write
(
&
policydb
,
&
outpf
))
{
fprintf
(
stderr
,
"Could not write policy
\n
"
);
fprintf
(
stderr
,
"Could not write policy
\n
"
);
return
1
;
return
1
;
}
}
policydb_destroy
(
&
policydb
);
policydb_destroy
(
&
policydb
);
fclose
(
fp
);
fclose
(
fp
);
return
0
;
return
0
;
}
}
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