|
|
b2d430 |
From c0dedeccc42fa7cc14e207182d54595926dfd700 Mon Sep 17 00:00:00 2001
|
|
|
b2d430 |
From: Petr Cech <pcech@redhat.com>
|
|
|
b2d430 |
Date: Fri, 22 Jul 2016 14:28:54 +0200
|
|
|
b2d430 |
Subject: [PATCH 102/102] LDAP: Fixing of removing netgroup from cache
|
|
|
b2d430 |
|
|
|
b2d430 |
There were problem with local key which wasn't properly removed.
|
|
|
b2d430 |
This patch fixes it.
|
|
|
b2d430 |
|
|
|
b2d430 |
Resolves:
|
|
|
b2d430 |
https://fedorahosted.org/sssd/ticket/2841
|
|
|
b2d430 |
---
|
|
|
b2d430 |
src/providers/ldap/sdap_async_netgroups.c | 40 +++++++++++++++++++++++++++++++
|
|
|
b2d430 |
1 file changed, 40 insertions(+)
|
|
|
b2d430 |
|
|
|
b2d430 |
diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c
|
|
|
b2d430 |
index df233d956df70cfcb5f68bd2afc9e2a23c50c3bb..cf7d7b12361f8cc578b891961c0c5566442f1b4e 100644
|
|
|
b2d430 |
--- a/src/providers/ldap/sdap_async_netgroups.c
|
|
|
b2d430 |
+++ b/src/providers/ldap/sdap_async_netgroups.c
|
|
|
b2d430 |
@@ -38,6 +38,35 @@ bool is_dn(const char *str)
|
|
|
b2d430 |
return (ret == LDAP_SUCCESS ? true : false);
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
+static errno_t add_to_missing_attrs(TALLOC_CTX * mem_ctx,
|
|
|
b2d430 |
+ struct sysdb_attrs *attrs,
|
|
|
b2d430 |
+ const char *ext_key,
|
|
|
b2d430 |
+ char ***_missing)
|
|
|
b2d430 |
+{
|
|
|
b2d430 |
+ bool is_present = false;
|
|
|
b2d430 |
+ size_t size = 0;
|
|
|
b2d430 |
+ size_t ret;
|
|
|
b2d430 |
+
|
|
|
b2d430 |
+ for (int i = 0; i < attrs->num; i++) {
|
|
|
b2d430 |
+ if (strcmp(ext_key, attrs->a[i].name) == 0) {
|
|
|
b2d430 |
+ is_present = true;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+ size++;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+
|
|
|
b2d430 |
+ if (is_present == false) {
|
|
|
b2d430 |
+ ret = add_string_to_list(attrs, ext_key, _missing);
|
|
|
b2d430 |
+ if (ret != EOK) {
|
|
|
b2d430 |
+ goto done;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+
|
|
|
b2d430 |
+ ret = EOK;
|
|
|
b2d430 |
+
|
|
|
b2d430 |
+done:
|
|
|
b2d430 |
+ return ret;
|
|
|
b2d430 |
+}
|
|
|
b2d430 |
+
|
|
|
b2d430 |
static errno_t sdap_save_netgroup(TALLOC_CTX *memctx,
|
|
|
b2d430 |
struct sss_domain_info *dom,
|
|
|
b2d430 |
struct sdap_options *opts,
|
|
|
b2d430 |
@@ -138,6 +167,17 @@ static errno_t sdap_save_netgroup(TALLOC_CTX *memctx,
|
|
|
b2d430 |
goto fail;
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
+ /* Prepare SYSDB_NETGROUP_MEMBER removing
|
|
|
b2d430 |
+ * if not present in netgroup_attrs
|
|
|
b2d430 |
+ */
|
|
|
b2d430 |
+ ret = add_to_missing_attrs(attrs, netgroup_attrs, SYSDB_NETGROUP_MEMBER,
|
|
|
b2d430 |
+ &missing);
|
|
|
b2d430 |
+ if (ret != EOK) {
|
|
|
b2d430 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "Failed to add [%s] to missing attributes\n",
|
|
|
b2d430 |
+ SYSDB_NETGROUP_MEMBER);
|
|
|
b2d430 |
+ goto fail;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+
|
|
|
b2d430 |
ret = sysdb_add_netgroup(dom, name, NULL, netgroup_attrs, missing,
|
|
|
b2d430 |
dom->netgroup_timeout, now);
|
|
|
b2d430 |
if (ret) goto fail;
|
|
|
b2d430 |
--
|
|
|
b2d430 |
2.4.11
|
|
|
b2d430 |
|