mirror of
https://github.com/containers/podman.git
synced 2025-09-26 08:14:14 +08:00
Bump github.com/containers/common from 0.35.0 to 0.35.3
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.35.0 to 0.35.3. - [Release notes](https://github.com/containers/common/releases) - [Commits](https://github.com/containers/common/compare/v0.35.0...v0.35.3) Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
![49699333+dependabot[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
Giuseppe Scrivano

parent
61e3b152fc
commit
f46b34ecd2
4
vendor/github.com/containers/common/pkg/auth/auth.go
generated
vendored
4
vendor/github.com/containers/common/pkg/auth/auth.go
generated
vendored
@ -22,9 +22,7 @@ import (
|
||||
func GetDefaultAuthFile() string {
|
||||
authfile := os.Getenv("REGISTRY_AUTH_FILE")
|
||||
if authfile == "" {
|
||||
if authfile, ok := os.LookupEnv("DOCKER_CONFIG"); ok {
|
||||
logrus.Infof("Using DOCKER_CONFIG environment variable for authfile path %s", authfile)
|
||||
}
|
||||
authfile = os.Getenv("DOCKER_CONFIG")
|
||||
}
|
||||
return authfile
|
||||
}
|
||||
|
30
vendor/github.com/containers/common/pkg/capabilities/capabilities.go
generated
vendored
30
vendor/github.com/containers/common/pkg/capabilities/capabilities.go
generated
vendored
@ -16,6 +16,9 @@ var (
|
||||
// Used internally and populated during init().
|
||||
capabilityList []string
|
||||
|
||||
// Used internally and populated during init().
|
||||
capsList []capability.Cap
|
||||
|
||||
// ErrUnknownCapability is thrown when an unknown capability is processed.
|
||||
ErrUnknownCapability = errors.New("unknown capability")
|
||||
|
||||
@ -28,6 +31,10 @@ var (
|
||||
// Useful on the CLI for `--cap-add=all` etc.
|
||||
const All = "ALL"
|
||||
|
||||
func getCapName(c capability.Cap) string {
|
||||
return "CAP_" + strings.ToUpper(c.String())
|
||||
}
|
||||
|
||||
func init() {
|
||||
last := capability.CAP_LAST_CAP
|
||||
// hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap
|
||||
@ -38,7 +45,8 @@ func init() {
|
||||
if cap > last {
|
||||
continue
|
||||
}
|
||||
capabilityList = append(capabilityList, "CAP_"+strings.ToUpper(cap.String()))
|
||||
capsList = append(capsList, cap)
|
||||
capabilityList = append(capabilityList, getCapName(cap))
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +60,26 @@ func stringInSlice(s string, sl []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// BoundingSet returns the capabilities in the current bounding set
|
||||
func BoundingSet() ([]string, error) {
|
||||
currentCaps, err := capability.NewPid2(0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = currentCaps.Load()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r []string
|
||||
for _, c := range capsList {
|
||||
if !currentCaps.Get(capability.BOUNDING, c) {
|
||||
continue
|
||||
}
|
||||
r = append(r, getCapName(c))
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
// AllCapabilities returns all known capabilities.
|
||||
func AllCapabilities() []string {
|
||||
return capabilityList
|
||||
|
57
vendor/github.com/containers/common/pkg/chown/chown.go
generated
vendored
57
vendor/github.com/containers/common/pkg/chown/chown.go
generated
vendored
@ -4,10 +4,8 @@ import (
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"github.com/containers/storage/pkg/homedir"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// DangerousHostPath validates if a host path is dangerous and should not be modified
|
||||
@ -65,58 +63,3 @@ func DangerousHostPath(path string) (bool, error) {
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// ChangeHostPathOwnership changes the uid and gid ownership of a directory or file within the host.
|
||||
// This is used by the volume U flag to change source volumes ownership
|
||||
func ChangeHostPathOwnership(path string, recursive bool, uid, gid int) error {
|
||||
// Validate if host path can be chowned
|
||||
isDangerous, err := DangerousHostPath(path)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to validate if host path is dangerous")
|
||||
}
|
||||
|
||||
if isDangerous {
|
||||
return errors.Errorf("chowning host path %q is not allowed. You can manually `chown -R %d:%d %s`", path, uid, gid, path)
|
||||
}
|
||||
|
||||
// Chown host path
|
||||
if recursive {
|
||||
err := filepath.Walk(path, func(filePath string, f os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Get current ownership
|
||||
currentUID := int(f.Sys().(*syscall.Stat_t).Uid)
|
||||
currentGID := int(f.Sys().(*syscall.Stat_t).Gid)
|
||||
|
||||
if uid != currentUID || gid != currentGID {
|
||||
return os.Lchown(filePath, uid, gid)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to chown recursively host path")
|
||||
}
|
||||
} else {
|
||||
// Get host path info
|
||||
f, err := os.Lstat(path)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to get host path information")
|
||||
}
|
||||
|
||||
// Get current ownership
|
||||
currentUID := int(f.Sys().(*syscall.Stat_t).Uid)
|
||||
currentGID := int(f.Sys().(*syscall.Stat_t).Gid)
|
||||
|
||||
if uid != currentUID || gid != currentGID {
|
||||
if err := os.Lchown(path, uid, gid); err != nil {
|
||||
return errors.Wrapf(err, "failed to chown host path")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
66
vendor/github.com/containers/common/pkg/chown/chown_unix.go
generated
vendored
Normal file
66
vendor/github.com/containers/common/pkg/chown/chown_unix.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// +build !windows
|
||||
|
||||
package chown
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// ChangeHostPathOwnership changes the uid and gid ownership of a directory or file within the host.
|
||||
// This is used by the volume U flag to change source volumes ownership
|
||||
func ChangeHostPathOwnership(path string, recursive bool, uid, gid int) error {
|
||||
// Validate if host path can be chowned
|
||||
isDangerous, err := DangerousHostPath(path)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to validate if host path is dangerous")
|
||||
}
|
||||
|
||||
if isDangerous {
|
||||
return errors.Errorf("chowning host path %q is not allowed. You can manually `chown -R %d:%d %s`", path, uid, gid, path)
|
||||
}
|
||||
|
||||
// Chown host path
|
||||
if recursive {
|
||||
err := filepath.Walk(path, func(filePath string, f os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Get current ownership
|
||||
currentUID := int(f.Sys().(*syscall.Stat_t).Uid)
|
||||
currentGID := int(f.Sys().(*syscall.Stat_t).Gid)
|
||||
|
||||
if uid != currentUID || gid != currentGID {
|
||||
return os.Lchown(filePath, uid, gid)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to chown recursively host path")
|
||||
}
|
||||
} else {
|
||||
// Get host path info
|
||||
f, err := os.Lstat(path)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to get host path information")
|
||||
}
|
||||
|
||||
// Get current ownership
|
||||
currentUID := int(f.Sys().(*syscall.Stat_t).Uid)
|
||||
currentGID := int(f.Sys().(*syscall.Stat_t).Gid)
|
||||
|
||||
if uid != currentUID || gid != currentGID {
|
||||
if err := os.Lchown(path, uid, gid); err != nil {
|
||||
return errors.Wrapf(err, "failed to chown host path")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
11
vendor/github.com/containers/common/pkg/chown/chown_windows.go
generated
vendored
Normal file
11
vendor/github.com/containers/common/pkg/chown/chown_windows.go
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
package chown
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// ChangeHostPathOwnership changes the uid and gid ownership of a directory or file within the host.
|
||||
// This is used by the volume U flag to change source volumes ownership
|
||||
func ChangeHostPathOwnership(path string, recursive bool, uid, gid int) error {
|
||||
return errors.Errorf("windows not supported")
|
||||
}
|
14
vendor/github.com/containers/common/pkg/completion/completion.go
generated
vendored
14
vendor/github.com/containers/common/pkg/completion/completion.go
generated
vendored
@ -139,3 +139,17 @@ func AutocompleteOS(cmd *cobra.Command, args []string, toComplete string) ([]str
|
||||
completions := []string{"linux", "windows"}
|
||||
return completions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteJSONFormat - Autocomplete format flag option.
|
||||
// -> "json"
|
||||
func AutocompleteJSONFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{"json"}, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteOneArg - Autocomplete one random arg
|
||||
func AutocompleteOneArg(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) == 1 {
|
||||
return nil, cobra.ShellCompDirectiveDefault
|
||||
}
|
||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
6
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
6
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
@ -11,9 +11,9 @@ import (
|
||||
|
||||
"github.com/containers/common/pkg/apparmor"
|
||||
"github.com/containers/common/pkg/cgroupv2"
|
||||
"github.com/containers/storage"
|
||||
"github.com/containers/storage/pkg/homedir"
|
||||
"github.com/containers/storage/pkg/unshare"
|
||||
"github.com/containers/storage/types"
|
||||
"github.com/opencontainers/selinux/go-selinux"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -224,9 +224,9 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
|
||||
c.EventsLogFilePath = filepath.Join(c.TmpDir, "events", "events.log")
|
||||
|
||||
if path, ok := os.LookupEnv("CONTAINERS_STORAGE_CONF"); ok {
|
||||
storage.SetDefaultConfigFilePath(path)
|
||||
types.SetDefaultConfigFilePath(path)
|
||||
}
|
||||
storeOpts, err := storage.DefaultStoreOptions(unshare.IsRootless(), unshare.GetRootlessUID())
|
||||
storeOpts, err := types.DefaultStoreOptions(unshare.IsRootless(), unshare.GetRootlessUID())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
7
vendor/github.com/containers/common/pkg/parse/parse_unix.go
generated
vendored
7
vendor/github.com/containers/common/pkg/parse/parse_unix.go
generated
vendored
@ -7,13 +7,12 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/containers/storage/pkg/unshare"
|
||||
"github.com/opencontainers/runc/libcontainer/configs"
|
||||
"github.com/opencontainers/runc/libcontainer/devices"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func DeviceFromPath(device string) ([]configs.Device, error) {
|
||||
var devs []configs.Device
|
||||
func DeviceFromPath(device string) ([]devices.Device, error) {
|
||||
var devs []devices.Device
|
||||
src, dst, permissions, err := Device(device)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -44,7 +43,7 @@ func DeviceFromPath(device string) ([]configs.Device, error) {
|
||||
}
|
||||
for _, d := range srcDevices {
|
||||
d.Path = filepath.Join(dst, filepath.Base(d.Path))
|
||||
d.Permissions = configs.DevicePermissions(permissions)
|
||||
d.Permissions = devices.Permissions(permissions)
|
||||
devs = append(devs, *d)
|
||||
}
|
||||
return devs, nil
|
||||
|
2
vendor/github.com/containers/common/version/version.go
generated
vendored
2
vendor/github.com/containers/common/version/version.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
// Version is the version of the build.
|
||||
const Version = "0.35.0"
|
||||
const Version = "0.35.3"
|
||||
|
Reference in New Issue
Block a user