summaryrefslogtreecommitdiff
path: root/pkg/util/utils.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-31 08:37:34 -0400
committerGitHub <noreply@github.com>2022-08-31 08:37:34 -0400
commit9b4dac4c4d683619f9015c19c317fcd68b80dcf8 (patch)
tree86ca0b08e269785a28b232791305362f2fc4e0bf /pkg/util/utils.go
parent7503c5544d506826e2d8602d95433eef98208e83 (diff)
parent8637548a3676f29746ca1cce346b09a228c649ae (diff)
downloadpodman-9b4dac4c4d683619f9015c19c317fcd68b80dcf8.tar.gz
podman-9b4dac4c4d683619f9015c19c317fcd68b80dcf8.tar.bz2
podman-9b4dac4c4d683619f9015c19c317fcd68b80dcf8.zip
Merge pull request #15389 from giuseppe/userns-map-user
podman: add uid and gid options to keep-id
Diffstat (limited to 'pkg/util/utils.go')
-rw-r--r--pkg/util/utils.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 33c11d611..87e403986 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -342,7 +342,7 @@ func ParseSignal(rawSignal string) (syscall.Signal, error) {
}
// GetKeepIDMapping returns the mappings and the user to use when keep-id is used
-func GetKeepIDMapping() (*stypes.IDMappingOptions, int, int, error) {
+func GetKeepIDMapping(opts *namespaces.KeepIDUserNsOptions) (*stypes.IDMappingOptions, int, int, error) {
if !rootless.IsRootless() {
return nil, -1, -1, errors.New("keep-id is only supported in rootless mode")
}
@@ -359,6 +359,12 @@ func GetKeepIDMapping() (*stypes.IDMappingOptions, int, int, error) {
uid := rootless.GetRootlessUID()
gid := rootless.GetRootlessGID()
+ if opts.UID != nil {
+ uid = int(*opts.UID)
+ }
+ if opts.GID != nil {
+ gid = int(*opts.GID)
+ }
uids, gids, err := rootless.GetConfiguredMappings()
if err != nil {