summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/data_provider_fo.c6
-rw-r--r--src/providers/fail_over.c48
-rw-r--r--src/providers/fail_over.h3
3 files changed, 50 insertions, 7 deletions
diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c
index 0b4b24349..ddb348f64 100644
--- a/src/providers/data_provider_fo.c
+++ b/src/providers/data_provider_fo.c
@@ -284,7 +284,8 @@ int be_fo_add_srv_server(struct be_ctx *ctx, const char *service_name,
/* Add the first protocol as the primary lookup */
ret = fo_add_srv_server(svc->fo_service, query_service,
- domain, proto_table[proto], user_data);
+ domain, ctx->domain->name,
+ proto_table[proto], user_data);
if (ret && ret != EEXIST) {
DEBUG(1, ("Failed to add SRV lookup reference to failover service\n"));
return ret;
@@ -295,7 +296,8 @@ int be_fo_add_srv_server(struct be_ctx *ctx, const char *service_name,
/* All the rest as fallback */
while (i != proto) {
ret = fo_add_srv_server(svc->fo_service, query_service,
- domain, proto_table[i], user_data);
+ domain, ctx->domain->name,
+ proto_table[i], user_data);
if (ret && ret != EEXIST) {
DEBUG(1, ("Failed to add SRV lookup reference to failover service\n"));
return ret;
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index 331ccccd0..3c560089b 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -98,6 +98,8 @@ struct server_common {
struct srv_data {
char *dns_domain;
+ char *discovery_domain;
+ char *sssd_domain;
char *proto;
char *srv;
@@ -498,7 +500,8 @@ create_server_common(TALLOC_CTX *mem_ctx, struct fo_ctx *ctx, const char *name)
int
fo_add_srv_server(struct fo_service *service, const char *srv,
- const char *dns_domain, const char *proto, void *user_data)
+ const char *dns_domain, const char *sssd_domain,
+ const char *proto, void *user_data)
{
struct fo_server *server;
@@ -539,11 +542,18 @@ fo_add_srv_server(struct fo_service *service, const char *srv,
return ENOMEM;
if (dns_domain) {
- server->srv_data->dns_domain = talloc_strdup(server->srv_data, dns_domain);
- if (server->srv_data->dns_domain == NULL)
+ server->srv_data->discovery_domain = talloc_strdup(server->srv_data, dns_domain);
+ if (server->srv_data->discovery_domain == NULL)
return ENOMEM;
+ server->srv_data->dns_domain =
+ server->srv_data->discovery_domain;
}
+ server->srv_data->sssd_domain =
+ talloc_strdup(server->srv_data, sssd_domain);
+ if (server->srv_data->sssd_domain == NULL)
+ return ENOMEM;
+
server->srv_data->meta = server;
server->srv_data->srv_lookup_status = DEFAULT_SRV_STATUS;
server->srv_data->last_status_change.tv_sec = 0;
@@ -1063,8 +1073,38 @@ resolve_srv_done(struct tevent_req *subreq)
&resolv_status, NULL, &reply_list);
talloc_free(subreq);
if (ret != EOK) {
- DEBUG(1, ("SRV query failed %s\n",
+ DEBUG(1, ("SRV query failed: [%s]\n",
resolv_strerror(resolv_status)));
+ if (resolv_status == ARES_ENOTFOUND &&
+ state->meta->srv_data->dns_domain !=
+ state->meta->srv_data->discovery_domain &&
+ state->meta->srv_data->dns_domain !=
+ state->meta->srv_data->sssd_domain) {
+ /* The domain name could not be identified
+ * If the domain wasn't specified in the config
+ * file, also check whether the SSSD domain
+ * works.
+ *
+ * Programming note: It is safe to compare
+ * pointers here, because we're not copying
+ * the data, we're just reassigning the pointer
+ * for the active domain.
+ */
+ talloc_free(state->meta->srv_data->dns_domain);
+ state->meta->srv_data->dns_domain =
+ state->meta->srv_data->sssd_domain;
+ resolve_srv_cont(req);
+ return;
+ }
+
+ /* We need to make sure we reset this to NULL
+ * so that if we go online later, we re-check
+ * the DNS domain
+ */
+ if (!state->meta->srv_data->discovery_domain) {
+ state->meta->srv_data->dns_domain = NULL;
+ }
+
fo_set_port_status(state->meta, PORT_NOT_WORKING);
goto fail;
}
diff --git a/src/providers/fail_over.h b/src/providers/fail_over.h
index dce02dc60..6a3101fed 100644
--- a/src/providers/fail_over.h
+++ b/src/providers/fail_over.h
@@ -116,7 +116,8 @@ int fo_add_server(struct fo_service *service,
int fo_add_srv_server(struct fo_service *service,
const char *srv,
- const char *domain,
+ const char *dns_domain,
+ const char *sssd_domain,
const char *proto,
void *user_data);