From: Gunnar Beutner Date: Tue, 21 Nov 2017 12:20:55 +0000 (+0100) Subject: Use std::shared_ptr instead of boost::shared_ptr X-Git-Tag: v2.9.0~310^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d09efc90705d79da9ec0bc0738024089a81afe8;p=icinga2 Use std::shared_ptr instead of boost::shared_ptr --- diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp index 4bb98f5cd..6f8f0664c 100644 --- a/lib/base/tlsstream.cpp +++ b/lib/base/tlsstream.cpp @@ -38,7 +38,7 @@ bool I2_EXPORT TlsStream::m_SSLIndexInitialized = false; * @param role The role of the client. * @param sslContext The SSL context for the client. */ -TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const boost::shared_ptr& sslContext) +TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const std::shared_ptr& sslContext) : SocketEvents(socket, this), m_Eof(false), m_HandshakeOK(false), m_VerifyOK(true), m_ErrorCode(0), m_ErrorOccurred(false), m_Socket(socket), m_Role(role), m_SendQ(new FIFO()), m_RecvQ(new FIFO()), m_CurrentAction(TlsActionNone), m_Retry(false), m_Shutdown(false) @@ -46,7 +46,7 @@ TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, Connecti std::ostringstream msgbuf; char errbuf[120]; - m_SSL = boost::shared_ptr(SSL_new(sslContext.get()), SSL_free); + m_SSL = std::shared_ptr(SSL_new(sslContext.get()), SSL_free); if (!m_SSL) { msgbuf << "SSL_new() failed with code " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\""; @@ -119,10 +119,10 @@ String TlsStream::GetVerifyError(void) const * * @returns The X509 certificate. */ -boost::shared_ptr TlsStream::GetClientCertificate(void) const +std::shared_ptr TlsStream::GetClientCertificate(void) const { boost::mutex::scoped_lock lock(m_Mutex); - return boost::shared_ptr(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter); + return std::shared_ptr(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter); } /** @@ -130,10 +130,10 @@ boost::shared_ptr TlsStream::GetClientCertificate(void) const * * @returns The X509 certificate. */ -boost::shared_ptr TlsStream::GetPeerCertificate(void) const +std::shared_ptr TlsStream::GetPeerCertificate(void) const { boost::mutex::scoped_lock lock(m_Mutex); - return boost::shared_ptr(SSL_get_peer_certificate(m_SSL.get()), X509_free); + return std::shared_ptr(SSL_get_peer_certificate(m_SSL.get()), X509_free); } void TlsStream::OnEvent(int revents) diff --git a/lib/base/tlsstream.hpp b/lib/base/tlsstream.hpp index 6f7f71738..8a5f23f9a 100644 --- a/lib/base/tlsstream.hpp +++ b/lib/base/tlsstream.hpp @@ -48,13 +48,13 @@ class I2_BASE_API TlsStream : public Stream, private SocketEvents public: DECLARE_PTR_TYPEDEFS(TlsStream); - TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const boost::shared_ptr& sslContext = MakeSSLContext()); + TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const std::shared_ptr& sslContext = MakeSSLContext()); ~TlsStream(void); Socket::Ptr GetSocket(void) const; - boost::shared_ptr GetClientCertificate(void) const; - boost::shared_ptr GetPeerCertificate(void) const; + std::shared_ptr GetClientCertificate(void) const; + std::shared_ptr GetPeerCertificate(void) const; void Handshake(void); @@ -74,7 +74,7 @@ public: String GetVerifyError(void) const; private: - boost::shared_ptr m_SSL; + std::shared_ptr m_SSL; bool m_Eof; mutable boost::mutex m_Mutex; mutable boost::condition_variable m_CV; diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index d1c316e58..215dc7de3 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -81,13 +81,13 @@ void InitializeOpenSSL(void) * @param cakey CA certificate chain file. * @returns An SSL context. */ -boost::shared_ptr MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey) +std::shared_ptr MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey) { char errbuf[120]; InitializeOpenSSL(); - boost::shared_ptr sslContext = boost::shared_ptr(SSL_CTX_new(SSLv23_method()), SSL_CTX_free); + std::shared_ptr sslContext = std::shared_ptr(SSL_CTX_new(SSLv23_method()), SSL_CTX_free); EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_secp384r1); @@ -174,7 +174,7 @@ boost::shared_ptr MakeSSLContext(const String& pubkey, const String& pr * @param context The ssl context. * @param cipherList The ciper list. **/ -void SetCipherListToSSLContext(const boost::shared_ptr& context, const String& cipherList) +void SetCipherListToSSLContext(const std::shared_ptr& context, const String& cipherList) { char errbuf[256]; @@ -198,7 +198,7 @@ void SetCipherListToSSLContext(const boost::shared_ptr& context, const * @param context The ssl context. * @param tlsProtocolmin The minimum TLS protocol version. */ -void SetTlsProtocolminToSSLContext(const boost::shared_ptr& context, const String& tlsProtocolmin) +void SetTlsProtocolminToSSLContext(const std::shared_ptr& context, const String& tlsProtocolmin) { long flags = SSL_CTX_get_options(context.get()); @@ -226,7 +226,7 @@ void SetTlsProtocolminToSSLContext(const boost::shared_ptr& context, co * @param context The SSL context. * @param crlPath The path to the CRL file. */ -void AddCRLToSSLContext(const boost::shared_ptr& context, const String& crlPath) +void AddCRLToSSLContext(const std::shared_ptr& context, const String& crlPath) { char errbuf[120]; X509_STORE *x509_store = SSL_CTX_get_cert_store(context.get()); @@ -281,7 +281,7 @@ static String GetX509NameCN(X509_NAME *name) * @param certificate The X509 certificate. * @returns The common name. */ -String GetCertificateCN(const boost::shared_ptr& certificate) +String GetCertificateCN(const std::shared_ptr& certificate) { return GetX509NameCN(X509_get_subject_name(certificate.get())); } @@ -292,7 +292,7 @@ String GetCertificateCN(const boost::shared_ptr& certificate) * @param pemfile The filename. * @returns An X509 certificate. */ -boost::shared_ptr GetX509Certificate(const String& pemfile) +std::shared_ptr GetX509Certificate(const String& pemfile) { char errbuf[120]; X509 *cert; @@ -327,7 +327,7 @@ boost::shared_ptr GetX509Certificate(const String& pemfile) BIO_free(fpcert); - return boost::shared_ptr(cert, X509_free); + return std::shared_ptr(cert, X509_free); } int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile, const String& certfile, bool ca) @@ -402,7 +402,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile, X509_NAME *subject = X509_NAME_new(); X509_NAME_add_entry_by_txt(subject, "CN", MBSTRING_ASC, (unsigned char *)cn.CStr(), -1, -1, 0); - boost::shared_ptr cert = CreateCert(key, subject, subject, key, ca); + std::shared_ptr cert = CreateCert(key, subject, subject, key, ca); X509_NAME_free(subject); @@ -491,7 +491,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile, return 1; } -boost::shared_ptr CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca) +std::shared_ptr CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca) { X509 *cert = X509_new(); X509_set_version(cert, 2); @@ -568,7 +568,7 @@ boost::shared_ptr CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NA X509_sign(cert, cakey, EVP_sha256()); - return boost::shared_ptr(cert, X509_free); + return std::shared_ptr(cert, X509_free); } String GetIcingaCADir(void) @@ -576,7 +576,7 @@ String GetIcingaCADir(void) return Application::GetLocalStateDir() + "/lib/icinga2/ca"; } -boost::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) +std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) { char errbuf[120]; @@ -589,7 +589,7 @@ boost::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) if (!cakeybio) { Log(LogCritical, "SSL") << "Could not open CA key file '" << cakeyfile << "': " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\""; - return boost::shared_ptr(); + return std::shared_ptr(); } EVP_PKEY *privkey = PEM_read_bio_PrivateKey(cakeybio, NULL, NULL, NULL); @@ -597,25 +597,25 @@ boost::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) if (!privkey) { Log(LogCritical, "SSL") << "Could not read private key from CA key file '" << cakeyfile << "': " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\""; - return boost::shared_ptr(); + return std::shared_ptr(); } BIO_free(cakeybio); String cacertfile = cadir + "/ca.crt"; - boost::shared_ptr cacert = GetX509Certificate(cacertfile); + std::shared_ptr cacert = GetX509Certificate(cacertfile); return CreateCert(pubkey, subject, X509_get_subject_name(cacert.get()), privkey, false); } -boost::shared_ptr CreateCertIcingaCA(const boost::shared_ptr& cert) +std::shared_ptr CreateCertIcingaCA(const std::shared_ptr& cert) { - boost::shared_ptr pkey = boost::shared_ptr(X509_get_pubkey(cert.get()), EVP_PKEY_free); + std::shared_ptr pkey = std::shared_ptr(X509_get_pubkey(cert.get()), EVP_PKEY_free); return CreateCertIcingaCA(pkey.get(), X509_get_subject_name(cert.get())); } -String CertificateToString(const boost::shared_ptr& cert) +String CertificateToString(const std::shared_ptr& cert) { BIO *mem = BIO_new(BIO_s_mem()); PEM_write_bio_X509(mem, cert.get()); @@ -630,7 +630,7 @@ String CertificateToString(const boost::shared_ptr& cert) return result; } -boost::shared_ptr StringToCertificate(const String& cert) +std::shared_ptr StringToCertificate(const String& cert) { BIO *bio = BIO_new(BIO_s_mem()); BIO_write(bio, (const void *)cert.CStr(), cert.GetLength()); @@ -642,7 +642,7 @@ boost::shared_ptr StringToCertificate(const String& cert) if (!rawCert) BOOST_THROW_EXCEPTION(std::invalid_argument("The specified X509 certificate is invalid.")); - return boost::shared_ptr(rawCert, X509_free); + return std::shared_ptr(rawCert, X509_free); } String PBKDF2_SHA1(const String& password, const String& salt, int iterations) @@ -762,7 +762,7 @@ String RandomString(int length) return result; } -bool VerifyCertificate(const boost::shared_ptr& caCertificate, const boost::shared_ptr& certificate) +bool VerifyCertificate(const std::shared_ptr& caCertificate, const std::shared_ptr& certificate) { X509_STORE *store = X509_STORE_new(); diff --git a/lib/base/tlsutility.hpp b/lib/base/tlsutility.hpp index c2191cc51..161907104 100644 --- a/lib/base/tlsutility.hpp +++ b/lib/base/tlsutility.hpp @@ -31,31 +31,30 @@ #include #include #include -#include #include namespace icinga { void I2_BASE_API InitializeOpenSSL(void); -boost::shared_ptr I2_BASE_API MakeSSLContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String()); -void I2_BASE_API AddCRLToSSLContext(const boost::shared_ptr& context, const String& crlPath); -void I2_BASE_API SetCipherListToSSLContext(const boost::shared_ptr& context, const String& cipherList); -void I2_BASE_API SetTlsProtocolminToSSLContext(const boost::shared_ptr& context, const String& tlsProtocolmin); -String I2_BASE_API GetCertificateCN(const boost::shared_ptr& certificate); -boost::shared_ptr I2_BASE_API GetX509Certificate(const String& pemfile); +std::shared_ptr I2_BASE_API MakeSSLContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String()); +void I2_BASE_API AddCRLToSSLContext(const std::shared_ptr& context, const String& crlPath); +void I2_BASE_API SetCipherListToSSLContext(const std::shared_ptr& context, const String& cipherList); +void I2_BASE_API SetTlsProtocolminToSSLContext(const std::shared_ptr& context, const String& tlsProtocolmin); +String I2_BASE_API GetCertificateCN(const std::shared_ptr& certificate); +std::shared_ptr I2_BASE_API GetX509Certificate(const String& pemfile); int I2_BASE_API MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile = String(), const String& certfile = String(), bool ca = false); -boost::shared_ptr I2_BASE_API CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca); +std::shared_ptr I2_BASE_API CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca); String I2_BASE_API GetIcingaCADir(void); -String I2_BASE_API CertificateToString(const boost::shared_ptr& cert); -boost::shared_ptr I2_BASE_API StringToCertificate(const String& cert); -boost::shared_ptr I2_BASE_API CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject); -boost::shared_ptr I2_BASE_API CreateCertIcingaCA(const boost::shared_ptr& cert); +String I2_BASE_API CertificateToString(const std::shared_ptr& cert); +std::shared_ptr I2_BASE_API StringToCertificate(const String& cert); +std::shared_ptr I2_BASE_API CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject); +std::shared_ptr I2_BASE_API CreateCertIcingaCA(const std::shared_ptr& cert); String I2_BASE_API PBKDF2_SHA1(const String& password, const String& salt, int iterations); String I2_BASE_API SHA1(const String& s, bool binary = false); String I2_BASE_API SHA256(const String& s); String I2_BASE_API RandomString(int length); -bool I2_BASE_API VerifyCertificate(const boost::shared_ptr& caCertificate, const boost::shared_ptr& certificate); +bool I2_BASE_API VerifyCertificate(const std::shared_ptr& caCertificate, const std::shared_ptr& certificate); class I2_BASE_API openssl_error : virtual public std::exception, virtual public boost::exception { }; diff --git a/lib/cli/casigncommand.cpp b/lib/cli/casigncommand.cpp index e26061238..7b7e12792 100644 --- a/lib/cli/casigncommand.cpp +++ b/lib/cli/casigncommand.cpp @@ -69,14 +69,14 @@ int CASignCommand::Run(const boost::program_options::variables_map& vm, const st String certRequestText = request->Get("cert_request"); - boost::shared_ptr certRequest = StringToCertificate(certRequestText); + std::shared_ptr certRequest = StringToCertificate(certRequestText); if (!certRequest) { Log(LogCritical, "cli", "Certificate request is invalid. Could not parse X.509 certificate for the 'cert_request' attribute."); return 1; } - boost::shared_ptr certResponse = CreateCertIcingaCA(certRequest); + std::shared_ptr certResponse = CreateCertIcingaCA(certRequest); BIO *out = BIO_new(BIO_s_mem()); X509_NAME_print_ex(out, X509_get_subject_name(certRequest.get()), 0, XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB); diff --git a/lib/cli/nodesetupcommand.cpp b/lib/cli/nodesetupcommand.cpp index 4895898df..6d4617a97 100644 --- a/lib/cli/nodesetupcommand.cpp +++ b/lib/cli/nodesetupcommand.cpp @@ -291,7 +291,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm, return 1; } - boost::shared_ptr trustedcert = GetX509Certificate(vm["trustedcert"].as()); + std::shared_ptr trustedcert = GetX509Certificate(vm["trustedcert"].as()); Log(LogInformation, "cli") << "Verifying trusted certificate file '" << vm["trustedcert"].as() << "'."; diff --git a/lib/cli/nodewizardcommand.cpp b/lib/cli/nodewizardcommand.cpp index 5d7b630b7..7ab4c2d0b 100644 --- a/lib/cli/nodewizardcommand.cpp +++ b/lib/cli/nodewizardcommand.cpp @@ -303,7 +303,7 @@ wizard_endpoint_loop_start: << "' on file '" << nodeKey << "'. Verify it yourself!"; } - boost::shared_ptr trustedParentCert; + std::shared_ptr trustedParentCert; /* Check whether we should connect to the parent node and present its trusted certificate. */ if (connectToParent) { diff --git a/lib/cli/pkisavecertcommand.cpp b/lib/cli/pkisavecertcommand.cpp index a25e266d5..6c66e6adc 100644 --- a/lib/cli/pkisavecertcommand.cpp +++ b/lib/cli/pkisavecertcommand.cpp @@ -85,7 +85,7 @@ int PKISaveCertCommand::Run(const boost::program_options::variables_map& vm, con Log(LogInformation, "cli") << "Retrieving X.509 certificate for '" << host << ":" << port << "'."; - boost::shared_ptr cert = PkiUtility::FetchCert(host, port); + std::shared_ptr cert = PkiUtility::FetchCert(host, port); if (!cert) { Log(LogCritical, "cli", "Failed to fetch certificate from host."); diff --git a/lib/config/applyrule.cpp b/lib/config/applyrule.cpp index 3f4f76859..4a008848c 100644 --- a/lib/config/applyrule.cpp +++ b/lib/config/applyrule.cpp @@ -26,8 +26,8 @@ using namespace icinga; ApplyRule::RuleMap ApplyRule::m_Rules; ApplyRule::TypeMap ApplyRule::m_Types; -ApplyRule::ApplyRule(const String& targetType, const String& name, const boost::shared_ptr& expression, - const boost::shared_ptr& filter, const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr& fterm, +ApplyRule::ApplyRule(const String& targetType, const String& name, const std::shared_ptr& expression, + const std::shared_ptr& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope) : m_TargetType(targetType), m_Name(name), m_Expression(expression), m_Filter(filter), m_Package(package), m_FKVar(fkvar), m_FVVar(fvvar), m_FTerm(fterm), m_IgnoreOnError(ignoreOnError), m_DebugInfo(di), m_Scope(scope), m_HasMatches(false) @@ -43,12 +43,12 @@ String ApplyRule::GetName(void) const return m_Name; } -boost::shared_ptr ApplyRule::GetExpression(void) const +std::shared_ptr ApplyRule::GetExpression(void) const { return m_Expression; } -boost::shared_ptr ApplyRule::GetFilter(void) const +std::shared_ptr ApplyRule::GetFilter(void) const { return m_Filter; } @@ -68,7 +68,7 @@ String ApplyRule::GetFVVar(void) const return m_FVVar; } -boost::shared_ptr ApplyRule::GetFTerm(void) const +std::shared_ptr ApplyRule::GetFTerm(void) const { return m_FTerm; } @@ -89,8 +89,8 @@ Dictionary::Ptr ApplyRule::GetScope(void) const } void ApplyRule::AddRule(const String& sourceType, const String& targetType, const String& name, - const boost::shared_ptr& expression, const boost::shared_ptr& filter, const String& package, const String& fkvar, - const String& fvvar, const boost::shared_ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope) + const std::shared_ptr& expression, const std::shared_ptr& filter, const String& package, const String& fkvar, + const String& fvvar, const std::shared_ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope) { m_Rules[sourceType].push_back(ApplyRule(targetType, name, expression, filter, package, fkvar, fvvar, fterm, ignoreOnError, di, scope)); } diff --git a/lib/config/applyrule.hpp b/lib/config/applyrule.hpp index 631d1e54f..80f57ae13 100644 --- a/lib/config/applyrule.hpp +++ b/lib/config/applyrule.hpp @@ -38,12 +38,12 @@ public: String GetTargetType(void) const; String GetName(void) const; - boost::shared_ptr GetExpression(void) const; - boost::shared_ptr GetFilter(void) const; + std::shared_ptr GetExpression(void) const; + std::shared_ptr GetFilter(void) const; String GetPackage(void) const; String GetFKVar(void) const; String GetFVVar(void) const; - boost::shared_ptr GetFTerm(void) const; + std::shared_ptr GetFTerm(void) const; bool GetIgnoreOnError(void) const; DebugInfo GetDebugInfo(void) const; Dictionary::Ptr GetScope(void) const; @@ -52,8 +52,8 @@ public: bool EvaluateFilter(ScriptFrame& frame) const; - static void AddRule(const String& sourceType, const String& targetType, const String& name, const boost::shared_ptr& expression, - const boost::shared_ptr& filter, const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr& fterm, + static void AddRule(const String& sourceType, const String& targetType, const String& name, const std::shared_ptr& expression, + const std::shared_ptr& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope); static std::vector& GetRules(const String& type); @@ -67,12 +67,12 @@ public: private: String m_TargetType; String m_Name; - boost::shared_ptr m_Expression; - boost::shared_ptr m_Filter; + std::shared_ptr m_Expression; + std::shared_ptr m_Filter; String m_Package; String m_FKVar; String m_FVVar; - boost::shared_ptr m_FTerm; + std::shared_ptr m_FTerm; bool m_IgnoreOnError; DebugInfo m_DebugInfo; Dictionary::Ptr m_Scope; @@ -81,8 +81,8 @@ private: static TypeMap m_Types; static RuleMap m_Rules; - ApplyRule(const String& targetType, const String& name, const boost::shared_ptr& expression, - const boost::shared_ptr& filter, const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr& fterm, + ApplyRule(const String& targetType, const String& name, const std::shared_ptr& expression, + const std::shared_ptr& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope); }; diff --git a/lib/config/configcompiler.hpp b/lib/config/configcompiler.hpp index ac9f38a5d..08d362c52 100644 --- a/lib/config/configcompiler.hpp +++ b/lib/config/configcompiler.hpp @@ -128,7 +128,7 @@ public: static bool HasZoneConfigAuthority(const String& zoneName); private: - std::promise > m_Promise; + std::promise > m_Promise; String m_Path; std::istream *m_Input; diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index f2bd6df57..0ab2a0712 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -60,8 +60,8 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, run_with_activation_context, &ConfigItem::R * @param debuginfo Debug information. */ ConfigItem::ConfigItem(const Type::Ptr& type, const String& name, - bool abstract, const boost::shared_ptr& exprl, - const boost::shared_ptr& filter, bool defaultTmpl, bool ignoreOnError, + bool abstract, const std::shared_ptr& exprl, + const std::shared_ptr& filter, bool defaultTmpl, bool ignoreOnError, const DebugInfo& debuginfo, const Dictionary::Ptr& scope, const String& zone, const String& package) : m_Type(type), m_Name(name), m_Abstract(abstract), @@ -137,7 +137,7 @@ ConfigObject::Ptr ConfigItem::GetObject(void) const * * @returns The expression list. */ -boost::shared_ptr ConfigItem::GetExpression(void) const +std::shared_ptr ConfigItem::GetExpression(void) const { return m_Expression; } @@ -147,7 +147,7 @@ boost::shared_ptr ConfigItem::GetExpression(void) const * * @returns The filter expression. */ -boost::shared_ptr ConfigItem::GetFilter(void) const +std::shared_ptr ConfigItem::GetFilter(void) const { return m_Filter; } diff --git a/lib/config/configitem.hpp b/lib/config/configitem.hpp index df5c1cddd..e65b8ed32 100644 --- a/lib/config/configitem.hpp +++ b/lib/config/configitem.hpp @@ -41,8 +41,8 @@ public: DECLARE_PTR_TYPEDEFS(ConfigItem); ConfigItem(const Type::Ptr& type, const String& name, bool abstract, - const boost::shared_ptr& exprl, - const boost::shared_ptr& filter, + const std::shared_ptr& exprl, + const std::shared_ptr& filter, bool defaultTmpl, bool ignoreOnError, const DebugInfo& debuginfo, const Dictionary::Ptr& scope, const String& zone, const String& package); @@ -55,8 +55,8 @@ public: std::vector GetParents(void) const; - boost::shared_ptr GetExpression(void) const; - boost::shared_ptr GetFilter(void) const; + std::shared_ptr GetExpression(void) const; + std::shared_ptr GetFilter(void) const; void Register(void); void Unregister(void); @@ -84,8 +84,8 @@ private: String m_Name; /**< The name. */ bool m_Abstract; /**< Whether this is a template. */ - boost::shared_ptr m_Expression; - boost::shared_ptr m_Filter; + std::shared_ptr m_Expression; + std::shared_ptr m_Filter; bool m_DefaultTmpl; bool m_IgnoreOnError; DebugInfo m_DebugInfo; /**< Debug information. */ diff --git a/lib/config/configitembuilder.cpp b/lib/config/configitembuilder.cpp index 9e40c65b8..902d5187d 100644 --- a/lib/config/configitembuilder.cpp +++ b/lib/config/configitembuilder.cpp @@ -20,7 +20,6 @@ #include "config/configitembuilder.hpp" #include "base/configtype.hpp" #include -#include using namespace icinga; @@ -74,7 +73,7 @@ void ConfigItemBuilder::AddExpression(Expression *expr) m_Expressions.push_back(expr); } -void ConfigItemBuilder::SetFilter(const boost::shared_ptr& filter) +void ConfigItemBuilder::SetFilter(const std::shared_ptr& filter) { m_Filter = filter; } @@ -138,7 +137,7 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void) } #endif /* I2_DEBUG */ - boost::shared_ptr exprl = boost::make_shared(exprs, m_DebugInfo); + std::shared_ptr exprl = std::make_shared(exprs, m_DebugInfo); exprl->MakeInline(); return new ConfigItem(m_Type, m_Name, m_Abstract, exprl, m_Filter, diff --git a/lib/config/configitembuilder.hpp b/lib/config/configitembuilder.hpp index 6a406ac3e..c804ca377 100644 --- a/lib/config/configitembuilder.hpp +++ b/lib/config/configitembuilder.hpp @@ -52,7 +52,7 @@ public: void SetIgnoreOnError(bool ignoreOnError); void AddExpression(Expression *expr); - void SetFilter(const boost::shared_ptr& filter); + void SetFilter(const std::shared_ptr& filter); ConfigItem::Ptr Compile(void); @@ -61,7 +61,7 @@ private: String m_Name; /**< The name. */ bool m_Abstract; /**< Whether the item is abstract. */ std::vector m_Expressions; /**< Expressions for this item. */ - boost::shared_ptr m_Filter; /**< Filter expression. */ + std::shared_ptr m_Filter; /**< Filter expression. */ DebugInfo m_DebugInfo; /**< Debug information. */ Dictionary::Ptr m_Scope; /**< variable scope. */ String m_Zone; /**< The zone. */ diff --git a/lib/config/expression.hpp b/lib/config/expression.hpp index 59a16f6e1..dec6f1c75 100644 --- a/lib/config/expression.hpp +++ b/lib/config/expression.hpp @@ -216,7 +216,7 @@ I2_CONFIG_API Expression *MakeIndexer(ScopeSpecifier scopeSpec, const String& in class I2_CONFIG_API OwnedExpression : public Expression { public: - OwnedExpression(const boost::shared_ptr& expression) + OwnedExpression(const std::shared_ptr& expression) : m_Expression(expression) { } @@ -232,7 +232,7 @@ protected: } private: - boost::shared_ptr m_Expression; + std::shared_ptr m_Expression; }; class I2_CONFIG_API LiteralExpression : public Expression @@ -837,7 +837,7 @@ private: String m_Name; std::vector m_Args; std::map *m_ClosedVars; - boost::shared_ptr m_Expression; + std::shared_ptr m_Expression; }; class I2_CONFIG_API ApplyExpression : public DebuggableExpression @@ -874,14 +874,14 @@ private: String m_Type; String m_Target; Expression *m_Name; - boost::shared_ptr m_Filter; + std::shared_ptr m_Filter; String m_Package; String m_FKVar; String m_FVVar; - boost::shared_ptr m_FTerm; + std::shared_ptr m_FTerm; bool m_IgnoreOnError; std::map *m_ClosedVars; - boost::shared_ptr m_Expression; + std::shared_ptr m_Expression; }; class I2_CONFIG_API ObjectExpression : public DebuggableExpression @@ -916,13 +916,13 @@ private: bool m_Abstract; Expression *m_Type; Expression *m_Name; - boost::shared_ptr m_Filter; + std::shared_ptr m_Filter; String m_Zone; String m_Package; bool m_DefaultTmpl; bool m_IgnoreOnError; std::map *m_ClosedVars; - boost::shared_ptr m_Expression; + std::shared_ptr m_Expression; }; class I2_CONFIG_API ForExpression : public DebuggableExpression diff --git a/lib/config/vmops.hpp b/lib/config/vmops.hpp index 25999e60b..193a57ab5 100644 --- a/lib/config/vmops.hpp +++ b/lib/config/vmops.hpp @@ -33,7 +33,6 @@ #include "base/exception.hpp" #include "base/convert.hpp" #include "base/objectlock.hpp" -#include #include #include @@ -110,7 +109,7 @@ public: } static inline Value NewFunction(ScriptFrame& frame, const String& name, const std::vector& argNames, - std::map *closedVars, const boost::shared_ptr& expression) + std::map *closedVars, const std::shared_ptr& expression) { auto evaluatedClosedVars = EvaluateClosedVars(frame, closedVars); @@ -132,9 +131,9 @@ public: return new Function(name, wrapper, argNames); } - static inline Value NewApply(ScriptFrame& frame, const String& type, const String& target, const String& name, const boost::shared_ptr& filter, - const String& package, const String& fkvar, const String& fvvar, const boost::shared_ptr& fterm, std::map *closedVars, - bool ignoreOnError, const boost::shared_ptr& expression, const DebugInfo& debugInfo = DebugInfo()) + static inline Value NewApply(ScriptFrame& frame, const String& type, const String& target, const String& name, const std::shared_ptr& filter, + const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr& fterm, std::map *closedVars, + bool ignoreOnError, const std::shared_ptr& expression, const DebugInfo& debugInfo = DebugInfo()) { ApplyRule::AddRule(type, target, name, expression, filter, package, fkvar, fvvar, fterm, ignoreOnError, debugInfo, EvaluateClosedVars(frame, closedVars)); @@ -142,8 +141,8 @@ public: return Empty; } - static inline Value NewObject(ScriptFrame& frame, bool abstract, const Type::Ptr& type, const String& name, const boost::shared_ptr& filter, - const String& zone, const String& package, bool defaultTmpl, bool ignoreOnError, std::map *closedVars, const boost::shared_ptr& expression, const DebugInfo& debugInfo = DebugInfo()) + static inline Value NewObject(ScriptFrame& frame, bool abstract, const Type::Ptr& type, const String& name, const std::shared_ptr& filter, + const String& zone, const String& package, bool defaultTmpl, bool ignoreOnError, std::map *closedVars, const std::shared_ptr& expression, const DebugInfo& debugInfo = DebugInfo()) { ConfigItemBuilder::Ptr item = new ConfigItemBuilder(debugInfo); diff --git a/lib/db_ido_mysql/idomysqlconnection.hpp b/lib/db_ido_mysql/idomysqlconnection.hpp index 5c6156acf..140b11a70 100644 --- a/lib/db_ido_mysql/idomysqlconnection.hpp +++ b/lib/db_ido_mysql/idomysqlconnection.hpp @@ -29,7 +29,7 @@ namespace icinga { -typedef boost::shared_ptr IdoMysqlResult; +typedef std::shared_ptr IdoMysqlResult; typedef std::function IdoAsyncCallback; diff --git a/lib/db_ido_pgsql/idopgsqlconnection.hpp b/lib/db_ido_pgsql/idopgsqlconnection.hpp index 424b44280..56965d832 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.hpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.hpp @@ -29,7 +29,7 @@ namespace icinga { -typedef boost::shared_ptr IdoPgsqlResult; +typedef std::shared_ptr IdoPgsqlResult; /** * An IDO pgSQL database connection. diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index f1880269d..98c6c7357 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -528,7 +528,7 @@ Stream::Ptr ElasticsearchWriter::Connect(void) } if (GetEnableTls()) { - boost::shared_ptr sslContext; + std::shared_ptr sslContext; try { sslContext = MakeSSLContext(GetCertPath(), GetKeyPath(), GetCaPath()); diff --git a/lib/perfdata/influxdbwriter.cpp b/lib/perfdata/influxdbwriter.cpp index fa08a69f3..d40f88627 100644 --- a/lib/perfdata/influxdbwriter.cpp +++ b/lib/perfdata/influxdbwriter.cpp @@ -150,7 +150,7 @@ Stream::Ptr InfluxdbWriter::Connect() } if (GetSslEnable()) { - boost::shared_ptr sslContext; + std::shared_ptr sslContext; try { sslContext = MakeSSLContext(GetSslCert(), GetSslKey(), GetSslCaCert()); } catch (const std::exception& ex) { diff --git a/lib/remote/apiclient.cpp b/lib/remote/apiclient.cpp index 45cf06f6a..5ca690de8 100644 --- a/lib/remote/apiclient.cpp +++ b/lib/remote/apiclient.cpp @@ -46,7 +46,7 @@ void ApiClient::GetTypes(const TypesCompletionCallback& callback) const url->SetPath(path); try { - boost::shared_ptr req = m_Connection->NewRequest(); + std::shared_ptr req = m_Connection->NewRequest(); req->RequestMethod = "GET"; req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); @@ -136,7 +136,7 @@ void ApiClient::GetObjects(const String& pluralType, const ObjectsCompletionCall url->SetQuery(params); try { - boost::shared_ptr req = m_Connection->NewRequest(); + std::shared_ptr req = m_Connection->NewRequest(); req->RequestMethod = "GET"; req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); @@ -250,7 +250,7 @@ void ApiClient::ExecuteScript(const String& session, const String& command, bool url->SetQuery(params); try { - boost::shared_ptr req = m_Connection->NewRequest(); + std::shared_ptr req = m_Connection->NewRequest(); req->RequestMethod = "POST"; req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); @@ -334,7 +334,7 @@ void ApiClient::AutocompleteScript(const String& session, const String& command, url->SetQuery(params); try { - boost::shared_ptr req = m_Connection->NewRequest(); + std::shared_ptr req = m_Connection->NewRequest(); req->RequestMethod = "POST"; req->RequestUrl = url; req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index b64b3c3dd..fce03dfab 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -128,7 +128,7 @@ void ApiListener::OnConfigLoaded(void) } /* set up SSL context */ - boost::shared_ptr cert; + std::shared_ptr cert; try { cert = GetX509Certificate(defaultCertPath); } catch (const std::exception&) { @@ -151,7 +151,7 @@ void ApiListener::OnConfigLoaded(void) void ApiListener::UpdateSSLContext(void) { - boost::shared_ptr context; + std::shared_ptr context; try { context = MakeSSLContext(GetDefaultCertPath(), GetDefaultKeyPath(), GetDefaultCaPath()); @@ -312,7 +312,7 @@ bool ApiListener::AddListener(const String& node, const String& service) { ObjectLock olock(this); - boost::shared_ptr sslContext = m_SSLContext; + std::shared_ptr sslContext = m_SSLContext; if (!sslContext) { Log(LogCritical, "ApiListener", "SSL context is required for AddListener()"); @@ -367,7 +367,7 @@ void ApiListener::AddConnection(const Endpoint::Ptr& endpoint) { ObjectLock olock(this); - boost::shared_ptr sslContext = m_SSLContext; + std::shared_ptr sslContext = m_SSLContext; if (!sslContext) { Log(LogCritical, "ApiListener", "SSL context is required for AddConnection()"); @@ -455,7 +455,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri return; } - boost::shared_ptr cert = tlsStream->GetPeerCertificate(); + std::shared_ptr cert = tlsStream->GetPeerCertificate(); String identity; Endpoint::Ptr endpoint; bool verify_ok = false; diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index 1ce70316c..d258b6488 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -117,7 +117,7 @@ protected: virtual void ValidateTlsProtocolmin(const String& value, const ValidationUtils& utils) override; private: - boost::shared_ptr m_SSLContext; + std::shared_ptr m_SSLContext; std::set m_Servers; mutable boost::mutex m_AnonymousClientsLock; diff --git a/lib/remote/httpclientconnection.cpp b/lib/remote/httpclientconnection.cpp index 3caeb3057..e730ff2fa 100644 --- a/lib/remote/httpclientconnection.cpp +++ b/lib/remote/httpclientconnection.cpp @@ -28,7 +28,6 @@ #include "base/tcpsocket.hpp" #include "base/tlsstream.hpp" #include "base/networkstream.hpp" -#include using namespace icinga; @@ -104,14 +103,14 @@ bool HttpClientConnection::ProcessMessage(void) return false; } - const std::pair, HttpCompletionCallback>& currentRequest = *m_Requests.begin(); + const std::pair, HttpCompletionCallback>& currentRequest = *m_Requests.begin(); HttpRequest& request = *currentRequest.first.get(); const HttpCompletionCallback& callback = currentRequest.second; if (!m_CurrentResponse) - m_CurrentResponse = boost::make_shared(m_Stream, request); + m_CurrentResponse = std::make_shared(m_Stream, request); - boost::shared_ptr currentResponse = m_CurrentResponse; + std::shared_ptr currentResponse = m_CurrentResponse; HttpResponse& response = *currentResponse.get(); try { @@ -161,13 +160,13 @@ void HttpClientConnection::DataAvailableHandler(const Stream::Ptr& stream) m_Stream->Close(); } -boost::shared_ptr HttpClientConnection::NewRequest(void) +std::shared_ptr HttpClientConnection::NewRequest(void) { Reconnect(); - return boost::make_shared(m_Stream); + return std::make_shared(m_Stream); } -void HttpClientConnection::SubmitRequest(const boost::shared_ptr& request, +void HttpClientConnection::SubmitRequest(const std::shared_ptr& request, const HttpCompletionCallback& callback) { m_Requests.push_back(std::make_pair(request, callback)); diff --git a/lib/remote/httpclientconnection.hpp b/lib/remote/httpclientconnection.hpp index d8b820831..c7916bfa6 100644 --- a/lib/remote/httpclientconnection.hpp +++ b/lib/remote/httpclientconnection.hpp @@ -50,18 +50,18 @@ public: void Disconnect(void); - boost::shared_ptr NewRequest(void); + std::shared_ptr NewRequest(void); typedef std::function HttpCompletionCallback; - void SubmitRequest(const boost::shared_ptr& request, const HttpCompletionCallback& callback); + void SubmitRequest(const std::shared_ptr& request, const HttpCompletionCallback& callback); private: String m_Host; String m_Port; bool m_Tls; Stream::Ptr m_Stream; - std::deque, HttpCompletionCallback> > m_Requests; - boost::shared_ptr m_CurrentResponse; + std::deque, HttpCompletionCallback> > m_Requests; + std::shared_ptr m_CurrentResponse; boost::mutex m_DataHandlerMutex; StreamReadContext m_Context; diff --git a/lib/remote/httprequest.cpp b/lib/remote/httprequest.cpp index 43918c322..d5e2e6fc1 100644 --- a/lib/remote/httprequest.cpp +++ b/lib/remote/httprequest.cpp @@ -24,7 +24,6 @@ #include #include #include -#include using namespace icinga; @@ -101,7 +100,7 @@ bool HttpRequest::Parse(StreamReadContext& src, bool may_wait) } else if (m_State == HttpRequestBody) { if (Headers->Get("transfer-encoding") == "chunked") { if (!m_ChunkContext) - m_ChunkContext = boost::make_shared(boost::ref(src)); + m_ChunkContext = std::make_shared(boost::ref(src)); char *data; size_t size; diff --git a/lib/remote/httprequest.hpp b/lib/remote/httprequest.hpp index 5a98a2343..7ffce5351 100644 --- a/lib/remote/httprequest.hpp +++ b/lib/remote/httprequest.hpp @@ -71,7 +71,7 @@ public: private: Stream::Ptr m_Stream; - boost::shared_ptr m_ChunkContext; + std::shared_ptr m_ChunkContext; HttpRequestState m_State; FIFO::Ptr m_Body; diff --git a/lib/remote/httpresponse.cpp b/lib/remote/httpresponse.cpp index 7f77ed386..870e91e73 100644 --- a/lib/remote/httpresponse.cpp +++ b/lib/remote/httpresponse.cpp @@ -24,7 +24,6 @@ #include #include "base/application.hpp" #include "base/convert.hpp" -#include using namespace icinga; @@ -183,7 +182,7 @@ bool HttpResponse::Parse(StreamReadContext& src, bool may_wait) } else if (m_State == HttpResponseBody) { if (Headers->Get("transfer-encoding") == "chunked") { if (!m_ChunkContext) - m_ChunkContext = boost::make_shared(boost::ref(src)); + m_ChunkContext = std::make_shared(boost::ref(src)); char *data; size_t size; diff --git a/lib/remote/httpresponse.hpp b/lib/remote/httpresponse.hpp index da6afd66b..8e955fa1a 100644 --- a/lib/remote/httpresponse.hpp +++ b/lib/remote/httpresponse.hpp @@ -67,7 +67,7 @@ public: private: HttpResponseState m_State; - boost::shared_ptr m_ChunkContext; + std::shared_ptr m_ChunkContext; const HttpRequest& m_Request; Stream::Ptr m_Stream; FIFO::Ptr m_Body; diff --git a/lib/remote/jsonrpcconnection-pki.cpp b/lib/remote/jsonrpcconnection-pki.cpp index 048d6c1c1..6f5a5214d 100644 --- a/lib/remote/jsonrpcconnection-pki.cpp +++ b/lib/remote/jsonrpcconnection-pki.cpp @@ -45,7 +45,7 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona String certText = params->Get("cert_request"); - boost::shared_ptr cert; + std::shared_ptr cert; Dictionary::Ptr result = new Dictionary(); @@ -56,7 +56,7 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona cert = StringToCertificate(certText); ApiListener::Ptr listener = ApiListener::GetInstance(); - boost::shared_ptr cacert = GetX509Certificate(listener->GetDefaultCaPath()); + std::shared_ptr cacert = GetX509Certificate(listener->GetDefaultCaPath()); String cn = GetCertificateCN(cert); @@ -137,8 +137,8 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona } } - boost::shared_ptr newcert; - boost::shared_ptr pubkey; + std::shared_ptr newcert; + std::shared_ptr pubkey; X509_NAME *subject; Dictionary::Ptr message; String ticket; @@ -172,7 +172,7 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona } } - pubkey = boost::shared_ptr(X509_get_pubkey(cert.get()), EVP_PKEY_free); + pubkey = std::shared_ptr(X509_get_pubkey(cert.get()), EVP_PKEY_free); subject = X509_get_subject_name(cert.get()); newcert = CreateCertIcingaCA(pubkey.get(), subject); @@ -285,8 +285,8 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar if (!listener) return Empty; - boost::shared_ptr oldCert = GetX509Certificate(listener->GetDefaultCertPath()); - boost::shared_ptr newCert = StringToCertificate(cert); + std::shared_ptr oldCert = GetX509Certificate(listener->GetDefaultCertPath()); + std::shared_ptr newCert = StringToCertificate(cert); String cn = GetCertificateCN(newCert); @@ -294,8 +294,8 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar << "Received certificate update message for CN '" << cn << "'"; /* Check if this is a certificate update for a subordinate instance. */ - boost::shared_ptr oldKey = boost::shared_ptr(X509_get_pubkey(oldCert.get()), EVP_PKEY_free); - boost::shared_ptr newKey = boost::shared_ptr(X509_get_pubkey(newCert.get()), EVP_PKEY_free); + std::shared_ptr oldKey = std::shared_ptr(X509_get_pubkey(oldCert.get()), EVP_PKEY_free); + std::shared_ptr newKey = std::shared_ptr(X509_get_pubkey(newCert.get()), EVP_PKEY_free); if (X509_NAME_cmp(X509_get_subject_name(oldCert.get()), X509_get_subject_name(newCert.get())) != 0 || EVP_PKEY_cmp(oldKey.get(), newKey.get()) != 1) { diff --git a/lib/remote/pkiutility.cpp b/lib/remote/pkiutility.cpp index ab3685588..0457b6ed0 100644 --- a/lib/remote/pkiutility.cpp +++ b/lib/remote/pkiutility.cpp @@ -81,8 +81,8 @@ int PkiUtility::SignCsr(const String& csrfile, const String& certfile) BIO_free(csrbio); - boost::shared_ptr pubkey = boost::shared_ptr(X509_REQ_get_pubkey(req), EVP_PKEY_free); - boost::shared_ptr cert = CreateCertIcingaCA(pubkey.get(), X509_REQ_get_subject_name(req)); + std::shared_ptr pubkey = std::shared_ptr(X509_REQ_get_pubkey(req), EVP_PKEY_free); + std::shared_ptr cert = CreateCertIcingaCA(pubkey.get(), X509_REQ_get_subject_name(req)); X509_REQ_free(req); @@ -91,7 +91,7 @@ int PkiUtility::SignCsr(const String& csrfile, const String& certfile) return 0; } -boost::shared_ptr PkiUtility::FetchCert(const String& host, const String& port) +std::shared_ptr PkiUtility::FetchCert(const String& host, const String& port) { TcpSocket::Ptr client = new TcpSocket(); @@ -102,10 +102,10 @@ boost::shared_ptr PkiUtility::FetchCert(const String& host, const String& << "Cannot connect to host '" << host << "' on port '" << port << "'"; Log(LogDebug, "pki") << "Cannot connect to host '" << host << "' on port '" << port << "':\n" << DiagnosticInformation(ex); - return boost::shared_ptr(); + return std::shared_ptr(); } - boost::shared_ptr sslContext; + std::shared_ptr sslContext; try { sslContext = MakeSSLContext(); @@ -114,7 +114,7 @@ boost::shared_ptr PkiUtility::FetchCert(const String& host, const String& << "Cannot make SSL context."; Log(LogDebug, "pki") << "Cannot make SSL context:\n" << DiagnosticInformation(ex); - return boost::shared_ptr(); + return std::shared_ptr(); } TlsStream::Ptr stream = new TlsStream(client, host, RoleClient, sslContext); @@ -128,7 +128,7 @@ boost::shared_ptr PkiUtility::FetchCert(const String& host, const String& return stream->GetPeerCertificate(); } -int PkiUtility::WriteCert(const boost::shared_ptr& cert, const String& trustedfile) +int PkiUtility::WriteCert(const std::shared_ptr& cert, const String& trustedfile) { std::ofstream fpcert; fpcert.open(trustedfile.CStr()); @@ -155,7 +155,7 @@ int PkiUtility::GenTicket(const String& cn, const String& salt, std::ostream& ti } int PkiUtility::RequestCertificate(const String& host, const String& port, const String& keyfile, - const String& certfile, const String& cafile, const boost::shared_ptr& trustedCert, const String& ticket) + const String& certfile, const String& cafile, const std::shared_ptr& trustedCert, const String& ticket) { TcpSocket::Ptr client = new TcpSocket(); @@ -169,7 +169,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const return 1; } - boost::shared_ptr sslContext; + std::shared_ptr sslContext; try { sslContext = MakeSSLContext(certfile, keyfile); @@ -190,7 +190,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const return 1; } - boost::shared_ptr peerCert = stream->GetPeerCertificate(); + std::shared_ptr peerCert = stream->GetPeerCertificate(); if (X509_cmp(peerCert.get(), trustedCert.get())) { Log(LogCritical, "cli", "Peer certificate does not match trusted certificate."); @@ -326,7 +326,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const return 0; } -String PkiUtility::GetCertificateInformation(const boost::shared_ptr& cert) { +String PkiUtility::GetCertificateInformation(const std::shared_ptr& cert) { BIO *out = BIO_new(BIO_s_mem()); String pre; @@ -391,7 +391,7 @@ static void CollectRequestHandler(const Dictionary::Ptr& requests, const String& result->Set("cert_response", certResponseText); } - boost::shared_ptr certRequest = StringToCertificate(certRequestText); + std::shared_ptr certRequest = StringToCertificate(certRequestText); /* XXX (requires OpenSSL >= 1.0.0) time_t now; diff --git a/lib/remote/pkiutility.hpp b/lib/remote/pkiutility.hpp index 078722873..5cdb9165a 100644 --- a/lib/remote/pkiutility.hpp +++ b/lib/remote/pkiutility.hpp @@ -37,13 +37,13 @@ public: static int NewCa(void); static int NewCert(const String& cn, const String& keyfile, const String& csrfile, const String& certfile); static int SignCsr(const String& csrfile, const String& certfile); - static boost::shared_ptr FetchCert(const String& host, const String& port); - static int WriteCert(const boost::shared_ptr& cert, const String& trustedfile); + static std::shared_ptr FetchCert(const String& host, const String& port); + static int WriteCert(const std::shared_ptr& cert, const String& trustedfile); static int GenTicket(const String& cn, const String& salt, std::ostream& ticketfp); static int RequestCertificate(const String& host, const String& port, const String& keyfile, - const String& certfile, const String& cafile, const boost::shared_ptr& trustedcert, + const String& certfile, const String& cafile, const std::shared_ptr& trustedcert, const String& ticket = String()); - static String GetCertificateInformation(const boost::shared_ptr& certificate); + static String GetCertificateInformation(const std::shared_ptr& certificate); static Dictionary::Ptr GetCertificateRequests(void); private: diff --git a/plugins/check_nscp_api.cpp b/plugins/check_nscp_api.cpp index 71ae8623c..116120c6c 100644 --- a/plugins/check_nscp_api.cpp +++ b/plugins/check_nscp_api.cpp @@ -83,7 +83,7 @@ static Dictionary::Ptr QueryEndpoint(const String& host, const String& port, con boost::condition_variable cv; boost::mutex mtx; Dictionary::Ptr result; - boost::shared_ptr req = m_Connection->NewRequest(); + std::shared_ptr req = m_Connection->NewRequest(); req->RequestMethod = "GET"; // Url() will call Utillity::UnescapeString() which will thrown an exception if it finds a lonely %