]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1706] Made TLS context public
authorFrancis Dupont <fdupont@isc.org>
Tue, 20 Apr 2021 14:58:08 +0000 (16:58 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 20 Apr 2021 21:27:42 +0000 (23:27 +0200)
src/hooks/dhcp/high_availability/ha_config.cc
src/hooks/dhcp/high_availability/ha_config.h

index bc96e9faef91f0569525b6ccd53852cc9f722d36..eaf58f4b3efa4f6c3774992dd6157172b0a69994 100644 (file)
@@ -334,7 +334,7 @@ HAConfig::validate() {
                               << " is missing or empty: all or none of"
                               << " TLS parameters must be set");
                 }
-                TlsContext::configure(p->second->getTlsContextNonConst(),
+                TlsContext::configure(p->second->tls_context_,
                                       TlsRole::CLIENT,
                                       ca.get(),
                                       cert.get(),
index 9c5b225733b12612ecba47986da3dd7baa9b276c..a25ef5e9395174b7701e5a950d623aba4524a91e 100644 (file)
@@ -141,11 +141,6 @@ public:
             return (tls_context_);
         }
 
-        /// @brief Returns a non-const pointer to the server's TLS context.
-        asiolink::TlsContextPtr& getTlsContextNonConst() {
-            return (tls_context_);
-        }
-
         /// @brief Returns a string identifying a server used in logging.
         ///
         /// The label is constructed from server name and server URL.
@@ -212,6 +207,12 @@ public:
         /// when credentials are specified.
         void addBasicAuthHttpHeader(http::PostHttpRequestJsonPtr request) const;
 
+        /// @brief Server TLS context.
+        ///
+        /// @note: if you make it protected or private please make
+        /// @ref validate a friend so it may configure it.
+        asiolink::TlsContextPtr tls_context_;
+
     private:
 
         std::string name_;                          ///< Server name.
@@ -219,7 +220,6 @@ public:
         util::Optional<std::string> trust_anchor_;  ///< Server trust anchor.
         util::Optional<std::string> cert_file_;     ///< Server cert file.
         util::Optional<std::string> key_file_;      ///< Server key file.
-        asiolink::TlsContextPtr tls_context_;       ///< Server TLS context.
         Role role_;                                 ///< Server role.
         bool auto_failover_;                        ///< Auto failover state.
         http::BasicHttpAuthPtr basic_auth_;         ///< Basic HTTP authentication.