File 140624-NSS-lookup_netgr_step-don-t-access-result-on-ENOENT.patch of Package sssd.5306
diff -rupN sssd-1.11.5.1-original/src/responder/nss/nsssrv_netgroup.c sssd-1.11.5.1-patched/src/responder/nss/nsssrv_netgroup.c
--- sssd-1.11.5.1-original/src/responder/nss/nsssrv_netgroup.c 2017-03-08 17:03:37.374746044 +0100
+++ sssd-1.11.5.1-patched/src/responder/nss/nsssrv_netgroup.c 2017-03-08 17:03:59.426980144 +0100
@@ -510,25 +510,24 @@ static errno_t lookup_netgr_step(struct
/* Look up the netgroup in the cache */
ret = sysdb_getnetgr(step_ctx->dctx, sysdb, 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"));
- ret = EMSGSIZE;
- goto done;
- }
- if (ret == ENOENT) {
+ if (ret == EOK) {
+ if (step_ctx->dctx->res->count > 1) {
+ DEBUG(SSSDBG_FATAL_FAILURE, (
+ "getnetgr call returned more than one result !?!\n"));
+ ret = EMSGSIZE;
+ goto done;
+ }
+ } else if (ret == ENOENT) {
/* This netgroup was not found in this domain */
if (!step_ctx->dctx->check_provider) {
if (step_ctx->check_next) {
dom = get_next_domain(dom, false);
continue;
+ } else {
+ break;
}
- else break;
}
- ret = EOK;
- }
-
- if (ret != EOK) {
+ } else {
DEBUG(1, ("Failed to make request to our cache!\n"));
ret = EIO;
goto done;