Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Chen Yisong
lxc
Commits
925f4773
Unverified
Commit
925f4773
authored
Feb 13, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lsm: convert to strequal()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
4134561c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
apparmor.c
src/lxc/lsm/apparmor.c
+9
-9
selinux.c
src/lxc/lsm/selinux.c
+1
-1
No files found.
src/lxc/lsm/apparmor.c
View file @
925f4773
...
@@ -466,7 +466,7 @@ static bool apparmor_am_unconfined(struct lsm_ops *ops)
...
@@ -466,7 +466,7 @@ static bool apparmor_am_unconfined(struct lsm_ops *ops)
{
{
char
*
p
=
apparmor_process_label_get
(
ops
,
lxc_raw_getpid
());
char
*
p
=
apparmor_process_label_get
(
ops
,
lxc_raw_getpid
());
bool
ret
=
false
;
bool
ret
=
false
;
if
(
!
p
||
str
cmp
(
p
,
"unconfined"
)
==
0
)
if
(
!
p
||
str
equal
(
p
,
"unconfined"
)
)
ret
=
true
;
ret
=
true
;
free
(
p
);
free
(
p
);
return
ret
;
return
ret
;
...
@@ -476,9 +476,9 @@ static bool aa_needs_transition(char *curlabel)
...
@@ -476,9 +476,9 @@ static bool aa_needs_transition(char *curlabel)
{
{
if
(
!
curlabel
)
if
(
!
curlabel
)
return
false
;
return
false
;
if
(
str
cmp
(
curlabel
,
"unconfined"
)
==
0
)
if
(
str
equal
(
curlabel
,
"unconfined"
)
)
return
false
;
return
false
;
if
(
str
cmp
(
curlabel
,
"/usr/bin/lxc-start"
)
==
0
)
if
(
str
equal
(
curlabel
,
"/usr/bin/lxc-start"
)
)
return
false
;
return
false
;
return
true
;
return
true
;
}
}
...
@@ -1052,13 +1052,13 @@ static int apparmor_prepare(struct lsm_ops *ops, struct lxc_conf *conf, const ch
...
@@ -1052,13 +1052,13 @@ static int apparmor_prepare(struct lsm_ops *ops, struct lxc_conf *conf, const ch
label
=
conf
->
lsm_aa_profile
;
label
=
conf
->
lsm_aa_profile
;
/* user may request that we just ignore apparmor */
/* user may request that we just ignore apparmor */
if
(
label
&&
str
cmp
(
label
,
AA_UNCHANGED
)
==
0
)
{
if
(
label
&&
str
equal
(
label
,
AA_UNCHANGED
)
)
{
INFO
(
"AppArmor profile unchanged per user request"
);
INFO
(
"AppArmor profile unchanged per user request"
);
conf
->
lsm_aa_profile_computed
=
must_copy_string
(
label
);
conf
->
lsm_aa_profile_computed
=
must_copy_string
(
label
);
return
0
;
return
0
;
}
}
if
(
label
&&
str
cmp
(
label
,
AA_GENERATED
)
==
0
)
{
if
(
label
&&
str
equal
(
label
,
AA_GENERATED
)
)
{
if
(
!
check_apparmor_parser_version
(
ops
))
{
if
(
!
check_apparmor_parser_version
(
ops
))
{
ERROR
(
"Cannot use generated profile: apparmor_parser not available"
);
ERROR
(
"Cannot use generated profile: apparmor_parser not available"
);
goto
out
;
goto
out
;
...
@@ -1093,7 +1093,7 @@ static int apparmor_prepare(struct lsm_ops *ops, struct lxc_conf *conf, const ch
...
@@ -1093,7 +1093,7 @@ static int apparmor_prepare(struct lsm_ops *ops, struct lxc_conf *conf, const ch
if
(
!
ops
->
aa_can_stack
&&
aa_needs_transition
(
curlabel
))
{
if
(
!
ops
->
aa_can_stack
&&
aa_needs_transition
(
curlabel
))
{
/* we're already confined, and stacking isn't supported */
/* we're already confined, and stacking isn't supported */
if
(
!
label
||
str
cmp
(
curlabel
,
label
)
==
0
)
{
if
(
!
label
||
str
equal
(
curlabel
,
label
)
)
{
/* no change requested */
/* no change requested */
ret
=
0
;
ret
=
0
;
goto
out
;
goto
out
;
...
@@ -1110,7 +1110,7 @@ static int apparmor_prepare(struct lsm_ops *ops, struct lxc_conf *conf, const ch
...
@@ -1110,7 +1110,7 @@ static int apparmor_prepare(struct lsm_ops *ops, struct lxc_conf *conf, const ch
label
=
AA_DEF_PROFILE
;
label
=
AA_DEF_PROFILE
;
}
}
if
(
!
ops
->
aa_mount_features_enabled
&&
strcmp
(
label
,
"unconfined"
)
!=
0
)
{
if
(
!
ops
->
aa_mount_features_enabled
&&
!
strequal
(
label
,
"unconfined"
)
)
{
WARN
(
"Incomplete AppArmor support in your kernel"
);
WARN
(
"Incomplete AppArmor support in your kernel"
);
if
(
!
conf
->
lsm_aa_allow_incomplete
)
{
if
(
!
conf
->
lsm_aa_allow_incomplete
)
{
ERROR
(
"If you really want to start this container, set"
);
ERROR
(
"If you really want to start this container, set"
);
...
@@ -1209,10 +1209,10 @@ static int apparmor_process_label_set(struct lsm_ops *ops, const char *inlabel,
...
@@ -1209,10 +1209,10 @@ static int apparmor_process_label_set(struct lsm_ops *ops, const char *inlabel,
return
log_error_errno
(
-
EINVAL
,
EINVAL
,
"LSM wasn't prepared"
);
return
log_error_errno
(
-
EINVAL
,
EINVAL
,
"LSM wasn't prepared"
);
/* user may request that we just ignore apparmor */
/* user may request that we just ignore apparmor */
if
(
str
cmp
(
label
,
AA_UNCHANGED
)
==
0
)
if
(
str
equal
(
label
,
AA_UNCHANGED
)
)
return
log_info
(
0
,
"AppArmor profile unchanged per user request"
);
return
log_info
(
0
,
"AppArmor profile unchanged per user request"
);
if
(
str
cmp
(
label
,
"unconfined"
)
==
0
&&
apparmor_am_unconfined
(
ops
))
if
(
str
equal
(
label
,
"unconfined"
)
&&
apparmor_am_unconfined
(
ops
))
return
log_info
(
0
,
"AppArmor profile unchanged"
);
return
log_info
(
0
,
"AppArmor profile unchanged"
);
label_fd
=
apparmor_process_label_fd_get
(
ops
,
lxc_raw_gettid
(),
on_exec
);
label_fd
=
apparmor_process_label_fd_get
(
ops
,
lxc_raw_gettid
(),
on_exec
);
...
...
src/lxc/lsm/selinux.c
View file @
925f4773
...
@@ -90,7 +90,7 @@ static int selinux_process_label_set(struct lsm_ops *ops, const char *inlabel,
...
@@ -90,7 +90,7 @@ static int selinux_process_label_set(struct lsm_ops *ops, const char *inlabel,
if
(
!
label
)
if
(
!
label
)
label
=
DEFAULT_LABEL
;
label
=
DEFAULT_LABEL
;
if
(
str
cmp
(
label
,
"unconfined_t"
)
==
0
)
if
(
str
equal
(
label
,
"unconfined_t"
)
)
return
0
;
return
0
;
if
(
on_exec
)
if
(
on_exec
)
...
...
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