SHA256
1
0
forked from pool/gsoap
gsoap/gsoap-sslverify.diff

30 lines
1.2 KiB
Diff

From: Jan Engelhardt <jengelh@inai.de>
References: https://sourceforge.net/p/gsoap2/patches/168/
When verification of a certificate has failed, do not just leave soap->msgbuf
at the default openssl message ("certificate validation failed" or so), but
append the detailed error message from the verification stage as well.
---
gsoap/stdsoap2.cpp | 7 +++++++
1 file changed, 7 insertions(+)
Index: gsoap-2.8.43/gsoap/stdsoap2.cpp
===================================================================
--- gsoap-2.8.43.orig/gsoap/stdsoap2.cpp
+++ gsoap-2.8.43/gsoap/stdsoap2.cpp
@@ -3672,6 +3672,13 @@ soap_ssl_error(struct soap *soap, int re
while ((r = ERR_get_error()))
{ size_t l = strlen(soap->msgbuf);
ERR_error_string_n(r, soap->msgbuf + l, sizeof(soap->msgbuf) - l);
+ l = strlen(soap->msgbuf);
+ if (l + 1 < sizeof(soap->msgbuf))
+ soap->msgbuf[l++] = '\n';
+ if (ERR_GET_REASON(r) == SSL_R_CERTIFICATE_VERIFY_FAILED && l <= sizeof(soap->msgbuf)) {
+ const char *reason = X509_verify_cert_error_string(SSL_get_verify_result(soap->ssl));
+ (SOAP_SNPRINTF(soap->msgbuf + l, sizeof(soap->msgbuf) - l, strlen(reason)), "%s", reason);
+ }
}
}
else