responder_get_domains.c revision 0528fdec17d0031996e919fcd852459e86592c35
/*
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"
/* ========== Get subdomains for a domain ================= */
struct sss_dp_domains_info {
struct sss_domain_info *dom;
const char *hint;
};
static struct tevent_req *
struct sss_domain_info *dom,
const char *hint)
{
struct tevent_req *req;
struct sss_dp_req_state *state;
struct sss_dp_domains_info *info;
char *key;
return NULL;
}
if (!info) {
goto fail;
}
goto fail;
}
goto fail;
}
return req;
fail:
return req;
}
static DBusMessage *
sss_dp_get_domains_msg(void *pvt)
{
struct sss_dp_domains_info *info;
return NULL;
}
"Sending get domains request for [%s][%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;
}
static errno_t
struct tevent_req *req,
char **err_msg)
{
}
/* ====== Iterate over all domains, searching for their subdomains ======= */
struct sss_dp_get_domains_state {
struct sss_domain_info *dom;
const char *hint;
};
static void
bool force,
const char *hint)
{
struct tevent_req *req;
struct tevent_req *subreq;
struct sss_dp_get_domains_state *state;
return NULL;
}
goto immediately;
}
if (!force) {
"Last call was too recent, nothing to do!\n");
goto immediately;
goto immediately;
}
}
} else {
goto immediately;
}
}
}
/* All domains were local */
goto immediately;
}
goto immediately;
}
return req;
} else {
}
return req;
}
static void
{
struct tevent_req);
struct sss_dp_get_domains_state);
char *err_msg;
goto fail;
}
"trying next domain.\n");
goto fail;
}
/* Advance to the next domain */
/* Skip local domains */
}
/* All domains were local */
return;
}
goto fail;
}
return;
fail:
return;
}
static errno_t
{
int ret;
"failed.\n");
goto done;
}
}
/* Retrieve all subdomains of this domain from sysdb
* and create their struct sss_domain_info representations
*/
goto done;
}
errno = 0;
if (ret == -1) {
goto done;
}
done:
}
return ret;
}
{
return EOK;
}
{
int ret;
errno = 0;
if (ret == -1) {
}
}
{
struct sss_domain_info *dom;
/* Timeout, expired, fetch domains again */
return EAGAIN;
}
if (!IS_SUBDOMAIN(dom)) {
/* not a subdomain */
continue;
}
/* Timeout, expired, fetch domains again */
return EAGAIN;
}
}
}
}
return EOK;
}
struct get_domains_state {
struct sss_nc_ctx *optional_ncache;
};
{
int ret;
struct get_domains_state *state;
}
}
}
return;
}
struct tevent_immediate *imm,
void *pvt)
{
struct tevent_req *req;
struct get_domains_state *state;
return;
}
return;
}
struct tevent_context *ev,
struct sss_nc_ctx *optional_ncache)
{
struct tevent_immediate *imm;
struct get_domains_state *state;
return ENOMEM;
}
return ENOMEM;
}
return EOK;
}
struct sss_parse_inp_state {
const char *rawinp;
char *name;
char *domname;
};
struct tevent_req *
const char *rawinp)
{
struct tevent_req *req;
struct tevent_req *subreq;
struct sss_parse_inp_state *state;
return NULL;
}
/* If the subdomains haven't been checked yet, we need to always
* attach to the post-startup subdomain request and only then parse
* the input. Otherwise, we might not be able to parse input with a
* flat domain name specifier */
/* Was able to use cached domains */
goto done;
goto done;
}
}
/* EAGAIN - check the DP for subdomains */
/* We explicitly use force=false here. This request should decide itself
* if it's time to re-use the cached subdomain list or refresh. If the
* caller needs to specify the 'force' parameter, they should use the
* sss_dp_get_domains_send() request itself
*/
goto done;
}
return req;
done:
} else {
}
return req;
}
{
struct tevent_req);
struct sss_parse_inp_state);
return;
}
return;
}
/* Was able to parse the name now */
}
{
struct sss_parse_inp_state);
if (_name) {
}
if (_domname) {
}
return EOK;
}