|
|
b2d430 |
From 1d0a914578ce72bad86cbe9e0beeda0c3b2d1dee Mon Sep 17 00:00:00 2001
|
|
|
b2d430 |
From: Lukas Slebodnik <lslebodn@redhat.com>
|
|
|
b2d430 |
Date: Mon, 8 Aug 2016 17:30:29 +0200
|
|
|
b2d430 |
Subject: [PATCH 81/82] NSS: Use correct name for invalidating memory cache
|
|
|
b2d430 |
|
|
|
b2d430 |
After refactoring of sysdb, we get and internal fully qualified
|
|
|
b2d430 |
name from backend in org.freedesktop.sssd.dataprovider_rev.initgrCheck
|
|
|
b2d430 |
Previously we got short name and we created fq name in
|
|
|
b2d430 |
nss_update_initgr_memcache. Memory cache still need to use short names
|
|
|
b2d430 |
if it was specified.
|
|
|
b2d430 |
|
|
|
b2d430 |
This patch uses right name in different places.
|
|
|
b2d430 |
|
|
|
b2d430 |
Reviewed-by: Petr Cech <pcech@redhat.com>
|
|
|
b2d430 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
b2d430 |
---
|
|
|
b2d430 |
src/responder/nss/nsssrv_cmd.c | 31 +++++++++++++++++--------------
|
|
|
b2d430 |
src/responder/nss/nsssrv_private.h | 2 +-
|
|
|
b2d430 |
2 files changed, 18 insertions(+), 15 deletions(-)
|
|
|
b2d430 |
|
|
|
b2d430 |
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
|
|
|
b2d430 |
index f3b6ac4afb5d1571f283933b48e0256b91c56391..573959ea76fc1277fe84f40b88dcd34093da468d 100644
|
|
|
b2d430 |
--- a/src/responder/nss/nsssrv_cmd.c
|
|
|
b2d430 |
+++ b/src/responder/nss/nsssrv_cmd.c
|
|
|
b2d430 |
@@ -3961,13 +3961,13 @@ done:
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
void nss_update_initgr_memcache(struct nss_ctx *nctx,
|
|
|
b2d430 |
- const char *name, const char *domain,
|
|
|
b2d430 |
+ const char *fq_name, const char *domain,
|
|
|
b2d430 |
int gnum, uint32_t *groups)
|
|
|
b2d430 |
{
|
|
|
b2d430 |
TALLOC_CTX *tmp_ctx = NULL;
|
|
|
b2d430 |
struct sss_domain_info *dom;
|
|
|
b2d430 |
struct ldb_result *res;
|
|
|
b2d430 |
- struct sized_string delete_name;
|
|
|
b2d430 |
+ struct sized_string *delete_name;
|
|
|
b2d430 |
bool changed = false;
|
|
|
b2d430 |
uint32_t id;
|
|
|
b2d430 |
uint32_t gids[gnum];
|
|
|
b2d430 |
@@ -3987,8 +3987,19 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
tmp_ctx = talloc_new(NULL);
|
|
|
b2d430 |
+ if (tmp_ctx == NULL) {
|
|
|
b2d430 |
+ return;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
|
|
|
b2d430 |
- ret = sysdb_initgroups(tmp_ctx, dom, name, &res;;
|
|
|
b2d430 |
+ ret = sized_output_name(tmp_ctx, nctx->rctx, fq_name, dom, &delete_name);
|
|
|
b2d430 |
+ if (ret != EOK) {
|
|
|
b2d430 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
b2d430 |
+ "sized_output_name failed for '%s': %d [%s]\n",
|
|
|
b2d430 |
+ fq_name, ret, sss_strerror(ret));
|
|
|
b2d430 |
+ goto done;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+
|
|
|
b2d430 |
+ ret = sysdb_initgroups(tmp_ctx, dom, fq_name, &res;;
|
|
|
b2d430 |
if (ret != EOK && ret != ENOENT) {
|
|
|
b2d430 |
DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
b2d430 |
"Failed to make request to our cache! [%d][%s]\n",
|
|
|
b2d430 |
@@ -4002,8 +4013,7 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
|
|
|
b2d430 |
|
|
|
b2d430 |
if (ret == ENOENT || res->count == 0) {
|
|
|
b2d430 |
/* The user is gone. Invalidate the mc record */
|
|
|
b2d430 |
- to_sized_string(&delete_name, name);
|
|
|
b2d430 |
- ret = sss_mmap_cache_pw_invalidate(nctx->pwd_mc_ctx, &delete_name);
|
|
|
b2d430 |
+ ret = sss_mmap_cache_pw_invalidate(nctx->pwd_mc_ctx, delete_name);
|
|
|
b2d430 |
if (ret != EOK && ret != ENOENT) {
|
|
|
b2d430 |
DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
b2d430 |
"Internal failure in memory cache code: %d [%s]\n",
|
|
|
b2d430 |
@@ -4047,13 +4057,6 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
if (changed) {
|
|
|
b2d430 |
- char *fq_name = sss_tc_fqname(tmp_ctx, dom->names, dom, name);
|
|
|
b2d430 |
- if (!fq_name) {
|
|
|
b2d430 |
- DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
b2d430 |
- "Could not create fq name\n");
|
|
|
b2d430 |
- goto done;
|
|
|
b2d430 |
- }
|
|
|
b2d430 |
-
|
|
|
b2d430 |
for (i = 0; i < gnum; i++) {
|
|
|
b2d430 |
id = groups[i];
|
|
|
b2d430 |
|
|
|
b2d430 |
@@ -4065,9 +4068,9 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
|
|
|
b2d430 |
}
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
- to_sized_string(&delete_name, fq_name);
|
|
|
b2d430 |
+ to_sized_string(delete_name, fq_name);
|
|
|
b2d430 |
ret = sss_mmap_cache_initgr_invalidate(nctx->initgr_mc_ctx,
|
|
|
b2d430 |
- &delete_name);
|
|
|
b2d430 |
+ delete_name);
|
|
|
b2d430 |
if (ret != EOK && ret != ENOENT) {
|
|
|
b2d430 |
DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
b2d430 |
"Internal failure in memory cache code: %d [%s]\n",
|
|
|
b2d430 |
diff --git a/src/responder/nss/nsssrv_private.h b/src/responder/nss/nsssrv_private.h
|
|
|
b2d430 |
index 79c7b7265f66f57e0ea89fe192a1da4f8992f1a3..391eaaf40f84a7436bee63fd699241e4957fdbeb 100644
|
|
|
b2d430 |
--- a/src/responder/nss/nsssrv_private.h
|
|
|
b2d430 |
+++ b/src/responder/nss/nsssrv_private.h
|
|
|
b2d430 |
@@ -146,7 +146,7 @@ errno_t check_cache(struct nss_dom_ctx *dctx,
|
|
|
b2d430 |
void nss_update_pw_memcache(struct nss_ctx *nctx);
|
|
|
b2d430 |
void nss_update_gr_memcache(struct nss_ctx *nctx);
|
|
|
b2d430 |
void nss_update_initgr_memcache(struct nss_ctx *nctx,
|
|
|
b2d430 |
- const char *name, const char *domain,
|
|
|
b2d430 |
+ const char *fq_name, const char *domain,
|
|
|
b2d430 |
int gnum, uint32_t *groups);
|
|
|
b2d430 |
|
|
|
b2d430 |
int nss_connection_setup(struct cli_ctx *cctx);
|
|
|
b2d430 |
--
|
|
|
b2d430 |
2.4.11
|
|
|
b2d430 |
|