URL: https://github.com/SSSD/sssd/pull/1006
Author: elkoniu
 Title: #1006: LDAP: Netgroups refresh in background task
Action: opened

PR body:
"""
refresh_expired_interval config value spawns be_task
responsible for refreshing expired cache entries
in background.

Netgroup related entries are stored in persistent
cache rather than timestamp cache. After sdap_refresh_step()
has been replaced by generic be_refresh_step()
lookup routine was searching for entries only in
timestamp cache. This result in LDAP netgroup entries
not refreshing in background.

Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1779486
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/1006/head:pr1006
git checkout pr1006
From bf02aa268efeccaca7b02c3202d3888845925a13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Po=C5=82awski?= <[email protected]>
Date: Thu, 12 Mar 2020 22:46:47 +0100
Subject: [PATCH] LDAP: Netgroups refresh in background task

refresh_expired_interval config value spawns be_task
responsible for refreshing expired cache entries
in background.

Netgroup related entries are stored in persistent
cache rather than timestamp cache. After sdap_refresh_step()
has been replaced by generic be_refresh_step()
lookup routine was searching for entries only in
timestamp cache. This result in LDAP netgroup entries
not refreshing in background.

Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1779486
---
 src/providers/be_refresh.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/providers/be_refresh.c b/src/providers/be_refresh.c
index 5e43571ce8..abd8ef91d3 100644
--- a/src/providers/be_refresh.c
+++ b/src/providers/be_refresh.c
@@ -35,7 +35,8 @@ static errno_t be_refresh_get_values_ex(TALLOC_CTX *mem_ctx,
                                         struct ldb_dn *base_dn,
                                         const char *key_attr,
                                         const char *value_attr,
-                                        char ***_values)
+                                        char ***_values,
+                                        int optflags)
 {
     TALLOC_CTX *tmp_ctx = NULL;
     const char *attrs[] = {value_attr, NULL};
@@ -64,7 +65,7 @@ static errno_t be_refresh_get_values_ex(TALLOC_CTX *mem_ctx,
 
     ret = sysdb_search_with_ts_attr(tmp_ctx, domain, base_dn,
                                     LDB_SCOPE_SUBTREE,
-                                    SYSDB_SEARCH_WITH_TS_ONLY_TS_FILTER,
+                                    optflags,
                                     filter, attrs,
                                     &res);
     if (ret != EOK) {
@@ -102,6 +103,7 @@ static errno_t be_refresh_get_values(TALLOC_CTX *mem_ctx,
     struct ldb_dn *base_dn = NULL;
     errno_t ret;
     const char *key_attr;
+    int optflags = SYSDB_SEARCH_WITH_TS_ONLY_TS_FILTER;
 
     switch (type) {
     case BE_REFRESH_TYPE_INITGROUPS:
@@ -118,6 +120,8 @@ static errno_t be_refresh_get_values(TALLOC_CTX *mem_ctx,
         break;
     case BE_REFRESH_TYPE_NETGROUPS:
         key_attr = SYSDB_CACHE_EXPIRE;
+        // Netgroup will reside in persistent cache rather than timestamp one
+        optflags = SYSDB_SEARCH_WITH_TS_ONLY_SYSDB_FILTER;
         base_dn = sysdb_netgroup_base_dn(mem_ctx, domain);
         break;
     default:
@@ -132,7 +136,8 @@ static errno_t be_refresh_get_values(TALLOC_CTX *mem_ctx,
 
     ret = be_refresh_get_values_ex(mem_ctx, domain, period,
                                    base_dn, key_attr,
-                                   attr_name, _values);
+                                   attr_name, _values,
+                                   optflags);
 
     talloc_free(base_dn);
     return ret;
_______________________________________________
sssd-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/[email protected]

Reply via email to