From dd2033c40c2fab6068b4d9d698a19b502d951a9e Mon Sep 17 00:00:00 2001 From: Charlie Vuillemez Date: Wed, 27 Feb 2019 17:28:39 +0100 Subject: [PATCH] Do not flush nscd and sssd cache in read-only mode Fix #155 signed-off-by: Charlie Vuillemez --- src/grpck.c | 6 ++++-- src/pwck.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/grpck.c b/src/grpck.c index 6140b10d..e6216efa 100644 --- a/src/grpck.c +++ b/src/grpck.c @@ -870,8 +870,10 @@ int main (int argc, char **argv) /* Commit the change in the database if needed */ close_files (changed); - nscd_flush_cache ("group"); - sssd_flush_cache (SSSD_DB_GROUP); + if (!read_only) { + nscd_flush_cache ("group"); + sssd_flush_cache (SSSD_DB_GROUP); + } /* * Tell the user what we did and exit. diff --git a/src/pwck.c b/src/pwck.c index 0ffb711e..b9603a5c 100644 --- a/src/pwck.c +++ b/src/pwck.c @@ -877,8 +877,10 @@ int main (int argc, char **argv) close_files (changed); - nscd_flush_cache ("passwd"); - sssd_flush_cache (SSSD_DB_PASSWD); + if (!read_only) { + nscd_flush_cache ("passwd"); + sssd_flush_cache (SSSD_DB_PASSWD); + } /* * Tell the user what we did and exit.