Blame SOURCES/0175-SYSDB-Return-ERR_NO_TS-when-there-s-no-timestamp-cac.patch

ecf709
From 10b75d84300726e5e311b0488352b891f106d631 Mon Sep 17 00:00:00 2001
ecf709
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
ecf709
Date: Wed, 24 May 2017 00:35:23 +0200
ecf709
Subject: [PATCH 175/181] SYSDB: Return ERR_NO_TS when there's no timestamp
ecf709
 cache present
ecf709
MIME-Version: 1.0
ecf709
Content-Type: text/plain; charset=UTF-8
ecf709
Content-Transfer-Encoding: 8bit
ecf709
ecf709
This change affects sysdb_search_ts_{users,groups} functions and is
ecf709
mainly needed in order to avoid breaking our current tests due to the
ecf709
changes planned for fixing https://pagure.io/SSSD/sssd/issue/3369.
ecf709
ecf709
Related:
ecf709
https://pagure.io/SSSD/sssd/issue/3369
ecf709
ecf709
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
ecf709
ecf709
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
ecf709
(cherry picked from commit 01c6bb9b47401f9f14c4cfe5c5f03fce2e63629b)
ecf709
---
ecf709
 src/db/sysdb_ops.c    | 4 ++--
ecf709
 src/db/sysdb_search.c | 8 ++++++++
ecf709
 2 files changed, 10 insertions(+), 2 deletions(-)
ecf709
ecf709
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
ecf709
index 4d7b2abd8026c90aaf4e7be687102e459cf3690e..12f8095d2edc60ffab09c92d64f968892c577bbf 100644
ecf709
--- a/src/db/sysdb_ops.c
ecf709
+++ b/src/db/sysdb_ops.c
ecf709
@@ -3520,7 +3520,7 @@ int sysdb_search_ts_users(TALLOC_CTX *mem_ctx,
ecf709
     ZERO_STRUCT(*res);
ecf709
 
ecf709
     if (domain->sysdb->ldb_ts == NULL) {
ecf709
-        return ENOENT;
ecf709
+        return ERR_NO_TS;
ecf709
     }
ecf709
 
ecf709
     ret = sysdb_cache_search_users(mem_ctx, domain, domain->sysdb->ldb_ts,
ecf709
@@ -3737,7 +3737,7 @@ int sysdb_search_ts_groups(TALLOC_CTX *mem_ctx,
ecf709
     ZERO_STRUCT(*res);
ecf709
 
ecf709
     if (domain->sysdb->ldb_ts == NULL) {
ecf709
-        return ENOENT;
ecf709
+        return ERR_NO_TS;
ecf709
     }
ecf709
 
ecf709
     ret = sysdb_cache_search_groups(mem_ctx, domain, domain->sysdb->ldb_ts,
ecf709
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
ecf709
index 474bc08f0b2fe3b0289cbea96fbf2619ced271e7..6b4b51383d89788052ab7e4b572e86abba5330db 100644
ecf709
--- a/src/db/sysdb_search.c
ecf709
+++ b/src/db/sysdb_search.c
ecf709
@@ -587,6 +587,10 @@ int sysdb_enumpwent_filter(TALLOC_CTX *mem_ctx,
ecf709
     ret = sysdb_search_ts_users(tmp_ctx, domain, ts_filter,
ecf709
                                 sysdb_ts_cache_attrs,
ecf709
                                 &ts_res);
ecf709
+    if (ret == ERR_NO_TS) {
ecf709
+        ret = ENOENT;
ecf709
+    }
ecf709
+
ecf709
     if (ret != EOK && ret != ENOENT) {
ecf709
         goto done;
ecf709
     }
ecf709
@@ -1088,6 +1092,10 @@ int sysdb_enumgrent_filter(TALLOC_CTX *mem_ctx,
ecf709
     ret = sysdb_search_ts_groups(tmp_ctx, domain, ts_filter,
ecf709
                                  sysdb_ts_cache_attrs,
ecf709
                                  &ts_res);
ecf709
+    if (ret == ERR_NO_TS) {
ecf709
+        ret = ENOENT;
ecf709
+    }
ecf709
+
ecf709
     if (ret != EOK && ret != ENOENT) {
ecf709
         goto done;
ecf709
     }
ecf709
-- 
ecf709
2.9.4
ecf709