Blame SOURCES/0107-nss-initialize-nss_enum_index-in-nss_setnetgrent.patch

086f82
From 1e2f20f89b1b699e569dfecb7cba98ec8f6fc936 Mon Sep 17 00:00:00 2001
086f82
From: Sumit Bose <sbose@redhat.com>
086f82
Date: Thu, 15 Mar 2018 12:43:34 +0100
086f82
Subject: [PATCH] nss: initialize nss_enum_index in nss_setnetgrent()
086f82
086f82
setnetgrent() is the first call when looking up a netgroup and sets the
086f82
netgroup name for upcoming getnetgrent() and endnetgrent() calls.
086f82
Currently the state is reset by calling endnetgrent() but it would be
086f82
more robust to unconditionally reset the state in setnetgrent() as well
086f82
in case calling endnetgrent() was forgotten.
086f82
086f82
Related to https://pagure.io/SSSD/sssd/issue/3679
086f82
086f82
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
086f82
(cherry picked from commit 37a84285aeb497ed4909d16916bbf934af3f68b3)
086f82
---
086f82
 src/responder/nss/nss_cmd.c | 3 +++
086f82
 1 file changed, 3 insertions(+)
086f82
086f82
diff --git a/src/responder/nss/nss_cmd.c b/src/responder/nss/nss_cmd.c
086f82
index 956ee53cb88dd24faaa95ac39c8d9540af66cfb2..9f8479b7b350823ee81b5af15199e0dda9acda8b 100644
086f82
--- a/src/responder/nss/nss_cmd.c
086f82
+++ b/src/responder/nss/nss_cmd.c
086f82
@@ -756,6 +756,9 @@ static errno_t nss_setnetgrent(struct cli_ctx *cli_ctx,
086f82
         goto done;
086f82
     }
086f82
 
086f82
+    state_ctx->netgrent.domain = 0;
086f82
+    state_ctx->netgrent.result = 0;
086f82
+
086f82
     talloc_zfree(state_ctx->netgroup);
086f82
     state_ctx->netgroup = talloc_strdup(state_ctx, netgroup);
086f82
     if (state_ctx->netgroup == NULL) {
086f82
-- 
086f82
2.17.0
086f82