Skip to content
This repository has been archived by the owner. It is now read-only.

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

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

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

jirwin opened this issue Jul 19, 2016 · 1 comment
Assignees

Comments

@jirwin
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.