]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Rename PeerOptions::createContext to createClientContext
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 23 Mar 2015 10:20:17 +0000 (03:20 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 23 Mar 2015 10:20:17 +0000 (03:20 -0700)
Paves the way for PeerOptions to represent either server or client
options, and context state.

src/CachePeer.h
src/Makefile.am
src/SquidConfig.h
src/cache_cf.cc
src/security/PeerOptions.cc
src/security/PeerOptions.h
src/tests/stub_libsecurity.cc

index 4ede9f6cb50c55c90d9459962ef81b84e9434692..12861dfb8c44ece5327544257551928b88f896f3 100644 (file)
@@ -182,9 +182,8 @@ public:
 
     /// security settings for peer connection
     Security::PeerOptions secure;
-
+    Security::ContextPointer sslContext;
 #if USE_OPENSSL
-    SSL_CTX *sslContext;
     SSL_SESSION *sslSession;
 #endif
 
index b8d1ea2acb1c604a1a37523532e1aea13225c9eb..4f2ee10fd1dfdd45bd58366836f30081eb261b4d 100644 (file)
@@ -1172,6 +1172,7 @@ tests_testHttpReply_SOURCES=\
        tests/stub_libauth.cc \
        tests/stub_libcomm.cc \
        tests/stub_libmgr.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_libsslsquid.cc \
        StatCounters.h \
        StatCounters.cc \
@@ -1255,6 +1256,7 @@ tests_testACLMaxUserIP_SOURCES= \
        mem_node.cc \
        Packer.cc \
        Parsing.cc \
+       tests/stub_libsecurity.cc \
        SquidMath.cc \
        StatCounters.cc \
        StatCounters.h \
@@ -1683,6 +1685,7 @@ tests_testDiskIO_SOURCES = \
        RemovalPolicy.cc \
        RequestFlags.h \
        RequestFlags.cc \
+       tests/stub_libsecurity.cc \
        StatCounters.h \
        StatCounters.cc \
        StatHist.h \
@@ -2165,7 +2168,6 @@ tests_testEventLoop_SOURCES = \
        int.cc \
        internal.h \
        internal.cc \
-       tests/stub_libsecurity.cc \
        SquidList.h \
        SquidList.cc \
        MasterXaction.cc \
@@ -2247,6 +2249,7 @@ tests_testEventLoop_SOURCES = \
        tests/stub_libauth_acls.cc \
        tests/stub_libauth.cc \
        tests/stub_libeui.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_store_stats.cc \
        time.cc \
        tools.h \
@@ -2407,7 +2410,6 @@ tests_test_http_range_SOURCES = \
        internal.cc \
        $(IPC_SOURCE) \
        ipcache.cc \
-       tests/stub_libsecurity.cc \
        SquidList.h \
        SquidList.cc \
        MasterXaction.cc \
@@ -2487,6 +2489,7 @@ tests_test_http_range_SOURCES = \
        tests/stub_external_acl.cc \
        tests/stub_ipc_Forwarder.cc \
        tests/stub_libeui.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_main_cc.cc \
        tests/stub_MemStore.cc \
        tests/stub_store_stats.cc \
@@ -2575,6 +2578,7 @@ tests_testHttp1Parser_SOURCES = \
        tests/stub_debug.cc \
        tests/stub_event.cc \
        tests/stub_HelperChildConfig.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_stmem.cc \
        tests/stub_store.cc \
        tests/stub_store_stats.cc \
@@ -2944,6 +2948,7 @@ tests_testStore_SOURCES= \
        tests/stub_libauth.cc \
        tests/stub_libeui.cc \
        tests/stub_libformat.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_libsslsquid.cc \
        HttpBody.h \
        HttpBody.cc \
@@ -3093,6 +3098,7 @@ tests_testUfs_SOURCES = \
        internal.h \
        tests/stub_internal.cc \
        tests/stub_libformat.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_stat.cc \
        store_rebuild.h \
        tests/stub_store_rebuild.cc \
@@ -3371,6 +3377,7 @@ tests_testRock_SOURCES = \
        tests/stub_libformat.cc \
        tests/stub_libicmp.cc \
        tests/stub_libmgr.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_MemStore.cc \
        mime.h \
        tests/stub_mime.cc \
@@ -3524,7 +3531,6 @@ tests_testURL_SOURCES = \
        int.cc \
        internal.h \
        internal.cc \
-       tests/stub_libsecurity.cc \
        SquidList.h \
        SquidList.cc \
        MasterXaction.cc \
@@ -3605,6 +3611,7 @@ tests_testURL_SOURCES = \
        tests/stub_DiskIOModule.cc \
        tests/stub_libauth_acls.cc \
        tests/stub_libauth.cc \
+       tests/stub_libsecurity.cc \
        tests/stub_main_cc.cc \
        tests/stub_ipc_Forwarder.cc \
        tests/stub_store_stats.cc \
index 30cffc1eb78de74c23abc4ff349e120be78b8030..340223396122d7eb28f010808ddfdab34751b6d5 100644 (file)
 #include "icmp/IcmpConfig.h"
 #include "ip/Address.h"
 #include "Notes.h"
+#include "security/forward.h"
 #include "YesNoNone.h"
 
 #if USE_OPENSSL
-#if HAVE_OPENSSL_SSL_H
-#include <openssl/ssl.h>
-#endif
-
 class sslproxy_cert_sign;
 class sslproxy_cert_adapt;
 #endif
@@ -497,14 +494,14 @@ public:
     time_t minimum_expiry_time; /* seconds */
     external_acl *externalAclHelperList;
 
-#if USE_OPENSSL
     struct {
+        Security::ContextPointer sslContext;
+#if USE_OPENSSL
         acl_access *cert_error;
-        SSL_CTX *sslContext;
         sslproxy_cert_sign *cert_sign;
         sslproxy_cert_adapt *cert_adapt;
-    } ssl_client;
 #endif
+    } ssl_client;
 
     char *accept_filter;
     int umask;
