commit fcc3825543cf4b4133f32f55f895c1a0d72118fd
parent f4cd29a1b303a44d60974687a0d4c80259e68a66
Author: andreaha <andreaha@b31fe1f4-c0d1-0310-8000-a34f4ae90293>
Date: Tue, 3 Feb 2004 15:42:37 +0000
- Added support for CA path and CA file loading. CA file
loading didn't work earlier.
git-svn-id: file:///home/cwright/convert/bincimap/trunk@25 b31fe1f4-c0d1-0310-8000-a34f4ae90293
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/io-ssl.cc b/src/io-ssl.cc
@@ -135,10 +135,14 @@ bool SSLEnabledIO::setModeSSL(void)
return false;
}
- if (!SSL_CTX_load_verify_locations(ctx, CAfile.c_str(), CApath.c_str())) {
- setLastError("SSL error: unable to load CA file or path: "
- + string(ERR_error_string(ERR_get_error(), 0)));
- return false;
+ const char *CAfileptr = CAfile == "" ? 0 : CAfile.c_str();
+ const char *CApathptr = CApath == "" ? 0 : CApath.c_str();
+ if (CAfileptr || CApathptr) {
+ if (!SSL_CTX_load_verify_locations(ctx, CAfileptr, CApathptr)) {
+ setLastError("SSL error: unable to load CA file or path: "
+ + string(ERR_error_string(ERR_get_error(), 0)));
+ return false;
+ }
}
if (session.globalconfig["SSL"]["verify peer"] == "yes")