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

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