podman

Форк
0
/
rootless_unsupported.go 
66 строк · 2.3 Кб
1
//go:build !(linux || freebsd) || !cgo
2

3
package rootless
4

5
import (
6
	"errors"
7
	"os"
8

9
	"github.com/containers/storage/pkg/idtools"
10
)
11

12
// IsRootless returns whether the user is rootless
13
func IsRootless() bool {
14
	uid := os.Geteuid()
15
	// os.Geteuid() on Windows returns -1
16
	if uid == -1 {
17
		return false
18
	}
19
	return uid != 0
20
}
21

22
// BecomeRootInUserNS re-exec podman in a new userNS.  It returns whether podman was re-executed
23
// into a new user namespace and the return code from the re-executed podman process.
24
// If podman was re-executed the caller needs to propagate the error code returned by the child
25
// process.  It is a convenience function for BecomeRootInUserNSWithOpts with a default configuration.
26
func BecomeRootInUserNS(pausePid string) (bool, int, error) {
27
	return false, -1, errors.New("this function is not supported on this os")
28
}
29

30
// GetRootlessUID returns the UID of the user in the parent userNS
31
func GetRootlessUID() int {
32
	return -1
33
}
34

35
// GetRootlessGID returns the GID of the user in the parent userNS
36
func GetRootlessGID() int {
37
	return -1
38
}
39

40
// TryJoinFromFilePaths attempts to join the namespaces of the pid files in paths.
41
// This is useful when there are already running containers and we
42
// don't have a pause process yet.  We can use the paths to the conmon
43
// processes to attempt joining their namespaces.
44
// If needNewNamespace is set, the file is read from a temporary user
45
// namespace, this is useful for containers that are running with a
46
// different uidmap and the unprivileged user has no way to read the
47
// file owned by the root in the container.
48
func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []string) (bool, int, error) {
49
	return false, -1, errors.New("this function is not supported on this os")
50
}
51

52
// ConfigurationMatches checks whether the additional uids/gids configured for the user
53
// match the current user namespace.
54
func ConfigurationMatches() (bool, error) {
55
	return true, nil
56
}
57

58
// GetConfiguredMappings returns the additional IDs configured for the current user.
59
func GetConfiguredMappings(quiet bool) ([]idtools.IDMap, []idtools.IDMap, error) {
60
	return nil, nil, errors.New("this function is not supported on this os")
61
}
62

63
// IsFdInherited checks whether the fd is opened and valid to use
64
func IsFdInherited(fd int) bool {
65
	return false
66
}
67

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.