dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 9131b90f08e69a4d71c6d1524e3b8929d947b7c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Thu, 5 Sep 2019 11:32:53 +0200
Subject: [PATCH 90/90] sss_cache: invalidate also autofs entries
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Invalidating map will also invalidate all its child entries.

Resolves:
https://pagure.io/SSSD/sssd/issue/2607

Reviewed-by: Tomáš Halman <thalman@redhat.com>
---
 src/tools/sss_cache.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 6bdcf610c..34bfa76bc 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -576,8 +576,23 @@ static errno_t invalidate_entry(TALLOC_CTX *ctx,
                                                  sys_attrs, SYSDB_MOD_REP);
                     break;
                 case TYPE_AUTOFSMAP:
+                    /* For users, we also need to reset the enumeration
+                     * expiration time. */
+                    ret = sysdb_attrs_add_time_t(sys_attrs,
+                                                 SYSDB_ENUM_EXPIRE, 1);
+                    if (ret != EOK) {
+                        return ret;
+                    }
+
                     ret = sysdb_set_autofsmap_attr(domain, name,
                                                    sys_attrs, SYSDB_MOD_REP);
+                    if (ret != EOK) {
+                        DEBUG(SSSDBG_MINOR_FAILURE, "Could not invalidate "
+                              "autofs map %s\n", name);
+                        break;
+                    }
+
+                    ret = sysdb_invalidate_autofs_entries(domain, name);
                     break;
                 case TYPE_SSH_HOST:
 #ifdef BUILD_SSH
-- 
2.20.1