Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon Ruderich
passt-mac
Commits
e13159c2
Commit
e13159c2
authored
Jul 17, 2016
by
Lukas Braun
Committed by
Simon Ruderich
Aug 29, 2016
Browse files
slsm: treat empty optional arguments as non-existent
Gets rid of a special case in slsm_serialize_subtree.
parent
c98b6b83
Changes
1
Hide whitespace changes
Inline
Side-by-side
security/slsm/tree.c
View file @
e13159c2
...
...
@@ -237,20 +237,13 @@ ssize_t slsm_serialize_subtree(struct slsm_str *buf, struct slsm_str *path_buf,
return
ret
;
for
(
i
=
0
;
i
<
t
->
rules_used
;
i
++
)
{
ret
=
slsm_str_append
(
buf
,
"p=%s%cm=%u%cf=%u%c"
,
ret
=
slsm_str_append
(
buf
,
"p=%s%
ca=%s%
cm=%u%cf=%u%c"
,
path_buf
->
buf
,
'\0'
,
t
->
rules
[
i
].
app
,
'\0'
,
t
->
rules
[
i
].
perms
.
mode
,
'\0'
,
t
->
rules
[
i
].
perms
.
flags
,
'\0'
);
if
(
ret
)
return
ret
;
// TODO: get rid of this special case by handling a=\0 in the parser
if
(
t
->
rules
[
i
].
app
)
{
buf
->
used
--
;
// remove second trailing null byte
ret
=
slsm_str_append
(
buf
,
"a=%s%c"
,
t
->
rules
[
i
].
app
,
'\0'
);
if
(
ret
)
return
ret
;
}
}
// exclude null for the recursive calls
...
...
@@ -501,7 +494,8 @@ insert:
mode_str
);
return
error
;
}
if
(
flags_str
&&
(
error
=
kstrtouint
(
flags_str
,
10
,
&
r
.
perms
.
flags
)))
{
if
(
flags_str
&&
*
flags_str
&&
(
error
=
kstrtouint
(
flags_str
,
10
,
&
r
.
perms
.
flags
)))
{
printk
(
KERN_ERR
"slsm_insert_rule: format error: flags not a number: %s
\n
"
,
flags_str
);
return
error
;
...
...
@@ -511,7 +505,7 @@ insert:
if
(
!
path_components
)
return
-
ENOMEM
;
if
(
app
)
{
if
(
app
&&
*
app
)
{
r
.
app
=
kstrdup
(
app
,
GFP_KERNEL
);
if
(
!
r
.
app
)
{
kfree
(
path_components
);
...
...
Write
Preview
Supports
Markdown
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