From a19c42b15aff752310a6a6bb43d0e62534e8d117 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 27 Mar 2009 13:47:14 -0400 Subject: Fix uninitailized pointer and cut&paste error The structure we copy the domain pointerr on is not zero when allocated. We need to zero it ourselves or we get segfaults later on. A cut&paste error caused us to call the wrong getpw function. --- server/responder/nss/nsssrv_cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server/responder/nss') diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c index 498825ea..a9378783 100644 --- a/server/responder/nss/nsssrv_cmd.c +++ b/server/responder/nss/nsssrv_cmd.c @@ -720,7 +720,7 @@ static void nss_cmd_getpwuid_dp_callback(uint16_t err_maj, uint32_t err_min, } } - nss_cmd_getpwnam_callback(dctx, LDB_SUCCESS, dctx->res); + nss_cmd_getpwuid_callback(dctx, LDB_SUCCESS, dctx->res); return; } @@ -861,6 +861,8 @@ static void nss_cmd_setpwent_callback(void *ptr, int status, if (dctx->add_domain) { pctx->doms[pctx->num].domain = dctx->domain->name; + } else { + pctx->doms[pctx->num].domain = NULL; } pctx->doms[pctx->num].res = talloc_steal(pctx->doms, res); pctx->doms[pctx->num].cur = 0; @@ -1902,6 +1904,8 @@ static void nss_cmd_setgrent_callback(void *ptr, int status, if (dctx->add_domain) { gctx->doms[gctx->num].domain = dctx->domain->name; + } else { + gctx->doms[gctx->num].domain = NULL; } gctx->doms[gctx->num].res = talloc_steal(gctx->doms, res); gctx->doms[gctx->num].cur = 0; -- cgit