Skip to content

Commit

Permalink
Merge pull request #380 from rhatdan/label
Browse files Browse the repository at this point in the history
Free SELinux labels when the labels are not being used
  • Loading branch information
rhatdan committed Mar 26, 2021
2 parents f9f056e + 65efbb4 commit c1ed129
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -34,13 +34,16 @@ func InitLabels(options []string) (string, string, error) {
mcon := selinux.NewContext(mountLabel)
for _, opt := range options {
if opt == "disable" {
UnreserveLabel(processLabel)
return "", "", nil
}
if i := strings.Index(opt, ":"); i == -1 {
UnreserveLabel(processLabel)
return "", "", fmt.Errorf("Bad label option %q, valid options 'disable' or \n'user, role, level, type' followed by ':' and a value", opt)
}
con := strings.SplitN(opt, ":", 2)
if !validOptions[con[0]] {
UnreserveLabel(processLabel)
return "", "", fmt.Errorf("Bad label option %q, valid options 'disable, user, role, level, type'", con[0])

}
Expand Down

0 comments on commit c1ed129

Please sign in to comment.