Blame SOURCES/0040-mmap-Invalidate-initgroups-memory-cache-after-any-ch.patch

6cf099
From 999edf37f10c90f8a2e87c16183bac2d0c6fe833 Mon Sep 17 00:00:00 2001
6cf099
From: Lukas Slebodnik <lslebodn@redhat.com>
6cf099
Date: Mon, 3 Aug 2015 12:58:03 +0200
6cf099
Subject: [PATCH 40/47] mmap: Invalidate initgroups memory cache after any
6cf099
 change
6cf099
MIME-Version: 1.0
6cf099
Content-Type: text/plain; charset=UTF-8
6cf099
Content-Transfer-Encoding: 8bit
6cf099
6cf099
Initgroups memory cache was invalidated only in case on removed user.
6cf099
it should be invalidated also after changes in group membership.
6cf099
6cf099
Resolves:
6cf099
https://fedorahosted.org/sssd/ticket/2716
6cf099
6cf099
Reviewed-by: Michal Židek <mzidek@redhat.com>
6cf099
(cherry picked from commit ea7839cec593b4a7c678fab52ab864518db6699b)
6cf099
---
6cf099
 src/responder/nss/nsssrv_cmd.c | 17 +++++++++--------
6cf099
 1 file changed, 9 insertions(+), 8 deletions(-)
6cf099
6cf099
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
6cf099
index b3998015fa621cad8e06a126a674f94d26158dda..0bfbf0eab115826ebde53b4cfcf6661f2f6328c7 100644
6cf099
--- a/src/responder/nss/nsssrv_cmd.c
6cf099
+++ b/src/responder/nss/nsssrv_cmd.c
6cf099
@@ -3903,14 +3903,6 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
6cf099
                   ret, strerror(ret));
6cf099
         }
6cf099
 
6cf099
-        ret = sss_mmap_cache_initgr_invalidate(nctx->initgr_mc_ctx,
6cf099
-                                               &delete_name);
6cf099
-        if (ret != EOK && ret != ENOENT) {
6cf099
-            DEBUG(SSSDBG_CRIT_FAILURE,
6cf099
-                  "Internal failure in memory cache code: %d [%s]\n",
6cf099
-                  ret, strerror(ret));
6cf099
-        }
6cf099
-
6cf099
         /* Also invalidate his groups */
6cf099
         changed = true;
6cf099
     } else {
6cf099
@@ -3958,6 +3950,15 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
6cf099
                        ret, strerror(ret));
6cf099
             }
6cf099
         }
6cf099
+
6cf099
+        to_sized_string(&delete_name, name);
6cf099
+        ret = sss_mmap_cache_initgr_invalidate(nctx->initgr_mc_ctx,
6cf099
+                                               &delete_name);
6cf099
+        if (ret != EOK && ret != ENOENT) {
6cf099
+            DEBUG(SSSDBG_CRIT_FAILURE,
6cf099
+                  "Internal failure in memory cache code: %d [%s]\n",
6cf099
+                  ret, strerror(ret));
6cf099
+        }
6cf099
     }
6cf099
 
6cf099
 done:
6cf099
-- 
6cf099
2.4.3
6cf099