diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-04-14 11:20:30 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-04-14 14:18:45 -0400 |
commit | 4ad7fe5e6acc87140fc29b635605af8445d2d32f (patch) | |
tree | e4211d9de6ccb57f95f75cae702d9c69d6178249 /server/responder/nss | |
parent | ac5a54e24ac79a33ddf8320811d981b950e21e8e (diff) | |
download | sssd-4ad7fe5e6acc87140fc29b635605af8445d2d32f.tar.gz sssd-4ad7fe5e6acc87140fc29b635605af8445d2d32f.tar.bz2 sssd-4ad7fe5e6acc87140fc29b635605af8445d2d32f.zip |
Add common function to retrieve comma sep. lists
Also convert all places where we were using custom code to parse
config arguments.
And fix a copy&paste error in nss_get_config
Diffstat (limited to 'server/responder/nss')
-rw-r--r-- | server/responder/nss/nsssrv.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c index e85e56b0..e04a8c87 100644 --- a/server/responder/nss/nsssrv.c +++ b/server/responder/nss/nsssrv.c @@ -138,18 +138,20 @@ static int nss_get_config(struct nss_ctx *nctx, ret = confdb_get_int(cdb, nctx, NSS_SRV_CONFIG, "EntryCacheTimeout", 600, - &nctx->enum_cache_timeout); + &nctx->cache_timeout); if (ret != EOK) goto done; ret = confdb_get_int(cdb, nctx, NSS_SRV_CONFIG, "EntryNegativeTimeout", 15, - &nctx->enum_cache_timeout); + &nctx->neg_timeout); if (ret != EOK) goto done; - ret = confdb_get_param(cdb, nctx, NSS_SRV_CONFIG, - "filterUsers", &filter_list); - if (ret != EOK) goto done; - for (i = 0; filter_list[i]; i++) { + ret = confdb_get_string_as_list(cdb, tmpctx, NSS_SRV_CONFIG, + "filterUsers", &filter_list); + if (ret == ENOENT) filter_list = NULL; + else if (ret != EOK) goto done; + + for (i = 0; (filter_list && filter_list[i]); i++) { ret = sss_parse_name(tmpctx, nctx->rctx->names, filter_list[i], &domain, &name); if (ret != EOK) { @@ -178,11 +180,12 @@ static int nss_get_config(struct nss_ctx *nctx, } } } - talloc_free(filter_list); - ret = confdb_get_param(cdb, nctx, NSS_SRV_CONFIG, - "filterGroups", &filter_list); - if (ret != EOK) goto done; + ret = confdb_get_string_as_list(cdb, tmpctx, NSS_SRV_CONFIG, + "filterGroups", &filter_list); + if (ret == ENOENT) filter_list = NULL; + else if (ret != EOK) goto done; + for (i = 0; filter_list[i]; i++) { ret = sss_parse_name(tmpctx, nctx->rctx->names, filter_list[i], &domain, &name); @@ -212,7 +215,6 @@ static int nss_get_config(struct nss_ctx *nctx, } } } - talloc_free(filter_list); done: talloc_free(tmpctx); |