summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2012-09-11 18:44:52 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-09-24 13:09:53 +0200
commit99c99e557020775714f028b28a147edda290c783 (patch)
tree7364f53b4c921aacf7f81da4864f27d3c9d25c62 /src/tools
parent7c2e91ac48b20e6699d5c98c9912ea6427453c95 (diff)
downloadsssd-99c99e557020775714f028b28a147edda290c783.tar.gz
sssd-99c99e557020775714f028b28a147edda290c783.tar.bz2
sssd-99c99e557020775714f028b28a147edda290c783.zip
sss_cache tool invalidates records in memory cache.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/sss_cache.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 950ff1c1..73d99651 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -100,6 +100,7 @@ int main(int argc, const char *argv[])
struct sysdb_ctx *sysdb;
int i;
bool skipped;
+ FILE *clear_mc_flag;
ret = init_context(argc, argv, &tctx);
if (ret != EOK) {
@@ -141,6 +142,31 @@ int main(int argc, const char *argv[])
ERROR("No cache object matched the specified search\n");
ret = ENOENT;
goto done;
+ } else {
+ /*Local cache changed -> signal monitor to invalidate fastcache */
+ clear_mc_flag = fopen(SSS_NSS_MCACHE_DIR"/"CLEAR_MC_FLAG, "w");
+ if (clear_mc_flag == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Failed to create clear_mc_flag file. "
+ "Memory cache will not be cleared.\n"));
+ goto done;
+ }
+ ret = fclose(clear_mc_flag);
+ if (ret != 0) {
+ ret = errno;
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Unable to close file descriptor: %s\n",
+ strerror(ret)));
+ goto done;
+ }
+
+ DEBUG(SSSDBG_TRACE_FUNC, ("Sending SIGHUP to monitor.\n"));
+ ret = signal_sssd(SIGHUP);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Failed to send SIGHUP to monitor.\n"));
+ goto done;
+ }
}
}