Avoid returning the UID when resolving the GIDs. (#2689)

* Fix GetUIDAndGIDFromString test.

* Avoid returning by default the UID when resolving the GIDs.
This commit is contained in:
Diego Gonzalez
2023-08-31 18:05:27 -07:00
committed by GitHub
parent 237778c179
commit 2b6b5948da
3 changed files with 39 additions and 31 deletions
+7
View File
@@ -19,6 +19,7 @@ package util
import (
"fmt"
"strconv"
"strings"
"syscall"
"github.com/pkg/errors"
@@ -54,6 +55,12 @@ func SyscallCredentials(userStr string) (*syscall.Credential, error) {
groups = append(groups, uint32(i))
}
if !(len(strings.Split(userStr, ":")) > 1) {
if u.Gid != "" {
gid, _ = getGID(u.Gid)
}
}
return &syscall.Credential{
Uid: uid,
Gid: gid,