diff options
Diffstat (limited to 'pkg/util')
-rw-r--r-- | pkg/util/utils.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go index 208d815d9..390057c32 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -723,3 +723,11 @@ func SocketPath() (string, error) { // Glue the socket path together return filepath.Join(xdg, "podman", "podman.sock"), nil } + +func LookupUser(name string) (*user.User, error) { + // Assume UID look up first, if it fails lookup by username + if u, err := user.LookupId(name); err == nil { + return u, err + } + return user.Lookup(name) +} |