[PATCH] debuginfod: Translate CURLE_PEER_FAILED_VERIFICATION to ECONNREFUSED.

Mark Wielaard mark@klomp.org
Sun Oct 25 19:07:46 GMT 2020


When a file couldn't be retrieved because of an bad HTTPS certificate
find-debuginfod currently says:
Server query failed: No such file or directory

With this patch it will say:
Server query failed: Connection refused

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 debuginfod/ChangeLog            | 5 +++++
 debuginfod/debuginfod-client.c  | 1 +
 doc/ChangeLog                   | 5 +++++
 doc/debuginfod_find_debuginfo.3 | 3 ++-
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 3341f187..55857233 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2020-10-25  Mark Wielaard  <mark@klomp.org>
+
+	* debuginfod-client.c (debuginfod_query_server): Translate
+	CURLE_PEER_FAILED_VERIFICATION to ECONNREFUSED.
+
 2020-10-20  Frank Ch. Eigler  <fche@redhat.com>
 
 	PR26756: more prometheus metrics
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 18e7b85f..0e5177bc 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -871,6 +871,7 @@ debuginfod_query_server (debuginfod_client *c,
                 case CURLE_COULDNT_RESOLVE_HOST: rc = -EHOSTUNREACH; break; // no NXDOMAIN
                 case CURLE_URL_MALFORMAT: rc = -EINVAL; break;
                 case CURLE_COULDNT_CONNECT: rc = -ECONNREFUSED; break;
+                case CURLE_PEER_FAILED_VERIFICATION: rc = -ECONNREFUSED; break;
                 case CURLE_REMOTE_ACCESS_DENIED: rc = -EACCES; break;
                 case CURLE_WRITE_ERROR: rc = -EIO; break;
                 case CURLE_OUT_OF_MEMORY: rc = -ENOMEM; break;
diff --git a/doc/ChangeLog b/doc/ChangeLog
index ad17e992..bde52c11 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2020-10-25  Mark Wielaard  <mark@klomp.org>
+
+	* debuginfod_find_debuginfo.3 (ECONNREFUSED): Document that this
+	is also returned for a bad HTTPS server certificate.
+
 2020-10-07  Frank Ch. Eigler  <fche@redhat.com>
 
 	* debuginfod-find.1: Add missing .br for SYNOPSIS section.
diff --git a/doc/debuginfod_find_debuginfo.3 b/doc/debuginfod_find_debuginfo.3
index d9717d73..eec04e5e 100644
--- a/doc/debuginfod_find_debuginfo.3
+++ b/doc/debuginfod_find_debuginfo.3
@@ -254,7 +254,8 @@ Denied access to resource located at the URL.
 
 .TP
 .BR ECONNREFUSED
-Unable to connect to remote host.
+Unable to connect to remote host. Also returned when an HTTPS connection
+couldn't be verified (bad certificate).
 
 .TP
 .BR ECONNRESET
-- 
2.20.1



More information about the Elfutils-devel mailing list