51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
From 64e7e9680877199b86dfa042e581c624be48c21b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
Date: Fri, 1 Aug 2025 15:06:13 +0100
|
|
Subject: [PATCH 10/30] crypto: replace stat() with access() for credential
|
|
checks
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
RH-Author: Daniel P. Berrangé <berrange@redhat.com>
|
|
RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
|
|
RH-Jira: RHEL-111934
|
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
RH-Commit: [9/27] d0106e01c1f312ed35cc405f5b992cfa5c912936 (berrange/centos-src-qemu)
|
|
|
|
Readability of the credential files is what matters for our usage,
|
|
so access() is more appropriate than stat().
|
|
|
|
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
(cherry picked from commit 2114ae9faaabe4ff1c455811bb38085324af17b7)
|
|
---
|
|
crypto/tlscreds.c | 3 +--
|
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
|
diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
|
|
index 9e59594d67..208a7e6d8f 100644
|
|
--- a/crypto/tlscreds.c
|
|
+++ b/crypto/tlscreds.c
|
|
@@ -100,7 +100,6 @@ qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
|
|
char **cred,
|
|
Error **errp)
|
|
{
|
|
- struct stat sb;
|
|
int ret = -1;
|
|
|
|
if (!creds->dir) {
|
|
@@ -114,7 +113,7 @@ qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
|
|
|
|
*cred = g_strdup_printf("%s/%s", creds->dir, filename);
|
|
|
|
- if (stat(*cred, &sb) < 0) {
|
|
+ if (access(*cred, R_OK) < 0) {
|
|
if (errno == ENOENT && !required) {
|
|
ret = 0;
|
|
} else {
|
|
--
|
|
2.52.0
|
|
|