]> git.ipfire.org Git - thirdparty/systemd.git/commit
shared/offline-passwd: look at /usr/lib/{passwd,group} too 16512/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 18 Jul 2020 12:06:19 +0000 (14:06 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 18 Jul 2020 12:14:19 +0000 (14:14 +0200)
commit241947d1b43556cb2b859fd36aae7352f3b1c8fb
treeb61d50eaab7c84163d3097c874424bfb34337d41
parent3e5d2264b584504769eda3a248b45c3367829e7a
shared/offline-passwd: look at /usr/lib/{passwd,group} too

This changes the code to allow looking at multiple files with different
prefixes, but uses "/etc" and "/usr/lib". rpm-ostree uses
/usr/lib/{passwd,group} with nss-altfiles. I see no harm in simply trying both
paths on all systems.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1857530.

A minor memory leak is fixed: hashmap_put() returns -EEXIST is the key is
present *and* and the value is different. It return 0 if the value is the
same. Thus, we would leak the user/group name if it was specified multiple
times with the same uid/gid. I opted to remove the warning message completely:
with multiple files it is reasonable to have the same name defined more than
once. But even with one file the warning is dubious: all tools that read those
files deal correctly with duplicate entries and we are not writing a linter.
src/shared/offline-passwd.c