]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Use pdns::OpenSSL::error and decltype() 12435/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 18 Jan 2023 15:43:25 +0000 (16:43 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 18 Jan 2023 15:43:25 +0000 (16:43 +0100)
As suggested by Fred (thanks!).

pdns/libssl.cc

index 4c1fa5117449649b5e0b04d5930541a4ca739d3c..e9fcba6cefc3ba77219c3670194389a77759e41a 100644 (file)
@@ -804,11 +804,10 @@ bool OpenSSLTLSTicketKey::decrypt(const unsigned char* iv, EVP_CIPHER_CTX* ectx,
 std::unique_ptr<SSL_CTX, void(*)(SSL_CTX*)> libssl_init_server_context(const TLSConfig& config,
                                                                        std::map<int, std::string>& ocspResponses)
 {
-  auto ctx = std::unique_ptr<SSL_CTX, void(*)(SSL_CTX*)>(SSL_CTX_new(SSLv23_server_method()), SSL_CTX_free);
+  auto ctx = std::unique_ptr<SSL_CTX, decltype(&SSL_CTX_free)>(SSL_CTX_new(SSLv23_server_method()), SSL_CTX_free);
 
   if (!ctx) {
-    ERR_print_errors_fp(stderr);
-    throw std::runtime_error("Error creating an OpenSSL server context");
+    throw pdns::OpenSSL::error("Error creating an OpenSSL server context");
   }
 
   int sslOptions =