Skip to content
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

getpwuid() fails #175

Open
jbeigel opened this issue Jan 29, 2018 · 3 comments
Open

getpwuid() fails #175

jbeigel opened this issue Jan 29, 2018 · 3 comments

Comments

@jbeigel
Copy link

jbeigel commented Jan 29, 2018

I try to use i3lock on a Linux system with LDAP user account. Later in the code, this seems to be handled correctly via PAM, but right at the start after the option parsing, getpwuid() is called, fails and i3lock immediately exit with the (somewhat funny) error "i3lock: getpwuid() failed: Success"

@SegFault42
Copy link
Contributor

It's because getpwuid return NULL and errno is set to 0 (Success).

If you read the manual, you can see that (in RETURN VALUE and ERRORS section):

If  an error occurs, errno is set appropriately.

ERRORS
       0 or ENOENT or ESRCH or EBADF or EPERM or ...
              The given name or uid was not found.

I don't know how LDAP user acount work with getpwuid().

@Z1NZ
Copy link

Z1NZ commented Feb 16, 2018

Hi @jbeigel @SegFault42

We can have more information about issue like linux (32/64) ? distribution of linux ?
Did you compile source code ?

I find similar issue on stackoverflow
https://stackoverflow.com/questions/18570177/getpwuid-returns-null-for-ldap-user

@stapelberg
Copy link
Member

We could totally add a fallback code path which used the $USER environment variable (if set) when getpwuid fails. @jbeigel would you be able to test such a patch in your environment?

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

No branches or pull requests

4 participants