diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-03-20 02:23:31 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-03-20 11:14:57 -0400 |
commit | 4700874a84c4c0ac52ebd4ed25424a7de4d549ae (patch) | |
tree | 15e968db1d56f07b4c6cef8046bc02f8a75de320 | |
parent | de69927053fcc56a337af4ab0c93d24444eb6c24 (diff) | |
download | sssd-4700874a84c4c0ac52ebd4ed25424a7de4d549ae.tar.gz sssd-4700874a84c4c0ac52ebd4ed25424a7de4d549ae.tar.xz sssd-4700874a84c4c0ac52ebd4ed25424a7de4d549ae.zip |
Retrieve some options from confdb
This fixes some old 'Fixme's :)
-rw-r--r-- | server/responder/nss/nsssrv.c | 45 | ||||
-rw-r--r-- | server/responder/nss/nsssrv.h | 2 | ||||
-rw-r--r-- | server/responder/nss/nsssrv_cmd.c | 10 |
3 files changed, 46 insertions, 11 deletions
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c index c1bfb9694..f639de748 100644 --- a/server/responder/nss/nsssrv.c +++ b/server/responder/nss/nsssrv.c @@ -431,6 +431,37 @@ done: return retval; } +static int nss_get_config(struct nss_ctx *nctx) +{ + int ret; + + ret = confdb_get_int(nctx->cdb, nctx, NSS_SRV_CONFIG, + "EnumCacheTimeout", 120, + &nctx->enum_cache_timeout); + if (ret != EOK) goto done; + + ret = confdb_get_int(nctx->cdb, nctx, NSS_SRV_CONFIG, + "EntryCacheTimeout", 600, + &nctx->enum_cache_timeout); + if (ret != EOK) goto done; + + ret = confdb_get_int(nctx->cdb, nctx, NSS_SRV_CONFIG, + "EntryNegativeTimeout", 15, + &nctx->enum_cache_timeout); + if (ret != EOK) goto done; + + ret = confdb_get_param(nctx->cdb, nctx, NSS_SRV_CONFIG, + "filterUsers", &nctx->filter_users); + if (ret != EOK) goto done; + + ret = confdb_get_param(nctx->cdb, nctx, NSS_SRV_CONFIG, + "filterGroups", &nctx->filter_groups); + if (ret != EOK) goto done; + +done: + return ret; +} + int nss_process_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct confdb_ctx *cdb) @@ -470,10 +501,9 @@ int nss_process_init(TALLOC_CTX *mem_ctx, return ret; } - /* after all initializations we are ready to listen on our socket */ - ret = set_unix_socket(nctx); + ret = nss_get_config(nctx); if (ret != EOK) { - DEBUG(0, ("fatal error initializing socket\n")); + DEBUG(0, ("fatal error getting nss config\n")); return ret; } @@ -483,9 +513,12 @@ int nss_process_init(TALLOC_CTX *mem_ctx, return ret; } - nctx->expire_time = 120; /* FIXME: read from conf */ - nctx->cache_timeout = 600; /* FIXME: read from conf */ - nctx->neg_timeout = 15; /* FIXME: read from conf */ + /* after all initializations we are ready to listen on our socket */ + ret = set_unix_socket(nctx); + if (ret != EOK) { + DEBUG(0, ("fatal error initializing socket\n")); + return ret; + } DEBUG(1, ("NSS Initialization complete\n")); diff --git a/server/responder/nss/nsssrv.h b/server/responder/nss/nsssrv.h index 954ae8f23..479c6caf5 100644 --- a/server/responder/nss/nsssrv.h +++ b/server/responder/nss/nsssrv.h @@ -69,7 +69,7 @@ struct nss_ctx { int neg_timeout; struct nss_nc_ctx *ncache; - int expire_time; + int enum_cache_timeout; time_t last_user_enum; time_t last_group_enum; diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c index ebd4adae5..498825ea5 100644 --- a/server/responder/nss/nsssrv_cmd.c +++ b/server/responder/nss/nsssrv_cmd.c @@ -962,8 +962,9 @@ static int nss_cmd_setpwent_ext(struct cli_ctx *cctx, bool immediate) } /* do not query backends if we have a recent enumeration */ - if (cctx->nctx->expire_time) { - if (cctx->nctx->last_user_enum + cctx->nctx->expire_time > now) { + if (cctx->nctx->enum_cache_timeout) { + if (cctx->nctx->last_user_enum + + cctx->nctx->enum_cache_timeout > now) { cached = true; } } @@ -2002,8 +2003,9 @@ static int nss_cmd_setgrent_ext(struct cli_ctx *cctx, bool immediate) } /* do not query backends if we have a recent enumeration */ - if (cctx->nctx->expire_time) { - if (cctx->nctx->last_group_enum + cctx->nctx->expire_time > now) { + if (cctx->nctx->enum_cache_timeout) { + if (cctx->nctx->last_group_enum + + cctx->nctx->enum_cache_timeout > now) { cached = true; } } |