]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysusers: flush nscd's caches whenever /etc/{passwd,group} are modified
authorFranck Bui <fbui@suse.com>
Mon, 25 Jan 2021 15:32:44 +0000 (16:32 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Jan 2021 10:21:49 +0000 (11:21 +0100)
src/sysusers/sysusers.c

index 4f78e3d065ba74f43a79deb4b45247e392544712..648d1922008c67b531936fdff06a3eb5a9441c3d 100644 (file)
@@ -15,6 +15,7 @@
 #include "hashmap.h"
 #include "main-func.h"
 #include "mount-util.h"
+#include "nscd-flush.h"
 #include "pager.h"
 #include "path-util.h"
 #include "pretty-print.h"
@@ -798,6 +799,9 @@ static int write_files(void) {
                         return r;
 
                 group_tmp = mfree(group_tmp);
+
+                if (!arg_root && !arg_image)
+                        (void) nscd_flush_cache(STRV_MAKE("group"));
         }
         if (gshadow) {
                 r = rename_and_apply_smack_floor_label(gshadow_tmp, gshadow_path);
@@ -813,6 +817,9 @@ static int write_files(void) {
                         return r;
 
                 passwd_tmp = mfree(passwd_tmp);
+
+                if (!arg_root && !arg_image)
+                        (void) nscd_flush_cache(STRV_MAKE("passwd"));
         }
         if (shadow) {
                 r = rename_and_apply_smack_floor_label(shadow_tmp, shadow_path);