summaryrefslogtreecommitdiffstats
path: root/src/responder/nss/nsssrv_cmd.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-12-19 21:17:40 -0500
committerJakub Hrozek <jhrozek@redhat.com>2012-12-20 20:06:39 +0100
commit2269b53337afcc18f52110d03fa808c4b3039ee0 (patch)
tree443a2e2f57881bd3ca1e19c59c2f30a77cc858b3 /src/responder/nss/nsssrv_cmd.c
parent2184c4748c19dfe1a0640e121ee73797ecd13ded (diff)
downloadsssd-2269b53337afcc18f52110d03fa808c4b3039ee0.tar.gz
sssd-2269b53337afcc18f52110d03fa808c4b3039ee0.tar.xz
sssd-2269b53337afcc18f52110d03fa808c4b3039ee0.zip
mmap cache: invalidate cache on fatal error
If a fatal EFAULT error is returned by the internal function that frees used memory invalidate the whole cache and reinit it. This way we avoid further corruption and insure clients see consistent data. Also insure we use the right context in init() and we use talloc_zfree() in reinit so that if the init() later fails we do not leave around a pointer to free memory in the callers.
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r--src/responder/nss/nsssrv_cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 22eba5127..0fb726712 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -430,7 +430,7 @@ static int fill_pwent(struct sss_packet *packet,
num++;
if (pw_mmap_cache && nctx->pwd_mc_ctx) {
- ret = sss_mmap_cache_pw_store(nctx->pwd_mc_ctx,
+ ret = sss_mmap_cache_pw_store(&nctx->pwd_mc_ctx,
&fullname, &pwfield,
uid, gid,
&gecos, &homedir, &shell);
@@ -2180,7 +2180,7 @@ static int fill_grent(struct sss_packet *packet,
/* body was reallocated, so fullname might be pointing to
* where body used to be, not where it is */
to_sized_string(&fullname, (const char *)&body[rzero+STRS_ROFFSET]);
- ret = sss_mmap_cache_gr_store(nctx->grp_mc_ctx,
+ ret = sss_mmap_cache_gr_store(&nctx->grp_mc_ctx,
&fullname, &pwfield, gid, memnum,
(char *)&body[rzero] + STRS_ROFFSET +
fullname.len + pwfield.len,