summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-01-15 12:36:24 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 20:16:05 +0100
commit2c0a971010596c122d7a0c0d76c8eb85f16f6d06 (patch)
tree0abb6718887435cf0286b9909c7cd26d66274029
parent2bb2eadf2b1b7854f430e37689b3e7a25bedfebd (diff)
downloadsssd-2c0a971010596c122d7a0c0d76c8eb85f16f6d06.tar.gz
sssd-2c0a971010596c122d7a0c0d76c8eb85f16f6d06.tar.bz2
sssd-2c0a971010596c122d7a0c0d76c8eb85f16f6d06.zip
TOOLS: Refresh memcache after changes to local users and groups
-rw-r--r--Makefile.am10
-rw-r--r--src/tools/sss_groupmod.c21
-rw-r--r--src/tools/sss_usermod.c21
3 files changed, 50 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 710c1016..5cc00915 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -717,17 +717,23 @@ sss_groupdel_LDFLAGS = \
sss_usermod_SOURCES = \
src/tools/sss_usermod.c \
- $(SSSD_TOOLS_OBJ)
+ $(SSSD_LCL_TOOLS_OBJ)
sss_usermod_LDADD = \
libsss_util.la \
$(TOOLS_LIBS)
+sss_usermod_CFLAGS = $(AM_CFLAGS)
+sss_usermod_LDFLAGS = \
+ $(CLIENT_LIBS)
sss_groupmod_SOURCES = \
src/tools/sss_groupmod.c \
- $(SSSD_TOOLS_OBJ)
+ $(SSSD_LCL_TOOLS_OBJ)
sss_groupmod_LDADD = \
libsss_util.la \
$(TOOLS_LIBS)
+sss_groupmod_CFLAGS = $(AM_CFLAGS)
+sss_groupmod_LDFLAGS = \
+ $(CLIENT_LIBS)
sss_groupshow_SOURCES = \
src/tools/sss_groupshow.c \
diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c
index 1d80c592..8463857a 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 f6730368..23630435 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);