summaryrefslogtreecommitdiff
path: root/server/responder/nss/nsssrv.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/nss/nsssrv.c
parente8a7526b06acf4af322fdab593c8bafbd9f4a103 (diff)
downloadsssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.gz
sssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.bz2
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/nss/nsssrv.c')
-rw-r--r--server/responder/nss/nsssrv.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c
index 834c42d9..58b09fb3 100644
--- a/server/responder/nss/nsssrv.c
+++ b/server/responder/nss/nsssrv.c
@@ -123,10 +123,10 @@ static int nss_get_config(struct nss_ctx *nctx,
struct confdb_ctx *cdb)
{
TALLOC_CTX *tmpctx;
+ struct sss_domain_info *dom;
char *domain, *name;
- const char **domains;
char **filter_list;
- int ret, num, i, j;
+ int ret, i;
tmpctx = talloc_new(nctx);
if (!tmpctx) return ENOMEM;
@@ -166,20 +166,12 @@ static int nss_get_config(struct nss_ctx *nctx,
continue;
}
} else {
- ret = btreemap_get_keys(tmpctx, rctx->domain_map,
- (const void ***)&domains, &num);
- if (ret != EOK) {
- DEBUG(0, ("Unable to find domains!\n"));
- return ret;
- }
-
- for (j = 0; j < num; j++) {
- ret = nss_ncache_set_user(nctx->ncache,
- true, domains[j], name);
+ for (dom = rctx->domains; dom; dom = dom->next) {
+ ret = nss_ncache_set_user(nctx->ncache, true, dom->name, name);
if (ret != EOK) {
DEBUG(1, ("Failed to store permanent user filter for"
" [%s:%s] (%d [%s])\n",
- domains[j], filter_list[i],
+ dom->name, filter_list[i],
ret, strerror(ret)));
continue;
}
@@ -208,20 +200,12 @@ static int nss_get_config(struct nss_ctx *nctx,
continue;
}
} else {
- ret = btreemap_get_keys(tmpctx, rctx->domain_map,
- (const void ***)&domains, &num);
- if (ret != EOK) {
- DEBUG(0, ("Unable to find domains!\n"));
- return ret;
- }
-
- for (j = 0; j < num; j++) {
- ret = nss_ncache_set_group(nctx->ncache,
- true, domains[j], name);
+ for (dom = rctx->domains; dom; dom = dom->next) {
+ ret = nss_ncache_set_group(nctx->ncache, true, dom->name, name);
if (ret != EOK) {
DEBUG(1, ("Failed to store permanent group filter for"
" [%s:%s] (%d [%s])\n",
- domains[j], filter_list[i],
+ dom->name, filter_list[i],
ret, strerror(ret)));
continue;
}