diff options
author | umohnani8 <umohnani@redhat.com> | 2018-04-20 09:44:37 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-24 14:28:33 +0000 |
commit | cf41dc70b3078a833b323808c26d3a6ab0b25bd7 (patch) | |
tree | f7b301df9b7a381e4e471573f69eef1a30bfa04c /pkg/chrootuser/user_linux.go | |
parent | e76caee3383e3fe95bea197ea043e7abce9afa5c (diff) | |
download | podman-cf41dc70b3078a833b323808c26d3a6ab0b25bd7.tar.gz podman-cf41dc70b3078a833b323808c26d3a6ab0b25bd7.tar.bz2 podman-cf41dc70b3078a833b323808c26d3a6ab0b25bd7.zip |
Modify --user flag for podman create and run
If an integer is passed into the --user flag, i.e --user=1234
don't look up the user in /etc/passwd, just assign the integer as the uid.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #652
Approved by: mheon
Diffstat (limited to 'pkg/chrootuser/user_linux.go')
-rw-r--r-- | pkg/chrootuser/user_linux.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/chrootuser/user_linux.go b/pkg/chrootuser/user_linux.go index 64ff7cef6..d48a1c7c2 100644 --- a/pkg/chrootuser/user_linux.go +++ b/pkg/chrootuser/user_linux.go @@ -4,6 +4,7 @@ package chrootuser import ( "bufio" + "errors" "flag" "fmt" "io" @@ -78,6 +79,9 @@ func openChrootedFile(rootdir, filename string) (*exec.Cmd, io.ReadCloser, error var ( lookupUser, lookupGroup sync.Mutex + // ErrNoSuchUser indicates that the user provided by the caller does not + // exist in /etc/passws + ErrNoSuchUser = errors.New("user does not exist in /etc/passwd") ) type lookupPasswdEntry struct { @@ -207,7 +211,7 @@ func lookupGroupForUIDInContainer(rootdir string, userid uint64) (username strin return pwd.name, pwd.gid, nil } - return "", 0, user.UnknownUserError(fmt.Sprintf("error looking up user with UID %d", userid)) + return "", 0, ErrNoSuchUser } func lookupAdditionalGroupsForUIDInContainer(rootdir string, userid uint64) (gid []uint32, err error) { |