]> granicus.if.org Git - icinga2/commitdiff
Fixed return code check in CRL loading
authorSebastian Marsching <sebastian-git-2016@marsching.com>
Mon, 27 Feb 2017 18:26:34 +0000 (19:26 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 28 Feb 2017 13:08:24 +0000 (14:08 +0100)
The code for loading CRLs was incorrectly assuming that OpenSSL's
X509_LOOKUP_load_file function returns zero on success, but actually it
returns one on success. This commit fixes this return code check so
that a CRL can be loaded.

fixes #5040

Signed-off-by: Gunnar Beutner <gunnar.beutner@icinga.com>
lib/base/tlsutility.cpp

index 90d74447807f0c131476c474f899418c2ffa3de9..c9eedd23077adf58fb6550df1b30f37327d97184 100644 (file)
@@ -231,7 +231,7 @@ void AddCRLToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String&
                    << errinfo_openssl_error(ERR_peek_error()));
        }
 
-       if (X509_LOOKUP_load_file(lookup, crlPath.CStr(), X509_FILETYPE_PEM) != 0) {
+       if (X509_LOOKUP_load_file(lookup, crlPath.CStr(), X509_FILETYPE_PEM) != 1) {
                Log(LogCritical, "SSL")
                    << "Error loading crl file '" << crlPath << "': " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";
                BOOST_THROW_EXCEPTION(openssl_error()