/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2013 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <talloc.h>
#include <tevent.h>
#include <ndr.h>
#include "util/sss_ldap.h"
#include "resolv/async_resolv.h"
#include "providers/ad/ad_common.h"
#include "providers/fail_over.h"
#include "providers/fail_over_srv.h"
#include "providers/ldap/sdap_async.h"
const char *domain,
struct fo_server_info **_srv,
{
size_t i, j;
return EINVAL;
}
if (num <= 1) {
return EOK;
}
return ENOMEM;
}
/* When several servers share priority, we will prefer the one that
* is located in the same domain as client (e.g. child domain instead
* of forest root) but obey their weight. We will use the fact that
* the servers are already sorted by priority. */
for (i = 0; i < num; i++) {
/* this is a preferred server, push it to the in domain list */
in_index++;
} else {
/* this is a normal server, push it to the out domain list */
out_index++;
}
/* priority has changed or we have reached the end of the srv list,
* we will merge the list into final list and start over with
* next priority */
for (j = 0; j < in_index; j++) {
srv_index++;
}
for (j = 0; j < out_index; j++) {
srv_index++;
}
in_index = 0;
out_index = 0;
}
}
talloc_free(*_srv);
return EOK;
}
struct ad_get_dc_servers_state {
};
struct tevent_context *ev,
struct resolv_ctx *resolv_ctx,
const char *discovery_domain,
const char *site)
{
struct ad_get_dc_servers_state);
return NULL;
}
goto immediately;
}
"%s\n", discovery_domain);
goto immediately;
}
} else {
goto immediately;
}
goto immediately;
}
}
goto immediately;
}
return req;
return req;
}
{
goto done;
}
done:
return;
}
}
struct tevent_req *req,
struct fo_server_info **_dcs,
{
return EOK;
}
struct ad_get_client_site_state {
const char *ad_domain;
char *site;
char *forest;
};
struct tevent_context *ev,
struct be_resolv_ctx *be_res,
enum host_database *host_db,
struct sdap_options *opts,
const char *ad_domain,
struct fo_server_info *dcs,
{
struct ad_get_client_site_state);
return NULL;
}
goto immediately;
}
goto immediately;
goto immediately;
}
return req;
} else {
}
return req;
}
{
goto done;
}
goto done;
}
done:
return ret;
}
{
}
goto done;
}
goto done;
}
goto done;
}
false);
goto done;
}
done:
}
return;
}
{
/* we're done with this LDAP, close connection */
}
goto done;
}
if (reply_count == 0) {
goto done;
}
goto done;
}
done:
return;
}
}
struct tevent_req *req,
const char **_site,
const char **_forest)
{
return EOK;
}
struct ad_srv_plugin_ctx {
const char *hostname;
const char *ad_domain;
const char *ad_site_override;
};
struct ad_srv_plugin_ctx *
struct be_resolv_ctx *be_res,
enum host_database *host_dbs,
struct sdap_options *opts,
const char *hostname,
const char *ad_domain,
const char *ad_site_override)
{
return NULL;
}
goto fail;
}
goto fail;
}
if (ad_site_override != NULL) {
goto fail;
}
}
return ctx;
fail:
return NULL;
}
struct ad_srv_plugin_state {
const char *service;
const char *protocol;
const char *discovery_domain;
const char *site;
char *dns_domain;
const char *forest;
};
/* 1. Do a DNS lookup to find any DC in domain
* _ldap._tcp.domain.name
* 2. Send a CLDAP ping to the found DC to get the desirable site
* 3. Do a DNS lookup to find SRV in the site (a)
* _service._protocol.site-name._sites.domain.name
* 4. Do a DNS lookup to find global SRV records (b)
* _service._protocol.domain.name
* 5. If the site is found, use (a) as primary and (b) as backup servers,
* otherwise use (b) as primary servers
*/
struct tevent_context *ev,
const char *service,
const char *protocol,
const char *discovery_domain,
void *pvt)
{
struct ad_srv_plugin_state);
return NULL;
}
goto immediately;
}
goto immediately;
}
goto immediately;
}
if (discovery_domain != NULL) {
} else {
}
goto immediately;
}
goto immediately;
}
return req;
return req;
}
{
goto done;
}
goto done;
}
done:
}
return;
}
{
/* Ignore AD site found by dns discovery if specific site is set in
* configuration file. */
"Ignoring AD site found by DNS discovery: '%s', "
"using configured value: '%s' instead.\n",
}
}
if (primary_domain == NULL) {
goto done;
}
} else {
}
}
} else {
if (primary_domain == NULL) {
goto done;
}
}
}
goto done;
}
"backup servers\n");
goto done;
}
done:
}
return;
}
{
return;
}
/* continue */
}
/* continue */
}
}
struct tevent_req *req,
char **_dns_domain,
struct fo_server_info **_primary_servers,
struct fo_server_info **_backup_servers,
{
if (_primary_servers) {
}
if (_num_primary_servers) {
}
if (_backup_servers) {
}
if (_num_backup_servers) {
}
if (_dns_domain) {
}
if (_ttl) {
}
return EOK;
}