|
|
9f2ebf |
From ab9a8db7539bea30effe398d9bd82b1ecadd8a6f Mon Sep 17 00:00:00 2001
|
|
|
9f2ebf |
From: Sumit Bose <sbose@redhat.com>
|
|
|
9f2ebf |
Date: Mon, 20 Nov 2017 12:08:30 +0100
|
|
|
9f2ebf |
Subject: [PATCH 62/67] UTIL: add find_domain_by_object_name_ex()
|
|
|
9f2ebf |
MIME-Version: 1.0
|
|
|
9f2ebf |
Content-Type: text/plain; charset=UTF-8
|
|
|
9f2ebf |
Content-Transfer-Encoding: 8bit
|
|
|
9f2ebf |
|
|
|
9f2ebf |
The _ex version of find_domain_by_object_name() has a additional option
|
|
|
9f2ebf |
'strict'. If set to 'true' NULL is return instead to domain from the
|
|
|
9f2ebf |
first argument. This way the caller can see if the provider object name
|
|
|
9f2ebf |
really contains a known domain.
|
|
|
9f2ebf |
|
|
|
9f2ebf |
Related to https://pagure.io/SSSD/sssd/issue/3579
|
|
|
9f2ebf |
|
|
|
9f2ebf |
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
|
|
|
9f2ebf |
(cherry picked from commit b6d3da6cfe78c6d0ddb854088bc23e293b336401)
|
|
|
9f2ebf |
---
|
|
|
9f2ebf |
src/util/domain_info_utils.c | 17 ++++++++++++++---
|
|
|
9f2ebf |
src/util/util.h | 4 ++++
|
|
|
9f2ebf |
2 files changed, 18 insertions(+), 3 deletions(-)
|
|
|
9f2ebf |
|
|
|
9f2ebf |
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
|
|
|
9f2ebf |
index 3a3f5130a32e2c5fe4b81819bf2de697a4474111..66077092a40111967a98b0937506d9e4472f50d5 100644
|
|
|
9f2ebf |
--- a/src/util/domain_info_utils.c
|
|
|
9f2ebf |
+++ b/src/util/domain_info_utils.c
|
|
|
9f2ebf |
@@ -174,8 +174,8 @@ sss_get_domain_by_sid_ldap_fallback(struct sss_domain_info *domain,
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
struct sss_domain_info *
|
|
|
9f2ebf |
-find_domain_by_object_name(struct sss_domain_info *domain,
|
|
|
9f2ebf |
- const char *object_name)
|
|
|
9f2ebf |
+find_domain_by_object_name_ex(struct sss_domain_info *domain,
|
|
|
9f2ebf |
+ const char *object_name, bool strict)
|
|
|
9f2ebf |
{
|
|
|
9f2ebf |
TALLOC_CTX *tmp_ctx;
|
|
|
9f2ebf |
struct sss_domain_info *dom = NULL;
|
|
|
9f2ebf |
@@ -197,7 +197,11 @@ find_domain_by_object_name(struct sss_domain_info *domain,
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
if (domainname == NULL) {
|
|
|
9f2ebf |
- dom = domain;
|
|
|
9f2ebf |
+ if (strict) {
|
|
|
9f2ebf |
+ dom = NULL;
|
|
|
9f2ebf |
+ } else {
|
|
|
9f2ebf |
+ dom = domain;
|
|
|
9f2ebf |
+ }
|
|
|
9f2ebf |
} else {
|
|
|
9f2ebf |
dom = find_domain_by_name(domain, domainname, true);
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
@@ -207,6 +211,13 @@ done:
|
|
|
9f2ebf |
return dom;
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
+struct sss_domain_info *
|
|
|
9f2ebf |
+find_domain_by_object_name(struct sss_domain_info *domain,
|
|
|
9f2ebf |
+ const char *object_name)
|
|
|
9f2ebf |
+{
|
|
|
9f2ebf |
+ return find_domain_by_object_name_ex(domain, object_name, false);
|
|
|
9f2ebf |
+}
|
|
|
9f2ebf |
+
|
|
|
9f2ebf |
errno_t sssd_domain_init(TALLOC_CTX *mem_ctx,
|
|
|
9f2ebf |
struct confdb_ctx *cdb,
|
|
|
9f2ebf |
const char *domain_name,
|
|
|
9f2ebf |
diff --git a/src/util/util.h b/src/util/util.h
|
|
|
9f2ebf |
index 37383011763a9a2a3c2c066215e3ed94aca77308..2521b1789b0b8701b1fbcce33890eedb7fe18d5e 100644
|
|
|
9f2ebf |
--- a/src/util/util.h
|
|
|
9f2ebf |
+++ b/src/util/util.h
|
|
|
9f2ebf |
@@ -551,6 +551,10 @@ struct sss_domain_info *
|
|
|
9f2ebf |
find_domain_by_object_name(struct sss_domain_info *domain,
|
|
|
9f2ebf |
const char *object_name);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
+struct sss_domain_info *
|
|
|
9f2ebf |
+find_domain_by_object_name_ex(struct sss_domain_info *domain,
|
|
|
9f2ebf |
+ const char *object_name, bool strict);
|
|
|
9f2ebf |
+
|
|
|
9f2ebf |
bool subdomain_enumerates(struct sss_domain_info *parent,
|
|
|
9f2ebf |
const char *sd_name);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
--
|
|
|
9f2ebf |
2.14.3
|
|
|
9f2ebf |
|