From 8e3bfd459426db32d54f44c65eed726ad9971485a634de31d028ff87c12af237 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Tue, 19 Jan 2021 15:20:59 +0000 Subject: [PATCH] Accepting request 864336 from home:kukuk:etc - If systemd-sysusers is used to create a new user/group, invalidate the nscd passwd and group cache to make the new user/group visible immediately as workaround [bsc#1181121]. Needs to be removed after sytemd-sysusers get's fixed, since we invalidate the cache even if the user/group file wasn't changed. OBS-URL: https://build.opensuse.org/request/show/864336 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=36 --- sysuser-tools.changes | 9 +++++++++ sysusers2shadow.sh | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sysuser-tools.changes b/sysuser-tools.changes index 6c154fe..902fecd 100644 --- a/sysuser-tools.changes +++ b/sysuser-tools.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Jan 19 15:15:41 UTC 2021 - Thorsten Kukuk + +- If systemd-sysusers is used to create a new user/group, invalidate + the nscd passwd and group cache to make the new user/group + visible immediately as workaround [bsc#1181121]. + Needs to be removed after sytemd-sysusers get's fixed, since we + invalidate the cache even if the user/group file wasn't changed. + ------------------------------------------------------------------- Sun Jan 17 21:16:25 UTC 2021 - Thorsten Kukuk diff --git a/sysusers2shadow.sh b/sysusers2shadow.sh index 492e461..f8db958 100644 --- a/sysusers2shadow.sh +++ b/sysusers2shadow.sh @@ -11,7 +11,12 @@ if [ -x /usr/bin/systemd-sysusers ]; then # Use systemd-sysusers and let it read the input directly from stdin /usr/bin/systemd-sysusers - - + # We need to clear the nscd cache, as systemd-sysusers could have + # triggered a negative cache entry + if [ -x /usr/sbin/nscd ]; then + /usr/sbin/nscd -i passwd + /usr/sbin/nscd -i group + fi else # Absolute path to busybox, if found