mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Bump github.com/opencontainers/selinux from 1.8.5 to 1.9.1
Bumps [github.com/opencontainers/selinux](https://github.com/opencontainers/selinux) from 1.8.5 to 1.9.1. - [Release notes](https://github.com/opencontainers/selinux/releases) - [Commits](https://github.com/opencontainers/selinux/compare/v1.8.5...v1.9.1) --- updated-dependencies: - dependency-name: github.com/opencontainers/selinux dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
4
vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go
generated
vendored
4
vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go
generated
vendored
@ -103,9 +103,11 @@ func SetFileCreateLabel(fileLabel string) error {
|
||||
return selinux.SetFSCreateLabel(fileLabel)
|
||||
}
|
||||
|
||||
// Relabel changes the label of path to the filelabel string.
|
||||
// Relabel changes the label of path and all the entries beneath the path.
|
||||
// It changes the MCS label to s0 if shared is true.
|
||||
// This will allow all containers to share the content.
|
||||
//
|
||||
// The path itself is guaranteed to be relabeled last.
|
||||
func Relabel(path string, fileLabel string, shared bool) error {
|
||||
if !selinux.GetEnabled() || fileLabel == "" {
|
||||
return nil
|
||||
|
2
vendor/github.com/opencontainers/selinux/go-selinux/selinux.go
generated
vendored
2
vendor/github.com/opencontainers/selinux/go-selinux/selinux.go
generated
vendored
@ -255,6 +255,8 @@ func CopyLevel(src, dest string) (string, error) {
|
||||
// Chcon changes the fpath file object to the SELinux label label.
|
||||
// If fpath is a directory and recurse is true, then Chcon walks the
|
||||
// directory tree setting the label.
|
||||
//
|
||||
// The fpath itself is guaranteed to be relabeled last.
|
||||
func Chcon(fpath string, label string, recurse bool) error {
|
||||
return chcon(fpath, label, recurse)
|
||||
}
|
||||
|
68
vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go
generated
vendored
68
vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go
generated
vendored
@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@ -16,7 +17,6 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/bits-and-blooms/bitset"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@ -44,7 +44,7 @@ type selinuxState struct {
|
||||
|
||||
type level struct {
|
||||
sens uint
|
||||
cats *bitset.BitSet
|
||||
cats *big.Int
|
||||
}
|
||||
|
||||
type mlsRange struct {
|
||||
@ -455,8 +455,8 @@ func computeCreateContext(source string, target string, class string) (string, e
|
||||
}
|
||||
|
||||
// catsToBitset stores categories in a bitset.
|
||||
func catsToBitset(cats string) (*bitset.BitSet, error) {
|
||||
bitset := &bitset.BitSet{}
|
||||
func catsToBitset(cats string) (*big.Int, error) {
|
||||
bitset := new(big.Int)
|
||||
|
||||
catlist := strings.Split(cats, ",")
|
||||
for _, r := range catlist {
|
||||
@ -471,14 +471,14 @@ func catsToBitset(cats string) (*bitset.BitSet, error) {
|
||||
return nil, err
|
||||
}
|
||||
for i := catstart; i <= catend; i++ {
|
||||
bitset.Set(i)
|
||||
bitset.SetBit(bitset, int(i), 1)
|
||||
}
|
||||
} else {
|
||||
cat, err := parseLevelItem(ranges[0], category)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bitset.Set(cat)
|
||||
bitset.SetBit(bitset, int(cat), 1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,37 +548,30 @@ func rangeStrToMLSRange(rangeStr string) (*mlsRange, error) {
|
||||
|
||||
// bitsetToStr takes a category bitset and returns it in the
|
||||
// canonical selinux syntax
|
||||
func bitsetToStr(c *bitset.BitSet) string {
|
||||
func bitsetToStr(c *big.Int) string {
|
||||
var str string
|
||||
i, e := c.NextSet(0)
|
||||
len := 0
|
||||
for e {
|
||||
if len == 0 {
|
||||
|
||||
length := 0
|
||||
for i := int(c.TrailingZeroBits()); i < c.BitLen(); i++ {
|
||||
if c.Bit(i) == 0 {
|
||||
continue
|
||||
}
|
||||
if length == 0 {
|
||||
if str != "" {
|
||||
str += ","
|
||||
}
|
||||
str += "c" + strconv.Itoa(int(i))
|
||||
str += "c" + strconv.Itoa(i)
|
||||
}
|
||||
|
||||
next, e := c.NextSet(i + 1)
|
||||
if e {
|
||||
// consecutive cats
|
||||
if next == i+1 {
|
||||
len++
|
||||
i = next
|
||||
continue
|
||||
}
|
||||
if c.Bit(i+1) == 1 {
|
||||
length++
|
||||
continue
|
||||
}
|
||||
if len == 1 {
|
||||
str += ",c" + strconv.Itoa(int(i))
|
||||
} else if len > 1 {
|
||||
str += ".c" + strconv.Itoa(int(i))
|
||||
if length == 1 {
|
||||
str += ",c" + strconv.Itoa(i)
|
||||
} else if length > 1 {
|
||||
str += ".c" + strconv.Itoa(i)
|
||||
}
|
||||
if !e {
|
||||
break
|
||||
}
|
||||
len = 0
|
||||
i = next
|
||||
length = 0
|
||||
}
|
||||
|
||||
return str
|
||||
@ -591,13 +584,16 @@ func (l1 *level) equal(l2 *level) bool {
|
||||
if l1.sens != l2.sens {
|
||||
return false
|
||||
}
|
||||
return l1.cats.Equal(l2.cats)
|
||||
if l2.cats == nil || l1.cats == nil {
|
||||
return l2.cats == l1.cats
|
||||
}
|
||||
return l1.cats.Cmp(l2.cats) == 0
|
||||
}
|
||||
|
||||
// String returns an mlsRange as a string.
|
||||
func (m mlsRange) String() string {
|
||||
low := "s" + strconv.Itoa(int(m.low.sens))
|
||||
if m.low.cats != nil && m.low.cats.Count() > 0 {
|
||||
if m.low.cats != nil && m.low.cats.BitLen() > 0 {
|
||||
low += ":" + bitsetToStr(m.low.cats)
|
||||
}
|
||||
|
||||
@ -606,7 +602,7 @@ func (m mlsRange) String() string {
|
||||
}
|
||||
|
||||
high := "s" + strconv.Itoa(int(m.high.sens))
|
||||
if m.high.cats != nil && m.high.cats.Count() > 0 {
|
||||
if m.high.cats != nil && m.high.cats.BitLen() > 0 {
|
||||
high += ":" + bitsetToStr(m.high.cats)
|
||||
}
|
||||
|
||||
@ -656,10 +652,12 @@ func calculateGlbLub(sourceRange, targetRange string) (string, error) {
|
||||
|
||||
/* find the intersecting categories */
|
||||
if s.low.cats != nil && t.low.cats != nil {
|
||||
outrange.low.cats = s.low.cats.Intersection(t.low.cats)
|
||||
outrange.low.cats = new(big.Int)
|
||||
outrange.low.cats.And(s.low.cats, t.low.cats)
|
||||
}
|
||||
if s.high.cats != nil && t.high.cats != nil {
|
||||
outrange.high.cats = s.high.cats.Intersection(t.high.cats)
|
||||
outrange.high.cats = new(big.Int)
|
||||
outrange.high.cats.And(s.high.cats, t.high.cats)
|
||||
}
|
||||
|
||||
return outrange.String(), nil
|
||||
|
12
vendor/github.com/opencontainers/selinux/pkg/pwalk/pwalk.go
generated
vendored
12
vendor/github.com/opencontainers/selinux/pkg/pwalk/pwalk.go
generated
vendored
@ -51,6 +51,9 @@ func WalkN(root string, walkFn WalkFunc, num int) error {
|
||||
var (
|
||||
err error
|
||||
wg sync.WaitGroup
|
||||
|
||||
rootLen = len(root)
|
||||
rootEntry *walkArgs
|
||||
)
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
@ -59,6 +62,11 @@ func WalkN(root string, walkFn WalkFunc, num int) error {
|
||||
close(files)
|
||||
return err
|
||||
}
|
||||
if len(p) == rootLen {
|
||||
// Root entry is processed separately below.
|
||||
rootEntry = &walkArgs{path: p, info: &info}
|
||||
return nil
|
||||
}
|
||||
// add a file to the queue unless a callback sent an error
|
||||
select {
|
||||
case e := <-errCh:
|
||||
@ -92,6 +100,10 @@ func WalkN(root string, walkFn WalkFunc, num int) error {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
if err == nil {
|
||||
err = walkFn(rootEntry.path, *rootEntry.info, nil)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
13
vendor/github.com/opencontainers/selinux/pkg/pwalkdir/pwalkdir.go
generated
vendored
13
vendor/github.com/opencontainers/selinux/pkg/pwalkdir/pwalkdir.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package pwalkdir
|
||||
@ -51,6 +52,9 @@ func WalkN(root string, walkFn fs.WalkDirFunc, num int) error {
|
||||
var (
|
||||
err error
|
||||
wg sync.WaitGroup
|
||||
|
||||
rootLen = len(root)
|
||||
rootEntry *walkArgs
|
||||
)
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
@ -59,6 +63,11 @@ func WalkN(root string, walkFn fs.WalkDirFunc, num int) error {
|
||||
close(files)
|
||||
return err
|
||||
}
|
||||
if len(p) == rootLen {
|
||||
// Root entry is processed separately below.
|
||||
rootEntry = &walkArgs{path: p, entry: entry}
|
||||
return nil
|
||||
}
|
||||
// Add a file to the queue unless a callback sent an error.
|
||||
select {
|
||||
case e := <-errCh:
|
||||
@ -92,6 +101,10 @@ func WalkN(root string, walkFn fs.WalkDirFunc, num int) error {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
if err == nil {
|
||||
err = walkFn(rootEntry.path, rootEntry.entry, nil)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user