Blame SOURCES/0169-CACHE_REQ_SEARCH-Check-for-filtered-users-groups-als.patch

bb7cd1
From 79f389eb400eddc133824b079f8bd49ced24643b Mon Sep 17 00:00:00 2001
bb7cd1
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
bb7cd1
Date: Wed, 17 May 2017 14:43:39 +0200
bb7cd1
Subject: [PATCH 169/169] CACHE_REQ_SEARCH: Check for filtered users/groups
bb7cd1
 also on cache_req_send()
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
cache_req_send() may take some shortcuts in case the object is found in
bb7cd1
the cache and it's still valid.
bb7cd1
bb7cd1
This behaviour may lead to exposing filtered users and groups when
bb7cd1
they're searched by their uid/gid.
bb7cd1
bb7cd1
A solution for this issue was proposed on 4ef0b19a but, unfortunately,
bb7cd1
didn't take into consideration that this shortcut could be taken.
bb7cd1
bb7cd1
There are basically two really easy ways to test this issue:
bb7cd1
 1) Using enumeration:
bb7cd1
    - Set "enumerate = True" in the domain section
bb7cd1
    - restart SSSD cleaning up the cache;
bb7cd1
    - getent passwd <uid of a user who is part of the filter_users>
bb7cd1
    - Wait a little bit till the entry_negative_timeout is expired
bb7cd1
    - getent passwd <same uid used above>
bb7cd1
bb7cd1
 2) Not using enumeration:
bb7cd1
   - getent passwd <uid of a user who is part of the filter_users>
bb7cd1
   - Wait a little bit till the entry_negative_timeout is expired
bb7cd1
   - getent passwd <same uid used above>
bb7cd1
bb7cd1
A test covering this code path will be added in the follow-up commit.
bb7cd1
bb7cd1
Resolves:
bb7cd1
https://pagure.io/SSSD/sssd/issue/3362
bb7cd1
bb7cd1
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
bb7cd1
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
bb7cd1
(cherry picked from commit 4c09cd008967c5c0ec358dc658ffc6fc1cef2697)
bb7cd1
---
bb7cd1
 src/responder/common/cache_req/cache_req_search.c | 4 ++++
bb7cd1
 1 file changed, 4 insertions(+)
bb7cd1
bb7cd1
diff --git a/src/responder/common/cache_req/cache_req_search.c b/src/responder/common/cache_req/cache_req_search.c
bb7cd1
index d3aaa7542ddfd28716fbf9cdcedfeadb649dbaa0..56d0345cd8f98de574961d3c9628ae7a4c24f9be 100644
bb7cd1
--- a/src/responder/common/cache_req/cache_req_search.c
bb7cd1
+++ b/src/responder/common/cache_req/cache_req_search.c
bb7cd1
@@ -334,6 +334,10 @@ cache_req_search_send(TALLOC_CTX *mem_ctx,
bb7cd1
 
bb7cd1
 done:
bb7cd1
     if (ret == EOK) {
bb7cd1
+        ret = cache_req_search_ncache_filter(state, cr, &state->result);
bb7cd1
+    }
bb7cd1
+
bb7cd1
+    if (ret == EOK) {
bb7cd1
         tevent_req_done(req);
bb7cd1
     } else {
bb7cd1
         tevent_req_error(req, ret);
bb7cd1
-- 
bb7cd1
2.9.4
bb7cd1