]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/pwdutils: don't use getlogin(3).
authorÉrico Nogueira <erico.erc@gmail.com>
Wed, 28 Jul 2021 02:41:30 +0000 (23:41 -0300)
committerÉrico Nogueira <erico.erc@gmail.com>
Thu, 29 Jul 2021 12:56:28 +0000 (09:56 -0300)
commit3386b92e09e8a945cb071808e012e0b600f8bcb2
treeeee68770821851e0bd62fe8c11bb4b5c60cc63ee
parent082b79ff8ed75336822ea65f4b85cc75776e1bfe
lib/pwdutils: don't use getlogin(3).

Per the man page, it shouldn't be used for security purposes. This is an
issue especially on musl, where getlogin is implemented as
getenv("LOGNAME"). Since xgetlogin is being used as user identity in su(1), to
set PAM_RUSER, we simply switch to always using getpwuid(getuid()).

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
lib/pwdutils.c