summaryrefslogtreecommitdiffstats
path: root/server/responder/pam/pamsrv_cmd.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-04-07 19:25:48 -0400
committerSimo Sorce <ssorce@redhat.com>2009-04-08 10:55:03 -0400
commit6b5d45693f01eec55128eb3508266cda73071d93 (patch)
treec51ca00f2fb243e5eaf06128e8092583fba1bd8c /server/responder/pam/pamsrv_cmd.c
parente8a7526b06acf4af322fdab593c8bafbd9f4a103 (diff)
downloadsssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.gz
sssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.xz
sssd-6b5d45693f01eec55128eb3508266cda73071d93.zip
Change the way we retrieve domains
To be able to correctly filter out duplicate names when multiple non-fully qualified domains are in use we need to be able to specify the domains order. This is now accomplished by the configuration paramets 'domains' in the config/domains entry. 'domains' is a comma separated list of domain names. This paramter allows also to have disbaled domains in the configuration without requiring to completely delete them. The domains list is now kept in a linked list of sss_domain_info objects. The first domain is also the "default" domain.
Diffstat (limited to 'server/responder/pam/pamsrv_cmd.c')
-rw-r--r--server/responder/pam/pamsrv_cmd.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/server/responder/pam/pamsrv_cmd.c b/server/responder/pam/pamsrv_cmd.c
index 22a2b85de..db5f064fd 100644
--- a/server/responder/pam/pamsrv_cmd.c
+++ b/server/responder/pam/pamsrv_cmd.c
@@ -197,7 +197,7 @@ done:
static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
{
- struct sss_domain_info *info;
+ struct sss_domain_info *dom;
uint8_t *body;
size_t blen;
int ret;
@@ -224,30 +224,27 @@ static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
pd->response_delay = 0;
pd->resp_list = NULL;
- if (pd->domain == NULL) {
- if (cctx->rctx->default_domain != NULL) {
- pd->domain = cctx->rctx->default_domain;
- } else {
- pd->domain = talloc_strdup(pd, "LOCAL");
- }
- DEBUG(4, ("Using default domain [%s].\n", pd->domain));
- }
if (pd->domain) {
- /* Check for registered domain */
- info = btreemap_get_value(cctx->rctx->domain_map,
- (void *)(pd->domain));
- if (!info) {
+ for (dom = cctx->rctx->domains; dom; dom = dom->next) {
+ if (strcasecmp(dom->name, pd->domain) == 0) break;
+ }
+ if (!dom) {
talloc_free(pd);
return EINVAL;
}
}
+ else {
+ DEBUG(4, ("Domain not provided, using default.\n"));
+ dom = cctx->rctx->domains;
+ pd->domain = dom->name;
+ }
- if (!info->provider) {
- return LOCAL_pam_handler(cctx, pam_reply, pd);
+ if (!dom->provider) {
+ return LOCAL_pam_handler(cctx, pam_reply, dom, pd);
};
- ret=pam_dp_send_req(cctx, pam_reply, PAM_DP_TIMEOUT, pd);
+ ret = pam_dp_send_req(cctx, pam_reply, PAM_DP_TIMEOUT, pd);
DEBUG(4, ("pam_dp_send_req returned %d\n", ret));
return ret;