]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed segfault when freeing https_port clientca on reconfigure or exit.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 28 Jun 2015 10:05:58 +0000 (03:05 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 28 Jun 2015 10:05:58 +0000 (03:05 -0700)
AnyP::PortCfg::clientCA list was double-freed because the SSL context takes
ownership of the STACK_OF(X509_NAME) supplied via SSL_CTX_set_client_CA_list(),
but Squid was not aware of that. Squid now supplies a clone of clientCA.

src/ssl/support.cc

index dacb3cce3dcbfbef1760c19b759c28b67a043913..85305ce895337fbecd718b7ab31f3c8bf7f6fd3f 100644 (file)
@@ -902,7 +902,13 @@ configureSslContext(SSL_CTX *sslContext, AnyP::PortCfg &port)
 
     if (port.clientCA.get()) {
         ERR_clear_error();
-        SSL_CTX_set_client_CA_list(sslContext, port.clientCA.get());
+        if (STACK_OF(X509_NAME) *clientca = SSL_dup_CA_list(port.clientCA.get())) {
+            SSL_CTX_set_client_CA_list(sslContext, clientca);
+        } else {
+            ssl_error = ERR_get_error();
+            debugs(83, DBG_CRITICAL, "ERROR: Failed to dupe the client CA list: " << ERR_error_string(ssl_error, NULL));
+            return false;
+        }
 
         if (port.sslContextFlags & SSL_FLAG_DELAYED_AUTH) {
             debugs(83, 9, "Not requesting client certificates until acl processing requires one");