index b66c4ba457268ebf8157a9317a555a2b067e30c8..f2e7ccbd3e000dfc7931e29689a60b1b11f46a42 100644 (file)
@@ -871,11 +871,10 @@ configDoConfigure(void)
         Config2.effectiveGroupID = grp->gr_gid;
     }
 
-#if USE_OPENSSL
-
-    debugs(3, DBG_IMPORTANT, "Initializing https proxy context");
-
-    Config.ssl_client.sslContext = Security::ProxyOutgoingConfig.createContext(false);
+    if (Security::ProxyOutgoingConfig.encryptTransport) {
+        debugs(3, DBG_IMPORTANT, "Initializing https:// proxy context");
+        Config.ssl_client.sslContext = Security::ProxyOutgoingConfig.createClientContext(false);
+    }
 
     for (CachePeer *p = Config.peers; p != NULL; p = p->next) {
 
@@ -885,10 +884,11 @@ configDoConfigure(void)
 
         if (p->secure.encryptTransport) {
             debugs(3, DBG_IMPORTANT, "Initializing cache_peer " << p->name << " SSL context");
-            p->sslContext = p->secure.createContext(true);
+            p->sslContext = p->secure.createClientContext(true);
         }
     }
 
+#if USE_OPENSSL
     for (AnyP::PortCfgPointer s = HttpPortList; s != NULL; s = s->next) {
         if (!s->flags.tunnelSslBumping)
             continue;
index 6f276713fdcf7929169ec7325fa5c5183d9a9348..e537c7a2d79a38144df3996c70838f39cd1e50b4 100644 (file)
@@ -59,7 +59,7 @@ Security::PeerOptions::parse(const char *token)
 
 // XXX: make a GnuTLS variant
 Security::ContextPointer
-Security::PeerOptions::createContext(bool setOptions)
+Security::PeerOptions::createClientContext(bool setOptions)
 {
     Security::ContextPointer t = NULL;
 
index 08ac9b706dee442fd3552fe34ac956c9cc3877af..678e6073cf9d8df4ce5bab765f0ddc6c6bd9d2d7 100644 (file)
@@ -28,8 +28,8 @@ public:
     /// reset the configuration details to default
     void clear() {*this = PeerOptions();}
 
-    /// generate a security context from these configured options
-    Security::ContextPointer createContext(bool setOptions);
+    /// generate a security client-context from these configured options
+    Security::ContextPointer createClientContext(bool setOptions);
 
     SBuf certFile;       ///< path of file containing PEM format X509 certificate
     SBuf privateKeyFile; ///< path of file containing private key in PEM format
index 041bfbabe817b6a07909590fbd5eb80df4c08b6b..c581c1dce5f513d2b7817f57089d93bbbdb76af8 100644 (file)
@@ -19,7 +19,7 @@ std::ostream &Security::operator <<(std::ostream &os, const Security::EncryptorA
 #include "security/PeerOptions.h"
 Security::PeerOptions Security::ProxyOutgoingConfig;
 void Security::PeerOptions::parse(char const*) STUB
-Security::ContextPointer Security::PeerOptions::createContext(bool) STUB_RETVAL(NULL)
+Security::ContextPointer Security::PeerOptions::createClientContext(bool) STUB_RETVAL(NULL)
 void parse_securePeerOptions(Security::PeerOptions *) STUB
 long Security::ParseOptions(const char *) STUB_RETVAL(0)