Mercurial > irccd
changeset 387:94b18a90e8f7
Misc: fix build without SSL
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 22 Dec 2016 11:17:44 +0100 |
parents | 6a6513d184c3 |
children | 7efbaf3800b9 |
files | irccdctl/main.cpp libcommon/CMakeLists.txt libirccd/irccd/config.cpp libirccd/irccd/transport.cpp libirccd/irccd/transport.hpp libirccdctl/irccd/client.cpp libirccdctl/irccd/client.hpp |
diffstat | 7 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/irccdctl/main.cpp Thu Dec 22 12:55:23 2016 +0100 +++ b/irccdctl/main.cpp Thu Dec 22 11:17:44 2016 +0100 @@ -145,7 +145,11 @@ address = net::resolveOne(host, port, domain, SOCK_STREAM); if ((it = sc.find("ssl")) != sc.end() && util::isBoolean(it->value())) +#if defined(WITH_SSL) client = std::make_unique<TlsClient>(); +#else + throw std::runtime_error("SSL disabled"); +#endif else client = std::make_unique<Client>(); }
--- a/libcommon/CMakeLists.txt Thu Dec 22 12:55:23 2016 +0100 +++ b/libcommon/CMakeLists.txt Thu Dec 22 11:17:44 2016 +0100 @@ -51,6 +51,8 @@ ${libcommon_SOURCE_DIR}/CMakeLists.txt ${HEADERS} ${SOURCES} + FLAGS + $<$<BOOL:NOT ${WITH_SSL}>:NET_NO_SSL> LIBRARIES extern-fmt extern-json
--- a/libirccd/irccd/config.cpp Thu Dec 22 12:55:23 2016 +0100 +++ b/libirccd/irccd/config.cpp Thu Dec 22 11:17:44 2016 +0100 @@ -193,7 +193,11 @@ if (pkey.empty()) return std::make_shared<TransportServerIp>(address, port, mode); +#if defined(WITH_SSL) return std::make_shared<TransportServerTls>(pkey, cert, address, port, mode); +#else + throw std::invalid_argument("transport: SSL disabled"); +#endif } std::shared_ptr<TransportServer> loadTransportUnix(const ini::Section &sc)
--- a/libirccd/irccd/transport.cpp Thu Dec 22 12:55:23 2016 +0100 +++ b/libirccd/irccd/transport.cpp Thu Dec 22 11:17:44 2016 +0100 @@ -270,6 +270,8 @@ * ------------------------------------------------------------------ */ +#if defined(WITH_SSL) + void TransportClientTls::handshake() { try { @@ -357,6 +359,8 @@ } } +#endif // !WITH_SSL + /* * TransportServerIp * ------------------------------------------------------------------ @@ -395,6 +399,8 @@ * ------------------------------------------------------------------ */ +#if defined(WITH_SSL) + TransportServerTls::TransportServerTls(const std::string &pkey, const std::string &cert, const std::string &address, @@ -411,6 +417,8 @@ return std::make_unique<TransportClientTls>(m_privatekey, m_cert, *this, m_socket.accept()); } +#endif // !WITH_SSL + /* * TransportServerLocal * ------------------------------------------------------------------
--- a/libirccd/irccd/transport.hpp Thu Dec 22 12:55:23 2016 +0100 +++ b/libirccd/irccd/transport.hpp Thu Dec 22 11:17:44 2016 +0100 @@ -182,6 +182,8 @@ * ------------------------------------------------------------------ */ +#if defined(WITH_SSL) + /** * \brief TLS version of transport client. */ @@ -235,6 +237,8 @@ IRCCD_EXPORT void sync(fd_set &in, fd_set &out) override; }; +#endif // !WITH_SSL + /* * TransportServer * ------------------------------------------------------------------ @@ -348,6 +352,8 @@ std::uint8_t mode = v4); }; +#if defined(WITH_SSL) + /** * \brief TLS over IP transport. */ @@ -378,6 +384,8 @@ IRCCD_EXPORT std::unique_ptr<TransportClient> accept() override; }; +#endif // !WITH_SSL + #if !defined(IRCCD_SYSTEM_WINDOWS) /**
--- a/libirccdctl/irccd/client.cpp Thu Dec 22 12:55:23 2016 +0100 +++ b/libirccdctl/irccd/client.cpp Thu Dec 22 11:17:44 2016 +0100 @@ -458,6 +458,8 @@ * ------------------------------------------------------------------ */ +#if defined(WITH_SSL) + void TlsClient::handshake() { try { @@ -548,4 +550,6 @@ Client::sync(in, out); } +#endif // !WITH_SSL + } // !irccd
--- a/libirccdctl/irccd/client.hpp Thu Dec 22 12:55:23 2016 +0100 +++ b/libirccdctl/irccd/client.hpp Thu Dec 22 11:17:44 2016 +0100 @@ -270,6 +270,8 @@ virtual void sync(fd_set &in, fd_set &out); }; +#if defined(WITH_SSL) + /** * \brief TLS over IP connection. */ @@ -315,6 +317,8 @@ void sync(fd_set &in, fd_set &out) override; }; +#endif // !WITH_SSL + } // !irccd #endif // !IRCCD_CLIENT_HPP