diff options
author | Pavel Reichl <preichl@redhat.com> | 2015-01-07 11:02:44 +0000 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-01-26 23:29:33 +0100 |
commit | e438fbf102c3d787902504bdae177e84230cbbc9 (patch) | |
tree | a6e71eae73f498f5bd9fd5cffdeb9a6e3c5443fb /src/providers/ad/ad_srv.c | |
parent | b22e0da9e644f5eb84ee0c8986979fec3fe7eb56 (diff) | |
download | sssd-e438fbf102c3d787902504bdae177e84230cbbc9.tar.gz sssd-e438fbf102c3d787902504bdae177e84230cbbc9.tar.xz sssd-e438fbf102c3d787902504bdae177e84230cbbc9.zip |
AD: support for AD site override
Override AD site found during DNS discovery.
Resolves:
https://fedorahosted.org/sssd/ticket/2486
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/providers/ad/ad_srv.c')
-rw-r--r-- | src/providers/ad/ad_srv.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/providers/ad/ad_srv.c b/src/providers/ad/ad_srv.c index 53d8a8770..ac9dfa187 100644 --- a/src/providers/ad/ad_srv.c +++ b/src/providers/ad/ad_srv.c @@ -540,7 +540,7 @@ done: int ad_get_client_site_recv(TALLOC_CTX *mem_ctx, struct tevent_req *req, - char **_site, + const char **_site, char **_forest) { struct ad_get_client_site_state *state = NULL; @@ -560,6 +560,7 @@ struct ad_srv_plugin_ctx { struct sdap_options *opts; const char *hostname; const char *ad_domain; + const char *ad_site_override; }; struct ad_srv_plugin_ctx * @@ -568,7 +569,8 @@ ad_srv_plugin_ctx_init(TALLOC_CTX *mem_ctx, enum host_database *host_dbs, struct sdap_options *opts, const char *hostname, - const char *ad_domain) + const char *ad_domain, + const char *ad_site_override) { struct ad_srv_plugin_ctx *ctx = NULL; @@ -591,6 +593,13 @@ ad_srv_plugin_ctx_init(TALLOC_CTX *mem_ctx, goto fail; } + if (ad_site_override != NULL) { + ctx->ad_site_override = talloc_strdup(ctx, ad_site_override); + if (ctx->ad_site_override == NULL) { + goto fail; + } + } + return ctx; fail: @@ -605,7 +614,7 @@ struct ad_srv_plugin_state { const char *protocol; const char *discovery_domain; - char *site; + const char *site; char *dns_domain; char *forest; struct fo_server_info *primary_servers; @@ -756,6 +765,15 @@ static void ad_srv_plugin_site_done(struct tevent_req *subreq) ret = ad_get_client_site_recv(state, subreq, &state->site, &state->forest); talloc_zfree(subreq); + /* Ignore AD site found by dns discovery if specific site is set in + * configuration file. */ + if (state->ctx->ad_site_override != NULL) { + DEBUG(SSSDBG_TRACE_INTERNAL, + "Ignoring AD site found by DNS discovery: '%s', " + "using configured value: '%s' instead.\n", + state->site, state->ctx->ad_site_override); + state->site = state->ctx->ad_site_override; + } if (ret == EOK) { if (strcmp(state->service, "gc") == 0) { primary_domain = talloc_asprintf(state, AD_SITE_DOMAIN_FMT, |