summaryrefslogtreecommitdiff
path: root/~lukeshu/esmtp/0001-Produce-more-useful-Invalid-peer-certificate-error-m.patch
blob: 5ae2bd64aee77561cf0f5a127583d5378211d883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 16a657b2626a66d15fc4c35041cd30f94ed4d17d Mon Sep 17 00:00:00 2001
From: Luke Shumaker <lukeshu@lukeshu.com>
Date: Tue, 21 Nov 2017 11:42:54 -0500
Subject: [PATCH 1/1] Produce more useful "Invalid peer certificate" error
 messages

---
 smtp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/smtp.c b/smtp.c
index 796578d..00cf066 100644
--- a/smtp.c
+++ b/smtp.c
@@ -18,6 +18,7 @@
 #include <pwd.h>
 #include <unistd.h>
 
+#include <openssl/ssl.h>
 #include <auth-client.h>
 #include <libesmtp.h>
 
@@ -210,7 +211,9 @@ static void event_cb (smtp_session_t session, int event_no, void *arg, ...)
 			long result = va_arg (ap, long);
 			int *ok = va_arg (ap, int *);
 
-			fprintf(stderr, "Invalid peer certificate (error %ld)\n", result);
+			fprintf(stderr, "Invalid peer certificate (error %ld: %s)\n",
+				result,
+				X509_verify_cert_error_string(result));
 
 			*ok = 0;
 			break;
-- 
2.15.0