summaryrefslogtreecommitdiffstats
path: root/src/responder/nss
diff options
context:
space:
mode:
authorPavel Reichl <preichl@redhat.com>2014-02-26 16:58:24 +0000
committerJakub Hrozek <jhrozek@redhat.com>2014-06-19 18:03:53 +0200
commit09be002e58babda513b4b75d2b9eb9b2c351fa26 (patch)
treea18dbae13d34db5d0a8ed1532d9efc701eb61a14 /src/responder/nss
parent5377441d7a846461c2d9a7a870cea711360a529a (diff)
downloadsssd-09be002e58babda513b4b75d2b9eb9b2c351fa26.tar.gz
sssd-09be002e58babda513b4b75d2b9eb9b2c351fa26.tar.xz
sssd-09be002e58babda513b4b75d2b9eb9b2c351fa26.zip
NSS: sysdb_getnetgr check return value first
Output parameter was accessed before return value was checked. Reviewed-by: Michal Židek <mzidek@redhat.com>
Diffstat (limited to 'src/responder/nss')
-rw-r--r--src/responder/nss/nsssrv_netgroup.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c
index c269309f5..fae603b9b 100644
--- a/src/responder/nss/nsssrv_netgroup.c
+++ b/src/responder/nss/nsssrv_netgroup.c
@@ -474,11 +474,7 @@ static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx)
/* Look up the netgroup in the cache */
ret = sysdb_getnetgr(step_ctx->dctx, dom, name, &step_ctx->dctx->res);
- if (step_ctx->dctx->res->count > 1) {
- DEBUG(SSSDBG_FATAL_FAILURE,
- "getnetgr call returned more than one result !?!\n");
- return EMSGSIZE;
- }
+
if (ret == ENOENT) {
/* This netgroup was not found in this domain */
if (!step_ctx->dctx->check_provider) {
@@ -497,6 +493,12 @@ static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx)
return EIO;
}
+ if (step_ctx->dctx->res->count > 1) {
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "getnetgr call returned more than one result !?!\n");
+ return EMSGSIZE;
+ }
+
ret = get_netgroup_entry(step_ctx->nctx, step_ctx->name,
&netgr);
if (ret != EOK) {