387014f928
required for building freeipa-4.5.x in rawhide
128 lines
5.4 KiB
Diff
128 lines
5.4 KiB
Diff
From e0e038218580166648ac24f23180f0f4c2769d99 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
|
|
Date: Tue, 28 Mar 2017 18:33:46 +0200
|
|
Subject: [PATCH 43/97] UTIL: Introduce subdomain_create_conf_path()
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This is a utility function that replaces the create_subdom_conf_path().
|
|
Differently than the latter, it only takes one parameter and is going to
|
|
be used in a few different places (thus adding it to util.h).
|
|
|
|
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
Reviewed-by: Lukas Slebodnik <lslebodn@redhat.com>
|
|
---
|
|
src/providers/ad/ad_common.c | 7 -------
|
|
src/providers/ad/ad_common.h | 4 ----
|
|
src/providers/ad/ad_subdomains.c | 4 +---
|
|
src/providers/ipa/ipa_subdomains_server.c | 4 +---
|
|
src/util/domain_info_utils.c | 15 +++++++++++++++
|
|
src/util/util.h | 3 +++
|
|
6 files changed, 20 insertions(+), 17 deletions(-)
|
|
|
|
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
|
|
index ec952d3bb4587516ea26fd27c212d5620e2f3dda..f893b748a2ddcff1eab6e8d919d2aa950b825446 100644
|
|
--- a/src/providers/ad/ad_common.c
|
|
+++ b/src/providers/ad/ad_common.c
|
|
@@ -33,13 +33,6 @@ errno_t ad_set_search_bases(struct sdap_options *id_opts);
|
|
static errno_t ad_set_sdap_options(struct ad_options *ad_opts,
|
|
struct sdap_options *id_opts);
|
|
|
|
-char *create_subdom_conf_path(TALLOC_CTX *mem_ctx,
|
|
- const char *conf_path,
|
|
- const char *subdom_name)
|
|
-{
|
|
- return talloc_asprintf(mem_ctx, "%s/%s", conf_path, subdom_name);
|
|
-}
|
|
-
|
|
static struct sdap_options *
|
|
ad_create_default_sdap_options(TALLOC_CTX *mem_ctx)
|
|
{
|
|
diff --git a/src/providers/ad/ad_common.h b/src/providers/ad/ad_common.h
|
|
index e02b932cd2da737254de8417d5c82fcdcf14e8d7..2981550f6c390929501ec8942e861b16ea0a5cb0 100644
|
|
--- a/src/providers/ad/ad_common.h
|
|
+++ b/src/providers/ad/ad_common.h
|
|
@@ -99,10 +99,6 @@ struct ad_options {
|
|
struct be_nsupdate_ctx *dyndns_ctx;
|
|
};
|
|
|
|
-char *create_subdom_conf_path(TALLOC_CTX *mem_ctx,
|
|
- const char *conf_path,
|
|
- const char *subdom_name);
|
|
-
|
|
errno_t
|
|
ad_get_common_options(TALLOC_CTX *mem_ctx,
|
|
struct confdb_ctx *cdb,
|
|
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
|
|
index 156ecab4272029d69c8b596eff041498a7524ce4..eecae9c9ca82ad67874c13a3c7b7c617d6232d5c 100644
|
|
--- a/src/providers/ad/ad_subdomains.c
|
|
+++ b/src/providers/ad/ad_subdomains.c
|
|
@@ -171,9 +171,7 @@ ad_subdom_ad_ctx_new(struct be_ctx *be_ctx,
|
|
return EINVAL;
|
|
}
|
|
|
|
- subdom_conf_path = create_subdom_conf_path(id_ctx,
|
|
- be_ctx->conf_path,
|
|
- subdom->name);
|
|
+ subdom_conf_path = subdomain_create_conf_path(id_ctx, subdom);
|
|
if (subdom_conf_path == NULL) {
|
|
DEBUG(SSSDBG_CRIT_FAILURE, "subdom_conf_path failed\n");
|
|
return ENOMEM;
|
|
diff --git a/src/providers/ipa/ipa_subdomains_server.c b/src/providers/ipa/ipa_subdomains_server.c
|
|
index ae3baf036e4278fb67d86b42742fb7e80b46724e..e8ee30392d84f84e30bcdaa3d2110ba130b1ad73 100644
|
|
--- a/src/providers/ipa/ipa_subdomains_server.c
|
|
+++ b/src/providers/ipa/ipa_subdomains_server.c
|
|
@@ -176,9 +176,7 @@ static struct ad_options *ipa_ad_options_new(struct be_ctx *be_ctx,
|
|
forest_realm = subdom->forest_root->realm;
|
|
forest = subdom->forest_root->forest;
|
|
|
|
- subdom_conf_path = create_subdom_conf_path(id_ctx,
|
|
- be_ctx->conf_path,
|
|
- subdom->name);
|
|
+ subdom_conf_path = subdomain_create_conf_path(id_ctx, subdom);
|
|
if (subdom_conf_path == NULL) {
|
|
DEBUG(SSSDBG_CRIT_FAILURE, "subdom_conf_path failed\n");
|
|
return NULL;
|
|
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
|
|
index 6ef6bcfb8c078a360673b6bdd2364fc2918cb324..a7f118842aa8ba870143b2f2b425a3e3c0ea5a78 100644
|
|
--- a/src/util/domain_info_utils.c
|
|
+++ b/src/util/domain_info_utils.c
|
|
@@ -870,3 +870,18 @@ bool is_email_from_domain(const char *email, struct sss_domain_info *dom)
|
|
|
|
return false;
|
|
}
|
|
+
|
|
+char *subdomain_create_conf_path(TALLOC_CTX *mem_ctx,
|
|
+ struct sss_domain_info *subdomain)
|
|
+{
|
|
+ if (!IS_SUBDOMAIN(subdomain)) {
|
|
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
+ "The domain \"%s\" is not a subdomain.\n",
|
|
+ subdomain->name);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ return talloc_asprintf(mem_ctx, CONFDB_DOMAIN_PATH_TMPL "/%s",
|
|
+ subdomain->parent->name,
|
|
+ subdomain->name);
|
|
+}
|
|
diff --git a/src/util/util.h b/src/util/util.h
|
|
index a2dc89b8ddb999437eda551ac17af28672d8759c..82760940269ad8883e725e3a5cf463486c9cfd36 100644
|
|
--- a/src/util/util.h
|
|
+++ b/src/util/util.h
|
|
@@ -551,6 +551,9 @@ find_domain_by_object_name(struct sss_domain_info *domain,
|
|
bool subdomain_enumerates(struct sss_domain_info *parent,
|
|
const char *sd_name);
|
|
|
|
+char *subdomain_create_conf_path(TALLOC_CTX *mem_ctx,
|
|
+ struct sss_domain_info *subdomain);
|
|
+
|
|
errno_t sssd_domain_init(TALLOC_CTX *mem_ctx,
|
|
struct confdb_ctx *cdb,
|
|
const char *domain_name,
|
|
--
|
|
2.12.2
|
|
|