From 2c0a971010596c122d7a0c0d76c8eb85f16f6d06 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 15 Jan 2013 12:36:24 +0100 Subject: TOOLS: Refresh memcache after changes to local users and groups --- src/tools/sss_groupmod.c | 21 +++++++++++++++++++++ src/tools/sss_usermod.c | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) (limited to 'src/tools') diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c index 1d80c5921..8463857a1 100644 --- a/src/tools/sss_groupmod.c +++ b/src/tools/sss_groupmod.c @@ -214,6 +214,27 @@ int main(int argc, const char **argv) } in_transaction = false; + ret = sss_mc_refresh_group(pc_groupname); + if (ret != EOK) { + ERROR("NSS request failed (%1$d). Entry might remain in memory " + "cache.\n", ret); + /* Nothing we can do about it */ + } + + ret = sss_mc_refresh_grouplist(tctx->octx->addgroups); + if (ret != EOK) { + ERROR("NSS request failed (%1$d). Entry might remain in memory " + "cache.\n", ret); + /* Nothing we can do about it */ + } + + ret = sss_mc_refresh_grouplist(tctx->octx->rmgroups); + if (ret != EOK) { + ERROR("NSS request failed (%1$d). Entry might remain in memory " + "cache.\n", ret); + /* Nothing we can do about it */ + } + done: if (in_transaction) { sret = sysdb_transaction_cancel(tctx->sysdb); diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c index f6730368a..23630435c 100644 --- a/src/tools/sss_usermod.c +++ b/src/tools/sss_usermod.c @@ -236,6 +236,27 @@ int main(int argc, const char **argv) } in_transaction = false; + ret = sss_mc_refresh_user(pc_username); + if (ret != EOK) { + ERROR("NSS request failed (%1$d). Entry might remain in memory " + "cache.\n", ret); + /* Nothing we can do about it */ + } + + ret = sss_mc_refresh_grouplist(tctx->octx->addgroups); + if (ret != EOK) { + ERROR("NSS request failed (%1$d). Entry might remain in memory " + "cache.\n", ret); + /* Nothing we can do about it */ + } + + ret = sss_mc_refresh_grouplist(tctx->octx->rmgroups); + if (ret != EOK) { + ERROR("NSS request failed (%1$d). Entry might remain in memory " + "cache.\n", ret); + /* Nothing we can do about it */ + } + /* Set SELinux login context - must be done after transaction is done * b/c libselinux calls getpwnam */ ret = set_seuser(tctx->octx->name, pc_selinux_user); -- cgit