From e115c25af2df3549fb44b260e516d8c93d2adc8a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 20 Nov 2009 12:11:28 -0500 Subject: Add initial failover support for ldap and ipa The retun values are still not directly used with ldap libraries that still do their own name resolution, but this patch introduces a very basic framework to have a multiple providers in one domain use and share a single failover service if they want to. --- server/providers/ldap/ldap_init.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'server/providers/ldap/ldap_init.c') diff --git a/server/providers/ldap/ldap_init.c b/server/providers/ldap/ldap_init.c index 295ff19..5a64585 100644 --- a/server/providers/ldap/ldap_init.c +++ b/server/providers/ldap/ldap_init.c @@ -49,6 +49,7 @@ int sssm_ldap_init(struct be_ctx *bectx, void **pvt_data) { struct sdap_id_ctx *ctx; + const char *urls; int ret; ctx = talloc_zero(bectx, struct sdap_id_ctx); @@ -62,6 +63,19 @@ int sssm_ldap_init(struct be_ctx *bectx, goto done; } + urls = dp_opt_get_string(ctx->opts->basic, SDAP_URI); + if (!urls) { + DEBUG(0, ("Missing ldap_uri\n")); + ret = EINVAL; + goto done; + } + + ret = sdap_service_init(ctx, ctx->be, "LDAP", urls, &ctx->service); + if (ret != EOK) { + DEBUG(1, ("Failed to initialize failover service!\n")); + goto done; + } + ret = setup_tls_config(ctx->opts->basic); if (ret != EOK) { DEBUG(1, ("setup_tls_config failed [%d][%s].\n", @@ -90,6 +104,7 @@ int sssm_ldap_auth_init(struct be_ctx *bectx, void **pvt_data) { struct sdap_auth_ctx *ctx; + const char *urls; int ret; ctx = talloc(bectx, struct sdap_auth_ctx); @@ -103,6 +118,19 @@ int sssm_ldap_auth_init(struct be_ctx *bectx, goto done; } + urls = dp_opt_get_string(ctx->opts->basic, SDAP_URI); + if (!urls) { + DEBUG(0, ("Missing ldap_uri\n")); + ret = EINVAL; + goto done; + } + + ret = sdap_service_init(ctx, ctx->be, "LDAP", urls, &ctx->service); + if (ret != EOK) { + DEBUG(1, ("Failed to initialize failover service!\n")); + goto done; + } + ret = setup_tls_config(ctx->opts->basic); if (ret != EOK) { DEBUG(1, ("setup_tls_config failed [%d][%s].\n", -- cgit