]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3211: ssl_crtd start even if no ssl-bump port is configured
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Sun, 14 Aug 2011 03:28:48 +0000 (21:28 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 14 Aug 2011 03:28:48 +0000 (21:28 -0600)
src/client_side.cc
src/main.cc
src/ssl/helper.cc

index 4f62f0a8756006ddae5665a07cab7b514ae06d7d..66108570869e037769a364979e4e5717879da2b0 100644 (file)
@@ -3629,9 +3629,6 @@ clientHttpConnectionsOpen(void)
             Ssl::TheGlobalContextStorage.addLocalStorage(s->s, s->dynamicCertMemCacheSize == std::numeric_limits<size_t>::max() ? 4194304 : s->dynamicCertMemCacheSize);
         }
 #endif
-#if USE_SSL_CRTD
-        Ssl::Helper::GetInstance();
-#endif //USE_SSL_CRTD
 
         // Fill out a Comm::Connection which IPC will open as a listener for us
         //  then pass back when active so we can start a TcpAcceptor subscription.
index 53d09a5bf50a7b52cdc62a15d3d8b756745dccd6..64531ce800f309bf6830a2fd068485dce01fdd60 100644 (file)
@@ -1042,6 +1042,10 @@ mainInitialize(void)
 
 #endif
 
+#if USE_SSL_CRTD
+    Ssl::Helper::GetInstance()->Init();
+#endif
+
     redirectInit();
 #if USE_AUTH
     authenticateInit(&Auth::TheConfig);
index 546ed3d32943bdfb4051503b551114b64b442e1d..974f62cadc35fcbd8a21a247763f69ba85c51fff 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include "config.h"
+#include "ProtoPort.h"
 #include "ssl/Config.h"
 #include "ssl/helper.h"
 #include "SquidTime.h"
@@ -16,7 +17,6 @@ Ssl::Helper * Ssl::Helper::GetInstance()
 
 Ssl::Helper::Helper()
 {
-    Init();
 }
 
 Ssl::Helper::~Helper()
@@ -26,8 +26,20 @@ Ssl::Helper::~Helper()
 
 void Ssl::Helper::Init()
 {
-    if (ssl_crtd == NULL)
-        ssl_crtd = new helper("ssl_crtd");
+    assert(ssl_crtd == NULL);
+
+    bool useSslBump = false;
+    for (http_port_list *s = ::Config.Sockaddr.http; s; s = s->next) {
+        if (s->sslBump) {
+            useSslBump = true;
+            break;
+        }
+    }
+
+    if (!useSslBump)
+        return;
+
+    ssl_crtd = new helper("ssl_crtd");
     ssl_crtd->childs = Ssl::TheConfig.ssl_crtdChildren;
     ssl_crtd->ipc_type = IPC_STREAM;
     // The crtd messages may contain the eol ('\n') character. We are
@@ -69,8 +81,6 @@ void Ssl::Helper::Shutdown()
         return;
     helperShutdown(ssl_crtd);
     wordlistDestroy(&ssl_crtd->cmdline);
-    if (!shutting_down)
-        return;
     delete ssl_crtd;
     ssl_crtd = NULL;
 }
@@ -78,6 +88,7 @@ void Ssl::Helper::Shutdown()
 void Ssl::Helper::sslSubmit(CrtdMessage const & message, HLPCB * callback, void * data)
 {
     static time_t first_warn = 0;
+    assert(ssl_crtd);
 
     if (ssl_crtd->stats.queue_size >= (int)(ssl_crtd->childs.n_running * 2)) {
         if (first_warn == 0)