New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calls to getpwuid() with an unknown UID fail with ENOENT #1466

Closed
jirwin opened this Issue Jul 19, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@jirwin

jirwin commented Jul 19, 2016

Issue Report

Bug

When calling getpwuid() with an unknown UID, it fails with ENOENT because the file at /var/lib/sss/mc/passwd doesn't exist.

CoreOS Version

$ cat /etc/os-release
NAME=CoreOS
ID=coreos
VERSION=1068.6.0
VERSION_ID=1068.6.0
BUILD_ID=2016-07-12-1826
PRETTY_NAME="CoreOS 1068.6.0 (MoreOS)"
ANSI_COLOR="1;32"
HOME_URL="https://coreos.com/"
BUG_REPORT_URL="https://github.com/coreos/bugs/issues"

Environment

I've tested this on an EC2 instance as well as a Packet server.

Expected Behavior

I would expect my call to getpwuid() with an unknown UID to return an errno of 0, with a NULL resulting object because the user is not found.

Actual Behavior

Calling getpwuid() with an unknown UID returns an ENOENT when trying to look up the user in /var/lib/sss/mc/passwd after failing to find the user in /etc/passwd.

Reproduction Steps

I've created a small Go program that pulls the code from the os.user package.
You can view it here: https://gist.github.com/jirwin/608abc7f2bd64a78fe8fcfae83199bcc#file-main-go. It hardcodes a UID didn't exist on my server. Ensure it is run with a UID that doesn't exist to replicate the error.

Other Information

I've included the strace output of running the above program: https://gist.github.com/jirwin/608abc7f2bd64a78fe8fcfae83199bcc#file-strace-main

I'm fuzzy on what version I've seen this work as expected on before. I'd like to ballpark it around version 1032.1.0. My guess is that the introduction of sssd in 1045.0.0 is the cause of this change in behavior.

@jirwin

This comment has been minimized.

jirwin commented Jul 21, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment