]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed segmentation fault when freeing https_port clientca on reconfigure
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 19 Jun 2015 16:57:30 +0000 (10:57 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 19 Jun 2015 16:57:30 +0000 (10:57 -0600)
or exit.

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 f5d0696ef281d32de78db2f6826795bf9d4f1a46..e2ea36d74c4b1532dae2571656a23aa7f157f28c 100644 (file)
@@ -925,7 +925,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");