From 684ab7416ea1311a98516faddcc975a9731b2a0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Tue, 19 Jul 2016 14:42:26 +0200
Subject: [PATCH 101/102] NSS: Remove unused functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When removing the old data provider I noticed that those functions
are not used at all.
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
(cherry picked from commit f31610a9ba26b46de9eeab2b0719ff6ad8961104)
---
src/responder/nss/nsssrv.c | 11 ----
src/responder/nss/nsssrv_cmd.c | 112 -------------------------------------
src/responder/nss/nsssrv_private.h | 2 -
3 files changed, 125 deletions(-)
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 05b51ecdf2e17e20af2ee3ee48377cbe1bf19a24..06d58f21b00b73c6c7a4b7583e10b4b61a627d75 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -328,17 +328,6 @@ done:
return ret;
}
-int nss_update_memcache(struct sbus_request *dbus_req, void *data)
-{
- struct resp_ctx *rctx = talloc_get_type(data, struct resp_ctx);
- struct nss_ctx *nctx = talloc_get_type(rctx->pvt_ctx, struct nss_ctx);
-
- nss_update_pw_memcache(nctx);
- nss_update_gr_memcache(nctx);
-
- return EOK;
-}
-
int nss_memorycache_update_initgroups(struct sbus_request *sbus_req,
void *data,
const char *user,
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 573959ea76fc1277fe84f40b88dcd34093da468d..b64cea2a53ec6032904237b0afc1377022c2c804 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -118,66 +118,6 @@ static int nss_reset_negcache(struct resp_ctx *rctx)
* PASSWD db related functions
***************************************************************************/
-void nss_update_pw_memcache(struct nss_ctx *nctx)
-{
- struct sss_domain_info *dom;
- struct ldb_result *res;
- uint64_t exp;
- struct sized_string key;
- const char *id;
- time_t now;
- int ret;
- int i;
-
- now = time(NULL);
-
- for (dom = nctx->rctx->domains; dom; dom = get_next_domain(dom, 0)) {
- ret = sysdb_enumpwent_with_views(nctx, dom, &res);
- if (ret != EOK) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- "Failed to enumerate users for domain [%s]\n", dom->name);
- continue;
- }
-
- for (i = 0; i < res->count; i++) {
- exp = ldb_msg_find_attr_as_uint64(res->msgs[i],
- SYSDB_CACHE_EXPIRE, 0);
- if (exp >= now) {
- continue;
- }
-
- /* names require more manipulation (build up fqname conditionally),
- * but uidNumber is unique and always resolvable too, so we use
- * that to update the cache, as it points to the same entry */
- id = sss_view_ldb_msg_find_attr_as_string(dom, res->msgs[i],
- SYSDB_UIDNUM, NULL);
- if (!id) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- "Failed to find uidNumber in %s.\n",
- ldb_dn_get_linearized(res->msgs[i]->dn));
- continue;
- }
- to_sized_string(&key, id);
-
- ret = sss_mmap_cache_pw_invalidate(nctx->pwd_mc_ctx, &key);
- if (ret != EOK && ret != ENOENT) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- "Internal failure in memory cache code: %d [%s]\n",
- ret, strerror(ret));
- }
-
- ret = sss_mmap_cache_pw_invalidate(nctx->initgr_mc_ctx, &key);
- if (ret != EOK && ret != ENOENT) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- "Internal failure in memory cache code: %d [%s]\n",
- ret, strerror(ret));
- }
- }
-
- talloc_zfree(res);
- }
-}
-
static gid_t get_gid_override(struct ldb_message *msg,
struct sss_domain_info *dom)
{
@@ -2743,58 +2683,6 @@ done:
* GROUP db related functions
***************************************************************************/
-void nss_update_gr_memcache(struct nss_ctx *nctx)
-{
- struct sss_domain_info *dom;
- struct ldb_result *res;
- uint64_t exp;
- struct sized_string key;
- const char *id;
- time_t now;
- int ret;
- int i;
-
- now = time(NULL);
-
- for (dom = nctx->rctx->domains; dom; dom = get_next_domain(dom, 0)) {
- ret = sysdb_enumgrent_with_views(nctx, dom, &res);
- if (ret != EOK) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- "Failed to enumerate users for domain [%s]\n", dom->name);
- continue;
- }
-
- for (i = 0; i < res->count; i++) {
- exp = ldb_msg_find_attr_as_uint64(res->msgs[i],
- SYSDB_CACHE_EXPIRE, 0);
- if (exp >= now) {
- continue;
- }
-
- /* names require more manipulation (build up fqname conditionally),
- * but uidNumber is unique and always resolvable too, so we use
- * that to update the cache, as it points to the same entry */
- id = sss_view_ldb_msg_find_attr_as_string(dom, res->msgs[i],
- SYSDB_GIDNUM, NULL);
- if (!id) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- "Failed to find gidNumber in %s.\n",
- ldb_dn_get_linearized(res->msgs[i]->dn));
- continue;
- }
- to_sized_string(&key, id);
-
- ret = sss_mmap_cache_gr_invalidate(nctx->grp_mc_ctx, &key);
- if (ret != EOK && ret != ENOENT) {
- DEBUG(SSSDBG_CRIT_FAILURE,
- "Internal failure in memory cache code: %d [%s]\n",
- ret, strerror(ret));
- }
- }
- talloc_zfree(res);
- }
-}
-
#define GID_ROFFSET 0
#define MNUM_ROFFSET sizeof(uint32_t)
#define STRS_ROFFSET 2*sizeof(uint32_t)
diff --git a/src/responder/nss/nsssrv_private.h b/src/responder/nss/nsssrv_private.h
index 391eaaf40f84a7436bee63fd699241e4957fdbeb..472022235adab2c2d2547ee2706ef23fa91b1f8d 100644
--- a/src/responder/nss/nsssrv_private.h
+++ b/src/responder/nss/nsssrv_private.h
@@ -143,8 +143,6 @@ errno_t check_cache(struct nss_dom_ctx *dctx,
sss_dp_callback_t callback,
void *pvt);
-void nss_update_pw_memcache(struct nss_ctx *nctx);
-void nss_update_gr_memcache(struct nss_ctx *nctx);
void nss_update_initgr_memcache(struct nss_ctx *nctx,
const char *fq_name, const char *domain,
int gnum, uint32_t *groups);
--
2.4.11