|
|
cdf651 |
From 09fd8246f25dbfb80db638a0dd8f2fe4c1fba957 Mon Sep 17 00:00:00 2001
|
|
|
cdf651 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
cdf651 |
Date: Mon, 25 Jun 2018 13:03:38 +0200
|
|
|
cdf651 |
Subject: [PATCH] AD: expose the helper function to format the site DNS query
|
|
|
cdf651 |
|
|
|
cdf651 |
This function will be used later in the patchset. Instead of exposing
|
|
|
cdf651 |
the format constant, expose the function that builds the DNS query for
|
|
|
cdf651 |
site discovery.
|
|
|
cdf651 |
|
|
|
cdf651 |
Related:
|
|
|
cdf651 |
https://pagure.io/SSSD/sssd/issue/3291
|
|
|
cdf651 |
|
|
|
cdf651 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
cdf651 |
(cherry picked from commit 29bbc8e017f2d9b98667890a9b7056128a93e572)
|
|
|
cdf651 |
|
|
|
cdf651 |
DOWNSTREAM:
|
|
|
cdf651 |
Resolves: rhbz#1416528 - sssd in cross realm trust configuration should be able to use AD KDCs from a client site defined in sssd.conf or a snippet
|
|
|
cdf651 |
---
|
|
|
cdf651 |
src/providers/ad/ad_srv.c | 21 +++++++++++++++------
|
|
|
cdf651 |
src/providers/ad/ad_srv.h | 4 ++++
|
|
|
cdf651 |
2 files changed, 19 insertions(+), 6 deletions(-)
|
|
|
cdf651 |
|
|
|
cdf651 |
diff --git a/src/providers/ad/ad_srv.c b/src/providers/ad/ad_srv.c
|
|
|
cdf651 |
index 4fa1668605e131b2e31802b1401f49fc6e00a23b..5fd25f60e8bf38c3952823601593515b6c703284 100644
|
|
|
cdf651 |
--- a/src/providers/ad/ad_srv.c
|
|
|
cdf651 |
+++ b/src/providers/ad/ad_srv.c
|
|
|
cdf651 |
@@ -38,6 +38,13 @@
|
|
|
cdf651 |
|
|
|
cdf651 |
#define AD_SITE_DOMAIN_FMT "%s._sites.%s"
|
|
|
cdf651 |
|
|
|
cdf651 |
+char *ad_site_dns_discovery_domain(TALLOC_CTX *mem_ctx,
|
|
|
cdf651 |
+ const char *site,
|
|
|
cdf651 |
+ const char *domain)
|
|
|
cdf651 |
+{
|
|
|
cdf651 |
+ return talloc_asprintf(mem_ctx, AD_SITE_DOMAIN_FMT, site, domain);
|
|
|
cdf651 |
+}
|
|
|
cdf651 |
+
|
|
|
cdf651 |
static errno_t ad_sort_servers_by_dns(TALLOC_CTX *mem_ctx,
|
|
|
cdf651 |
const char *domain,
|
|
|
cdf651 |
struct fo_server_info **_srv,
|
|
|
cdf651 |
@@ -154,8 +161,8 @@ static struct tevent_req *ad_get_dc_servers_send(TALLOC_CTX *mem_ctx,
|
|
|
cdf651 |
DEBUG(SSSDBG_TRACE_FUNC, "Looking up domain controllers in domain "
|
|
|
cdf651 |
"%s and site %s\n", discovery_domain, site);
|
|
|
cdf651 |
|
|
|
cdf651 |
- domains[0] = talloc_asprintf(state, AD_SITE_DOMAIN_FMT,
|
|
|
cdf651 |
- site, discovery_domain);
|
|
|
cdf651 |
+ domains[0] = ad_site_dns_discovery_domain(domains,
|
|
|
cdf651 |
+ site, discovery_domain);
|
|
|
cdf651 |
if (domains[0] == NULL) {
|
|
|
cdf651 |
ret = ENOMEM;
|
|
|
cdf651 |
goto immediately;
|
|
|
cdf651 |
@@ -775,9 +782,10 @@ static void ad_srv_plugin_site_done(struct tevent_req *subreq)
|
|
|
cdf651 |
if (strcmp(state->service, "gc") == 0) {
|
|
|
cdf651 |
if (state->forest != NULL) {
|
|
|
cdf651 |
if (state->site != NULL) {
|
|
|
cdf651 |
- primary_domain = talloc_asprintf(state, AD_SITE_DOMAIN_FMT,
|
|
|
cdf651 |
- state->site,
|
|
|
cdf651 |
- state->forest);
|
|
|
cdf651 |
+ primary_domain = ad_site_dns_discovery_domain(
|
|
|
cdf651 |
+ state,
|
|
|
cdf651 |
+ state->site,
|
|
|
cdf651 |
+ state->forest);
|
|
|
cdf651 |
if (primary_domain == NULL) {
|
|
|
cdf651 |
ret = ENOMEM;
|
|
|
cdf651 |
goto done;
|
|
|
cdf651 |
@@ -791,7 +799,8 @@ static void ad_srv_plugin_site_done(struct tevent_req *subreq)
|
|
|
cdf651 |
}
|
|
|
cdf651 |
} else {
|
|
|
cdf651 |
if (state->site != NULL) {
|
|
|
cdf651 |
- primary_domain = talloc_asprintf(state, AD_SITE_DOMAIN_FMT,
|
|
|
cdf651 |
+ primary_domain = ad_site_dns_discovery_domain(
|
|
|
cdf651 |
+ state,
|
|
|
cdf651 |
state->site,
|
|
|
cdf651 |
state->discovery_domain);
|
|
|
cdf651 |
if (primary_domain == NULL) {
|
|
|
cdf651 |
diff --git a/src/providers/ad/ad_srv.h b/src/providers/ad/ad_srv.h
|
|
|
cdf651 |
index fddef686762e57bb95d648247131d39a797aa516..e553d594d77ad99f806af9634c2817754a80d4f5 100644
|
|
|
cdf651 |
--- a/src/providers/ad/ad_srv.h
|
|
|
cdf651 |
+++ b/src/providers/ad/ad_srv.h
|
|
|
cdf651 |
@@ -49,4 +49,8 @@ errno_t ad_srv_plugin_recv(TALLOC_CTX *mem_ctx,
|
|
|
cdf651 |
struct fo_server_info **_backup_servers,
|
|
|
cdf651 |
size_t *_num_backup_servers);
|
|
|
cdf651 |
|
|
|
cdf651 |
+char *ad_site_dns_discovery_domain(TALLOC_CTX *mem_ctx,
|
|
|
cdf651 |
+ const char *site,
|
|
|
cdf651 |
+ const char *domain);
|
|
|
cdf651 |
+
|
|
|
cdf651 |
#endif /* __AD_SRV_H__ */
|
|
|
cdf651 |
--
|
|
|
cdf651 |
2.17.1
|
|
|
cdf651 |
|