Blame SOURCES/0073-sysdb-add-sysdb_del_autofsentry_by_key.patch

5fca41
From 49b5baf0e6ef978d971427160677c2c95e89c418 Mon Sep 17 00:00:00 2001
5fca41
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
5fca41
Date: Thu, 15 Aug 2019 13:50:17 +0200
5fca41
Subject: [PATCH 73/90] sysdb: add sysdb_del_autofsentry_by_key
5fca41
MIME-Version: 1.0
5fca41
Content-Type: text/plain; charset=UTF-8
5fca41
Content-Transfer-Encoding: 8bit
5fca41
5fca41
Resolves:
5fca41
https://pagure.io/SSSD/sssd/issue/2607
5fca41
5fca41
Reviewed-by: Tomáš Halman <thalman@redhat.com>
5fca41
---
5fca41
 src/db/sysdb_autofs.c | 22 ++++++++++++++++++++++
5fca41
 src/db/sysdb_autofs.h |  5 +++++
5fca41
 2 files changed, 27 insertions(+)
5fca41
5fca41
diff --git a/src/db/sysdb_autofs.c b/src/db/sysdb_autofs.c
5fca41
index 971abafa3..11841d50d 100644
5fca41
--- a/src/db/sysdb_autofs.c
5fca41
+++ b/src/db/sysdb_autofs.c
5fca41
@@ -449,6 +449,28 @@ sysdb_del_autofsentry(struct sss_domain_info *domain,
5fca41
     return ret;
5fca41
 }
5fca41
 
5fca41
+errno_t
5fca41
+sysdb_del_autofsentry_by_key(struct sss_domain_info *domain,
5fca41
+                             const char *map_name,
5fca41
+                             const char *entry_key)
5fca41
+{
5fca41
+    struct ldb_message *entry;
5fca41
+    errno_t ret;
5fca41
+
5fca41
+    ret = sysdb_get_autofsentry(NULL, domain, map_name, entry_key, &entry);
5fca41
+    if (ret == ENOENT) {
5fca41
+        return EOK;
5fca41
+    } else if (ret != EOK) {
5fca41
+        DEBUG(SSSDBG_OP_FAILURE, "Unable to get autofs entry [%d]: %s\n",
5fca41
+              ret, sss_strerror(ret));
5fca41
+        return ret;
5fca41
+    }
5fca41
+
5fca41
+    ret = sysdb_delete_entry(domain->sysdb, entry->dn, true);
5fca41
+    talloc_free(entry);
5fca41
+    return ret;
5fca41
+}
5fca41
+
5fca41
 errno_t
5fca41
 sysdb_autofs_entries_by_map(TALLOC_CTX *mem_ctx,
5fca41
                             struct sss_domain_info *domain,
5fca41
diff --git a/src/db/sysdb_autofs.h b/src/db/sysdb_autofs.h
5fca41
index 79ecbd94e..3775e2a17 100644
5fca41
--- a/src/db/sysdb_autofs.h
5fca41
+++ b/src/db/sysdb_autofs.h
5fca41
@@ -75,6 +75,11 @@ errno_t
5fca41
 sysdb_del_autofsentry(struct sss_domain_info *domain,
5fca41
                       const char *entry_dn);
5fca41
 
5fca41
+errno_t
5fca41
+sysdb_del_autofsentry_by_key(struct sss_domain_info *domain,
5fca41
+                             const char *map_name,
5fca41
+                             const char *entry_key);
5fca41
+
5fca41
 errno_t
5fca41
 sysdb_autofs_entries_by_map(TALLOC_CTX *mem_ctx,
5fca41
                             struct sss_domain_info *domain,
5fca41
-- 
5fca41
2.20.1
5fca41