summaryrefslogtreecommitdiff
path: root/src/responder/nss/nsssrv_cmd.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2011-12-29 02:19:11 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-03-19 09:45:25 -0400
commit6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01 (patch)
treea995fb3e2eae8d2cd5dbc4ef9133bf727745b6fe /src/responder/nss/nsssrv_cmd.c
parent24451a6231ea0b7fd0e98a9931e8254aa17bf4cf (diff)
downloadsssd-6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01.tar.gz
sssd-6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01.tar.bz2
sssd-6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01.zip
nsssrv: add handling of memory cache passwd map
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r--src/responder/nss/nsssrv_cmd.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 1e9927c1..cda2e563 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -24,6 +24,7 @@
#include "responder/nss/nsssrv_private.h"
#include "responder/nss/nsssrv_netgroup.h"
#include "responder/nss/nsssrv_services.h"
+#include "responder/nss/nsssrv_mmap_cache.h"
#include "responder/common/negcache.h"
#include "confdb/confdb.h"
#include "db/sysdb.h"
@@ -294,7 +295,7 @@ static const char *get_shell_override(TALLOC_CTX *mem_ctx,
static int fill_pwent(struct sss_packet *packet,
struct sss_domain_info *dom,
struct nss_ctx *nctx,
- bool filter_users,
+ bool filter_users, bool pw_mmap_cache,
struct ldb_message **msgs,
int *count)
{
@@ -445,6 +446,17 @@ static int fill_pwent(struct sss_packet *packet,
rp += shell.len;
num++;
+
+ if (pw_mmap_cache) {
+ ret = sss_mmap_cache_pw_store(nctx->pwd_mc_ctx,
+ &fullname, &pwfield,
+ uid, gid,
+ &gecos, &homedir, &shell);
+ if (ret != EOK && ret != ENOMEM) {
+ DEBUG(1, ("Failed to store user %s(%s) in mmap cache!",
+ name.str, domain));
+ }
+ }
}
talloc_zfree(tmp_ctx);
@@ -479,9 +491,10 @@ static int nss_cmd_getpw_send_reply(struct nss_dom_ctx *dctx, bool filter)
return EFAULT;
}
i = dctx->res->count;
+
ret = fill_pwent(cctx->creq->out,
dctx->domain,
- nctx, filter,
+ nctx, filter, true,
dctx->res->msgs, &i);
if (ret) {
return ret;
@@ -1580,7 +1593,8 @@ static int nss_cmd_retpwent(struct cli_ctx *cctx, int num)
msgs = &(pdom->res->msgs[cctx->pwent_cur]);
- ret = fill_pwent(cctx->creq->out, pdom->domain, nctx, true, msgs, &n);
+ ret = fill_pwent(cctx->creq->out, pdom->domain, nctx,
+ true, false, msgs, &n);
cctx->pwent_cur += n;
}