dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 999edf37f10c90f8a2e87c16183bac2d0c6fe833 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Mon, 3 Aug 2015 12:58:03 +0200
Subject: [PATCH 40/47] mmap: Invalidate initgroups memory cache after any
 change
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Initgroups memory cache was invalidated only in case on removed user.
it should be invalidated also after changes in group membership.

Resolves:
https://fedorahosted.org/sssd/ticket/2716

Reviewed-by: Michal Židek <mzidek@redhat.com>
(cherry picked from commit ea7839cec593b4a7c678fab52ab864518db6699b)
---
 src/responder/nss/nsssrv_cmd.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index b3998015fa621cad8e06a126a674f94d26158dda..0bfbf0eab115826ebde53b4cfcf6661f2f6328c7 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -3903,14 +3903,6 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
                   ret, strerror(ret));
         }
 
-        ret = sss_mmap_cache_initgr_invalidate(nctx->initgr_mc_ctx,
-                                               &delete_name);
-        if (ret != EOK && ret != ENOENT) {
-            DEBUG(SSSDBG_CRIT_FAILURE,
-                  "Internal failure in memory cache code: %d [%s]\n",
-                  ret, strerror(ret));
-        }
-
         /* Also invalidate his groups */
         changed = true;
     } else {
@@ -3958,6 +3950,15 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
                        ret, strerror(ret));
             }
         }
+
+        to_sized_string(&delete_name, name);
+        ret = sss_mmap_cache_initgr_invalidate(nctx->initgr_mc_ctx,
+                                               &delete_name);
+        if (ret != EOK && ret != ENOENT) {
+            DEBUG(SSSDBG_CRIT_FAILURE,
+                  "Internal failure in memory cache code: %d [%s]\n",
+                  ret, strerror(ret));
+        }
     }
 
 done:
-- 
2.4.3