|
|
836b22 |
From 838db4382d064924b73221272d47eef04cd6d57d Mon Sep 17 00:00:00 2001
|
|
|
836b22 |
From: =?UTF-8?q?Pawe=C5=82=20Po=C5=82awski?= <ppolawsk@redhat.com>
|
|
|
836b22 |
Date: Thu, 12 Mar 2020 22:46:47 +0100
|
|
|
836b22 |
Subject: [PATCH 13/14] LDAP: Netgroups refresh in background task
|
|
|
836b22 |
MIME-Version: 1.0
|
|
|
836b22 |
Content-Type: text/plain; charset=UTF-8
|
|
|
836b22 |
Content-Transfer-Encoding: 8bit
|
|
|
836b22 |
|
|
|
836b22 |
refresh_expired_interval config value spawns be_task
|
|
|
836b22 |
responsible for refreshing expired cache entries
|
|
|
836b22 |
in background.
|
|
|
836b22 |
|
|
|
836b22 |
Netgroup related entries are stored in persistent
|
|
|
836b22 |
cache rather than timestamp cache. After sdap_refresh_step()
|
|
|
836b22 |
has been replaced by generic be_refresh_step()
|
|
|
836b22 |
lookup routine was searching for entries only in
|
|
|
836b22 |
timestamp cache. This result in LDAP netgroup entries
|
|
|
836b22 |
not refreshing in background.
|
|
|
836b22 |
|
|
|
836b22 |
Resolves:
|
|
|
836b22 |
https://pagure.io/SSSD/sssd/issue/4177
|
|
|
836b22 |
|
|
|
836b22 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
836b22 |
|
|
|
836b22 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
836b22 |
---
|
|
|
836b22 |
src/providers/be_refresh.c | 8 ++++++--
|
|
|
836b22 |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
836b22 |
|
|
|
836b22 |
diff --git a/src/providers/be_refresh.c b/src/providers/be_refresh.c
|
|
|
836b22 |
index 8f50e231d..d503556a3 100644
|
|
|
836b22 |
--- a/src/providers/be_refresh.c
|
|
|
836b22 |
+++ b/src/providers/be_refresh.c
|
|
|
836b22 |
@@ -35,6 +35,7 @@ static errno_t be_refresh_get_values_ex(TALLOC_CTX *mem_ctx,
|
|
|
836b22 |
struct ldb_dn *base_dn,
|
|
|
836b22 |
const char *key_attr,
|
|
|
836b22 |
const char *value_attr,
|
|
|
836b22 |
+ int optflags,
|
|
|
836b22 |
char ***_values)
|
|
|
836b22 |
{
|
|
|
836b22 |
TALLOC_CTX *tmp_ctx = NULL;
|
|
|
836b22 |
@@ -64,7 +65,7 @@ static errno_t be_refresh_get_values_ex(TALLOC_CTX *mem_ctx,
|
|
|
836b22 |
|
|
|
836b22 |
ret = sysdb_search_with_ts_attr(tmp_ctx, domain, base_dn,
|
|
|
836b22 |
LDB_SCOPE_SUBTREE,
|
|
|
836b22 |
- SYSDB_SEARCH_WITH_TS_ONLY_TS_FILTER,
|
|
|
836b22 |
+ optflags,
|
|
|
836b22 |
filter, attrs,
|
|
|
836b22 |
&res;;
|
|
|
836b22 |
if (ret != EOK) {
|
|
|
836b22 |
@@ -102,6 +103,7 @@ static errno_t be_refresh_get_values(TALLOC_CTX *mem_ctx,
|
|
|
836b22 |
struct ldb_dn *base_dn = NULL;
|
|
|
836b22 |
errno_t ret;
|
|
|
836b22 |
const char *key_attr;
|
|
|
836b22 |
+ int optflags = SYSDB_SEARCH_WITH_TS_ONLY_TS_FILTER;
|
|
|
836b22 |
|
|
|
836b22 |
switch (type) {
|
|
|
836b22 |
case BE_REFRESH_TYPE_INITGROUPS:
|
|
|
836b22 |
@@ -118,6 +120,8 @@ static errno_t be_refresh_get_values(TALLOC_CTX *mem_ctx,
|
|
|
836b22 |
break;
|
|
|
836b22 |
case BE_REFRESH_TYPE_NETGROUPS:
|
|
|
836b22 |
key_attr = SYSDB_CACHE_EXPIRE;
|
|
|
836b22 |
+ // Netgroup will reside in persistent cache rather than timestamp one
|
|
|
836b22 |
+ optflags = SYSDB_SEARCH_WITH_TS_ONLY_SYSDB_FILTER;
|
|
|
836b22 |
base_dn = sysdb_netgroup_base_dn(mem_ctx, domain);
|
|
|
836b22 |
break;
|
|
|
836b22 |
default:
|
|
|
836b22 |
@@ -132,7 +136,7 @@ static errno_t be_refresh_get_values(TALLOC_CTX *mem_ctx,
|
|
|
836b22 |
|
|
|
836b22 |
ret = be_refresh_get_values_ex(mem_ctx, domain, period,
|
|
|
836b22 |
base_dn, key_attr,
|
|
|
836b22 |
- attr_name, _values);
|
|
|
836b22 |
+ attr_name, optflags, _values);
|
|
|
836b22 |
|
|
|
836b22 |
talloc_free(base_dn);
|
|
|
836b22 |
return ret;
|
|
|
836b22 |
--
|
|
|
836b22 |
2.21.1
|
|
|
836b22 |
|