Skip to content

Commit f821af6

Browse files
committed
support to check selinux label
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
1 parent a8faa24 commit f821af6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

go-selinux/selinux.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,19 @@ func ReserveLabel(label string) {
221221
reserveLabel(label)
222222
}
223223

224+
// CheckLabel check the MLS/MCS level component of the specified label
225+
func CheckLabel(mcs string) error {
226+
if mcs == "" {
227+
return nil
228+
}
229+
state.Lock()
230+
defer state.Unlock()
231+
if state.mcsList[mcs] {
232+
return ErrMCSAlreadyExists
233+
}
234+
return nil
235+
}
236+
224237
// MLSEnabled checks if MLS is enabled.
225238
func MLSEnabled() bool {
226239
return isMLSEnabled()

0 commit comments

Comments
 (0)