responder_get_domains.c revision bdbf4f169e4d5d00b0616df19f7a55debb407f78
/*
Authors:
Jan Zeleny <jzeleny@redhat.com>
Copyright (C) 2011 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 "responder/common/responder.h"
#include "providers/data_provider.h"
struct sss_dp_domains_info {
struct sss_domain_info *dom;
const char *hint;
bool force;
struct sss_dp_req_state *state;
};
bool force,
const char *hint)
{
struct tevent_req *req;
struct sss_dp_domains_info *info;
return NULL;
}
goto immediately;
}
if (!force) {
("Last call was too recent, nothing to do!\n"));
goto immediately;
goto immediately;
}
}
} else {
goto immediately;
}
}
goto immediately;
}
return req;
} else {
}
return req;
}
{
struct sss_dp_domains_info *info;
struct tevent_req *subreq;
struct sss_dp_req_state *state;
char *key;
/* Skip all local domains. */
}
return EOK;
}
return ENOMEM;
}
return ENOMEM;
}
return ret;
}
return EAGAIN;
}
static DBusMessage *
sss_dp_get_domains_msg(void *pvt)
{
struct sss_dp_domains_info *info;
return NULL;
}
("Sending get domains request for [%s][%sforced][%s]\n",
/* Send the hint argument to provider as well. This will
* be useful for some cases of transitional trust where
* the server might not know all trusted domains
*/
if (!dbret) {
return NULL;
}
return msg;
}
{
char *err_msg;
/* TODO: handle errors better */
goto fail;
}
"trying next domain.\n"));
goto fail;
}
goto fail;
}
return;
fail:
return;
}
{
int ret;
size_t c;
struct sss_dp_domains_info *state;
struct sss_domain_info *domain;
struct sysdb_subdom **subdomains;
/* Retrieve all subdomains of this domain from sysdb
* and create their struct sss_domain_info representations
*/
goto done;
}
if (subdomain_count == 0) {
domain->subdomain_count = 0;
goto done;
}
if (new_sd_list == NULL) {
goto done;
}
for (c = 0; c < subdomain_count; c++) {
subdomains[c]->name,
subdomains[c]->flat_name,
subdomains[c]->id);
if (new_sd_list[c] == NULL) {
goto done;
}
}
/* Link all subdomains into single-linked list
* (the list is used when processing all domains)
*/
while (c > 1) {
--c;
}
errno = 0;
if (ret == -1) {
goto done;
}
new_sd_list = NULL;
done:
}
return ret;
}
{
return EOK;
}
{
struct sss_domain_info *dom;
int i;
/* Timeout, expired, fetch domains again */
return EAGAIN;
}
while (dom) {
for (i = 0; i< dom->subdomain_count; i++) {
/* Timeout, expired, fetch domains again */
return EAGAIN;
}
/* Skip the rest of this domain, but check other domains
* perhaps this subdomain will be also a part of another
* domain where it will need refreshing
*/
break;
}
}
}
}
return EOK;
}