|
|
5fca41 |
From 77b4d7a26d92f9aa114d6e8d1073539afeb17fd8 Mon Sep 17 00:00:00 2001
|
|
|
5fca41 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
5fca41 |
Date: Tue, 28 May 2019 14:56:15 +0200
|
|
|
5fca41 |
Subject: [PATCH 46/64] BE: search with sysdb_search_with_ts_attr
|
|
|
5fca41 |
|
|
|
5fca41 |
Previously, the background refresh code had used sysdb_search_entry()
|
|
|
5fca41 |
which does not run the search on the timestamp cache. Instead, this
|
|
|
5fca41 |
patch changes to using sysdb_search_with_ts_attr with the
|
|
|
5fca41 |
SYSDB_SEARCH_WITH_TS_ONLY_TS_FILTER optimization because currently only
|
|
|
5fca41 |
the dataExpireTimestamp attribute is included in the filter.
|
|
|
5fca41 |
|
|
|
5fca41 |
Related:
|
|
|
5fca41 |
https://pagure.io/SSSD/sssd/issue/4012
|
|
|
5fca41 |
|
|
|
5fca41 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
5fca41 |
(cherry picked from commit f27955297603dd7bcbab2569394853d5d9ca90ea)
|
|
|
5fca41 |
|
|
|
5fca41 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
5fca41 |
---
|
|
|
5fca41 |
src/providers/be_refresh.c | 19 +++++++++----------
|
|
|
5fca41 |
1 file changed, 9 insertions(+), 10 deletions(-)
|
|
|
5fca41 |
|
|
|
5fca41 |
diff --git a/src/providers/be_refresh.c b/src/providers/be_refresh.c
|
|
|
5fca41 |
index e8cf5da75..c6bb66b68 100644
|
|
|
5fca41 |
--- a/src/providers/be_refresh.c
|
|
|
5fca41 |
+++ b/src/providers/be_refresh.c
|
|
|
5fca41 |
@@ -40,9 +40,8 @@ static errno_t be_refresh_get_values_ex(TALLOC_CTX *mem_ctx,
|
|
|
5fca41 |
const char *attrs[] = {attr, NULL};
|
|
|
5fca41 |
const char *filter = NULL;
|
|
|
5fca41 |
char **values = NULL;
|
|
|
5fca41 |
- struct ldb_message **msgs = NULL;
|
|
|
5fca41 |
struct sysdb_attrs **records = NULL;
|
|
|
5fca41 |
- size_t count;
|
|
|
5fca41 |
+ struct ldb_result *res;
|
|
|
5fca41 |
time_t now = time(NULL);
|
|
|
5fca41 |
errno_t ret;
|
|
|
5fca41 |
|
|
|
5fca41 |
@@ -58,23 +57,23 @@ static errno_t be_refresh_get_values_ex(TALLOC_CTX *mem_ctx,
|
|
|
5fca41 |
goto done;
|
|
|
5fca41 |
}
|
|
|
5fca41 |
|
|
|
5fca41 |
- ret = sysdb_search_entry(tmp_ctx, domain->sysdb, base_dn,
|
|
|
5fca41 |
- LDB_SCOPE_SUBTREE, filter, attrs,
|
|
|
5fca41 |
- &count, &msgs);
|
|
|
5fca41 |
- if (ret == ENOENT) {
|
|
|
5fca41 |
- count = 0;
|
|
|
5fca41 |
- } else if (ret != EOK) {
|
|
|
5fca41 |
+ ret = sysdb_search_with_ts_attr(tmp_ctx, domain, base_dn,
|
|
|
5fca41 |
+ LDB_SCOPE_SUBTREE,
|
|
|
5fca41 |
+ SYSDB_SEARCH_WITH_TS_ONLY_TS_FILTER,
|
|
|
5fca41 |
+ filter, attrs,
|
|
|
5fca41 |
+ &res;;
|
|
|
5fca41 |
+ if (ret != EOK) {
|
|
|
5fca41 |
goto done;
|
|
|
5fca41 |
}
|
|
|
5fca41 |
|
|
|
5fca41 |
- ret = sysdb_msg2attrs(tmp_ctx, count, msgs, &records);
|
|
|
5fca41 |
+ ret = sysdb_msg2attrs(tmp_ctx, res->count, res->msgs, &records);
|
|
|
5fca41 |
if (ret != EOK) {
|
|
|
5fca41 |
DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
5fca41 |
"Could not convert ldb message to sysdb_attrs\n");
|
|
|
5fca41 |
goto done;
|
|
|
5fca41 |
}
|
|
|
5fca41 |
|
|
|
5fca41 |
- ret = sysdb_attrs_to_list(tmp_ctx, records, count, attr, &values);
|
|
|
5fca41 |
+ ret = sysdb_attrs_to_list(tmp_ctx, records, res->count, attr, &values);
|
|
|
5fca41 |
if (ret != EOK) {
|
|
|
5fca41 |
goto done;
|
|
|
5fca41 |
}
|
|
|
5fca41 |
--
|
|
|
5fca41 |
2.20.1
|
|
|
5fca41 |
|