]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/nss-mymachines/nss-mymachines.c
nss: when we encounter an invalid user/group name or UID/GID, don't return EINVAL 4989/head
authorLennart Poettering <lennart@poettering.net>
Tue, 27 Dec 2016 16:59:38 +0000 (17:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 27 Dec 2016 17:09:58 +0000 (18:09 +0100)
commitd6c575e303520ffdcee1590a4181410024d5f917
treeca71c10b26f8d59c0a4b6c3b0e1c1c4d04e2882c
parent1429dfe5f8d0e4d2dcc73d1702510697880a46de
nss: when we encounter an invalid user/group name or UID/GID, don't return EINVAL

It's not our business to validate invalid user/group names or UID/GID.
Ideally, libc would filter these out, but they don't, hence we have to
filter, but let's not propagate this as error, but simply as "not found"
to the caller.

User name rules are pretty vaguely defined, and the rules defined by
POSIX clash with reality quite heavily (for example, utmp doesn't offer
enough room for user name length, and /usr/bin/chown permits separating
user/group names by a single dot, even though POSIX allows dots being
used in user/group names themselves.) We enforce stricter rules than
POSIX for good reason, and hence in doing so we should not categorically
return EINVAL on stuff we don't consider valid, but other components
might.

Fixes: #4983
src/nss-mymachines/nss-mymachines.c
src/nss-systemd/nss-systemd.c