mirror of
https://github.com/containers/skopeo.git
synced 2025-09-13 13:33:13 +00:00
Vendor c/image after merging vrothberg/image:regsv2-docker
Also update the user and tests for the API change.
This commit is contained in:
5
vendor/github.com/opencontainers/selinux/go-selinux/label/label.go
generated
vendored
5
vendor/github.com/opencontainers/selinux/go-selinux/label/label.go
generated
vendored
@@ -48,6 +48,11 @@ func GetPidLabel(pid int) (string, error) {
|
||||
func Init() {
|
||||
}
|
||||
|
||||
// ClearLabels clears all reserved labels
|
||||
func ClearLabels() {
|
||||
return
|
||||
}
|
||||
|
||||
func ReserveLabel(label string) error {
|
||||
return nil
|
||||
}
|
||||
|
14
vendor/github.com/opencontainers/selinux/go-selinux/label/label_selinux.go
generated
vendored
14
vendor/github.com/opencontainers/selinux/go-selinux/label/label_selinux.go
generated
vendored
@@ -24,17 +24,22 @@ var ErrIncompatibleLabel = fmt.Errorf("Bad SELinux option z and Z can not be use
|
||||
// the container. A list of options can be passed into this function to alter
|
||||
// the labels. The labels returned will include a random MCS String, that is
|
||||
// guaranteed to be unique.
|
||||
func InitLabels(options []string) (string, string, error) {
|
||||
func InitLabels(options []string) (plabel string, mlabel string, Err error) {
|
||||
if !selinux.GetEnabled() {
|
||||
return "", "", nil
|
||||
}
|
||||
processLabel, mountLabel := selinux.ContainerLabels()
|
||||
if processLabel != "" {
|
||||
defer func() {
|
||||
if Err != nil {
|
||||
ReleaseLabel(mountLabel)
|
||||
}
|
||||
}()
|
||||
pcon := selinux.NewContext(processLabel)
|
||||
mcon := selinux.NewContext(mountLabel)
|
||||
for _, opt := range options {
|
||||
if opt == "disable" {
|
||||
return "", "", nil
|
||||
return "", mountLabel, nil
|
||||
}
|
||||
if i := strings.Index(opt, ":"); i == -1 {
|
||||
return "", "", fmt.Errorf("Bad label option %q, valid options 'disable' or \n'user, role, level, type' followed by ':' and a value", opt)
|
||||
@@ -156,6 +161,11 @@ func Init() {
|
||||
selinux.GetEnabled()
|
||||
}
|
||||
|
||||
// ClearLabels will clear all reserved labels
|
||||
func ClearLabels() {
|
||||
selinux.ClearLabels()
|
||||
}
|
||||
|
||||
// ReserveLabel will record the fact that the MCS label has already been used.
|
||||
// This will prevent InitLabels from using the MCS label in a newly created
|
||||
// container
|
||||
|
13
vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go
generated
vendored
13
vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go
generated
vendored
@@ -409,6 +409,13 @@ func NewContext(label string) Context {
|
||||
return c
|
||||
}
|
||||
|
||||
// ClearLabels clears all reserved labels
|
||||
func ClearLabels() {
|
||||
state.Lock()
|
||||
state.mcsList = make(map[string]bool)
|
||||
state.Unlock()
|
||||
}
|
||||
|
||||
// ReserveLabel reserves the MLS/MCS level component of the specified label
|
||||
func ReserveLabel(label string) {
|
||||
if len(label) != 0 {
|
||||
@@ -680,7 +687,11 @@ func Chcon(fpath string, label string, recurse bool) error {
|
||||
return err
|
||||
}
|
||||
callback := func(p string, info os.FileInfo, err error) error {
|
||||
return SetFileLabel(p, label)
|
||||
e := SetFileLabel(p, label)
|
||||
if os.IsNotExist(e) {
|
||||
return nil
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
if recurse {
|
||||
|
5
vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go
generated
vendored
5
vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go
generated
vendored
@@ -107,6 +107,11 @@ func NewContext(label string) Context {
|
||||
return c
|
||||
}
|
||||
|
||||
// ClearLabels clears all reserved MLS/MCS levels
|
||||
func ClearLabels() {
|
||||
return
|
||||
}
|
||||
|
||||
// ReserveLabel reserves the MLS/MCS level component of the specified label
|
||||
func ReserveLabel(label string) {
|
||||
return
|
||||
|
Reference in New Issue
Block a user