From: Franck Bui Date: Mon, 25 Jan 2021 15:32:44 +0000 (+0100) Subject: sysusers: flush nscd's caches whenever /etc/{passwd,group} are modified X-Git-Tag: v248-rc1~254 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d481b8305280cc7780fcd1ce2c391f12ff31786f;p=thirdparty%2Fsystemd.git sysusers: flush nscd's caches whenever /etc/{passwd,group} are modified --- diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 4f78e3d065b..648d1922008 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -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);