Blame SOURCES/0007-Fix-file-descriptor-leak-when-executing-CA-helpers.patch

77e006
From f9c774f737a060b355533c215d7443b9865992a0 Mon Sep 17 00:00:00 2001
77e006
From: Rob Crittenden <rcritten@redhat.com>
77e006
Date: Thu, 12 Aug 2021 16:26:09 -0400
77e006
Subject: [PATCH] Fix file descriptor leak when executing CA helpers
77e006
77e006
cm_cadata_start_generic() creates a pipe. One half is passed
77e006
to fetch(), the function that does all helper calls,
77e006
via the cm_cadata_state variable ret. The other half is the
77e006
reader and is used to detect execution errors. There is a pair
77e006
of write/read on this descriptor which on error would be the
77e006
errno.
77e006
77e006
This second half wasn't being closed after reading to test for
77e006
errors.
77e006
77e006
https://bugzilla.redhat.com/show_bug.cgi?id=1992439
77e006
77e006
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
77e006
---
77e006
 src/cadata.c | 2 ++
77e006
 1 file changed, 2 insertions(+)
77e006
77e006
diff --git a/src/cadata.c b/src/cadata.c
77e006
index 3e916c9..d851b9e 100644
77e006
--- a/src/cadata.c
77e006
+++ b/src/cadata.c
77e006
@@ -772,8 +772,10 @@ cm_cadata_start_generic(struct cm_store_ca *ca, const char *op,
77e006
 		cm_log(1, "Error running enrollment helper \"%s\": %s.\n",
77e006
 		       ca->cm_ca_external_helper, strerror(u));
77e006
 		talloc_free(ret);
77e006
+		close(error_fd[0]);
77e006
 		return NULL;
77e006
 	}
77e006
+	close(error_fd[0]);
77e006
 	return ret;
77e006
 }
77e006
 
77e006
-- 
77e006
2.31.1
77e006