|
|
ced1f5 |
From 0e5d9f481daeeaecefeb68cdc03e45a11dfd7091 Mon Sep 17 00:00:00 2001
|
|
|
ced1f5 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
ced1f5 |
Date: Tue, 7 Nov 2017 17:03:13 +0100
|
|
|
ced1f5 |
Subject: [PATCH 68/83] SDAP: Split out utility function
|
|
|
ced1f5 |
sdap_get_object_domain() from sdap_object_in_domain()
|
|
|
ced1f5 |
MIME-Version: 1.0
|
|
|
ced1f5 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ced1f5 |
Content-Transfer-Encoding: 8bit
|
|
|
ced1f5 |
|
|
|
ced1f5 |
The DP request that returns a domain of an entry to responder will need
|
|
|
ced1f5 |
this functionality in order to map the original DN of the entry found
|
|
|
ced1f5 |
to a domain name.
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
ced1f5 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
ced1f5 |
(cherry picked from commit 37fdd9dc1ad5968067f8e3c43a51ed2ac9f3b104)
|
|
|
ced1f5 |
---
|
|
|
ced1f5 |
src/providers/ldap/sdap.c | 26 ++++++++++++++++++++------
|
|
|
ced1f5 |
src/providers/ldap/sdap.h | 4 ++++
|
|
|
ced1f5 |
2 files changed, 24 insertions(+), 6 deletions(-)
|
|
|
ced1f5 |
|
|
|
ced1f5 |
diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c
|
|
|
ced1f5 |
index b6b1c91cb7507ebb95cd559634a77ed44dfb5fc0..59d24fed53cc35751b5c24679e247a42f82e1d0a 100644
|
|
|
ced1f5 |
--- a/src/providers/ldap/sdap.c
|
|
|
ced1f5 |
+++ b/src/providers/ldap/sdap.c
|
|
|
ced1f5 |
@@ -1673,9 +1673,9 @@ char *sdap_make_oc_list(TALLOC_CTX *mem_ctx, struct sdap_attr_map *map)
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
-bool sdap_object_in_domain(struct sdap_options *opts,
|
|
|
ced1f5 |
- struct sysdb_attrs *obj,
|
|
|
ced1f5 |
- struct sss_domain_info *dom)
|
|
|
ced1f5 |
+struct sss_domain_info *sdap_get_object_domain(struct sdap_options *opts,
|
|
|
ced1f5 |
+ struct sysdb_attrs *obj,
|
|
|
ced1f5 |
+ struct sss_domain_info *dom)
|
|
|
ced1f5 |
{
|
|
|
ced1f5 |
errno_t ret;
|
|
|
ced1f5 |
const char *original_dn = NULL;
|
|
|
ced1f5 |
@@ -1685,7 +1685,7 @@ bool sdap_object_in_domain(struct sdap_options *opts,
|
|
|
ced1f5 |
if (ret) {
|
|
|
ced1f5 |
DEBUG(SSSDBG_FUNC_DATA,
|
|
|
ced1f5 |
"The group has no original DN, assuming our domain\n");
|
|
|
ced1f5 |
- return true;
|
|
|
ced1f5 |
+ return dom;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
sdmatch = sdap_domain_get_by_dn(opts, original_dn);
|
|
|
ced1f5 |
@@ -1693,10 +1693,24 @@ bool sdap_object_in_domain(struct sdap_options *opts,
|
|
|
ced1f5 |
DEBUG(SSSDBG_FUNC_DATA,
|
|
|
ced1f5 |
"The original DN of the group cannot "
|
|
|
ced1f5 |
"be related to any search base\n");
|
|
|
ced1f5 |
- return true;
|
|
|
ced1f5 |
+ return dom;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
- return (sdmatch->dom == dom);
|
|
|
ced1f5 |
+ return sdmatch->dom;
|
|
|
ced1f5 |
+}
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+bool sdap_object_in_domain(struct sdap_options *opts,
|
|
|
ced1f5 |
+ struct sysdb_attrs *obj,
|
|
|
ced1f5 |
+ struct sss_domain_info *dom)
|
|
|
ced1f5 |
+{
|
|
|
ced1f5 |
+ struct sss_domain_info *obj_dom;
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ obj_dom = sdap_get_object_domain(opts, obj, dom);
|
|
|
ced1f5 |
+ if (obj_dom == NULL) {
|
|
|
ced1f5 |
+ return false;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ return (obj_dom == dom);
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
size_t sdap_steal_objects_in_dom(struct sdap_options *opts,
|
|
|
ced1f5 |
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
|
|
|
ced1f5 |
index 2ba016ff52313198287ac5196e24517333882099..8b0f1f0ce0fef59554270f0f31cfd2d5f0aa57f5 100644
|
|
|
ced1f5 |
--- a/src/providers/ldap/sdap.h
|
|
|
ced1f5 |
+++ b/src/providers/ldap/sdap.h
|
|
|
ced1f5 |
@@ -644,6 +644,10 @@ size_t sdap_steal_objects_in_dom(struct sdap_options *opts,
|
|
|
ced1f5 |
size_t count,
|
|
|
ced1f5 |
bool filter);
|
|
|
ced1f5 |
|
|
|
ced1f5 |
+struct sss_domain_info *sdap_get_object_domain(struct sdap_options *opts,
|
|
|
ced1f5 |
+ struct sysdb_attrs *obj,
|
|
|
ced1f5 |
+ struct sss_domain_info *dom);
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
bool sdap_object_in_domain(struct sdap_options *opts,
|
|
|
ced1f5 |
struct sysdb_attrs *obj,
|
|
|
ced1f5 |
struct sss_domain_info *dom);
|
|
|
ced1f5 |
--
|
|
|
ced1f5 |
2.14.3
|
|
|
ced1f5 |
|