Commit 3932c08d authored by Stepan Salenikovich's avatar Stepan Salenikovich

configure: remove --with-tls and --disable-dht

Ring no longer builds without GnuTLS and/or without openDHT, nor
are we planning to support building Ring without them, so these
should not exist as configuration options.

The related preprocessor conditionals have also been removed.

Change-Id: I8416ecc48f13a3fb77d9eb7d349b81f226e863f1
Tuleap: #739
parent 3ec6d745
......@@ -413,19 +413,8 @@ AS_IF([test "x$enable_video" != "xno"],
AM_CONDITIONAL(RING_VIDEO, false)
]);
dnl TLS support is enabled if it's installed and up to date
AC_ARG_WITH([tls],
[AS_HELP_STRING([--with-tls],
[support tls @<:@default=check@:>@])],
[],
[with_tls=check])
AS_CASE(["$with_tls"],
[yes], [PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3], [HAVE_GNUTLS=1])],
[no], [HAVE_GNUTLS=0],
[PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3], [HAVE_GNUTLS=1], [HAVE_GNUTLS=0])])
AC_DEFINE_UNQUOTED([HAVE_TLS], `if test $HAVE_GNUTLS -eq 1; then echo 1; else echo 0; fi`, [Define if you have tls support])
AM_CONDITIONAL(BUILD_TLS, test "$HAVE_GNUTLS" -eq 1)
dnl check for GnuTLS
PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.4.14], [HAVE_GNUTLS=1], [HAVE_GNUTLS=0])
# PTHREAD
......@@ -521,20 +510,8 @@ AS_CASE(["$with_opus"],
[PKG_CHECK_MODULES([opus], [opus], [HAVE_OPUS=1], [HAVE_OPUS=0])])
AM_CONDITIONAL([BUILD_OPUS], [test "$HAVE_OPUS" -eq 1])
# dht is default-enabled, but requires gnutls
AC_ARG_ENABLE([dht],
AS_HELP_STRING([--disable-dht], [disable support for dht]))
AS_IF([test "x$enable_dht" != "xno" -a "$HAVE_GNUTLS" -eq 1],
[AC_DEFINE([HAVE_DHT], 1, [Define to enable dht])
PKG_CHECK_MODULES([OPENDHT], opendht,
AC_DEFINE([HAVE_DHT], 1, [Define to enable dht])
AM_CONDITIONAL(USE_DHT, true),
AC_DEFINE([HAVE_DHT], 0, [Define to enable dht])
AM_CONDITIONAL(USE_DHT, false)
AC_MSG_WARN([Missing OpenDHT]))],
[AC_DEFINE([HAVE_DHT], 0, [Define to enable dht])
AM_CONDITIONAL(USE_DHT, false)])
dnl check for openDHT
PKG_CHECK_MODULES([OPENDHT], [opendht >= 0.6.1],, AC_MSG_WARN([Missing OpenDHT]))
dnl IPv6 mode is default-disabled
AC_ARG_ENABLE([ipv6], AS_HELP_STRING([--enable-ipv6], [Enable IPv6 support]))
......
......@@ -52,14 +52,10 @@ libring_la_LDFLAGS = \
@SPEEXDSP_LIBS@ \
@LIBUPNP_LIBS@ \
@PORTAUDIO_LIBS@ \
$(TLS_LIB) \
$(IM_LIB) \
@GNUTLS_LIBS@ \
@OPENDHT_LIBS@ \
$(PCRE_LIBS)
if USE_DHT
libring_la_LDFLAGS += $(OPENDHT_LIBS)
endif
if HAVE_OSX
#FIXME necessary for -lintl
libring_la_LDFLAGS += -L/usr/local/opt/gettext/lib
......@@ -73,14 +69,11 @@ libring_la_CFLAGS = \
@LIBUPNP_CFLAGS@ \
@SPEEXDSP_CFLAGS@ \
@PORTAUDIO_CFLAGS@ \
$(TLS_CFLAGS)
@GNUTLS_CFLAGS@ \
@OPENDHT_CFLAGS@
libring_la_CXXFLAGS = @JSONCPP_CFLAGS@
if USE_DHT
libring_la_CFLAGS += $(OPENDHT_CFLAGS)
endif
libring_la_SOURCES = \
buildinfo.cpp \
conference.cpp \
......
......@@ -36,12 +36,8 @@
#include "logger.h"
#include "manager.h"
#if HAVE_DHT
#include <opendht/rng.h>
using random_device = dht::crypto::random_device;
#else
using random_device = std::random_device;
#endif
#include "client/ring_signal.h"
#include "account_schema.h"
......
......@@ -25,9 +25,7 @@
#include "account_factory.h"
#include "sip/sipaccount.h"
#if HAVE_DHT
#include "ringdht/ringaccount.h"
#endif
#include <stdexcept>
......@@ -40,11 +38,9 @@ AccountFactory::AccountFactory()
auto sipfunc = [](const std::string& id){ return std::make_shared<SIPAccount>(id, true); };
generators_.insert(std::make_pair(SIPAccount::ACCOUNT_TYPE, sipfunc));
RING_DBG("registered %s account", SIPAccount::ACCOUNT_TYPE);
#if HAVE_DHT
auto dhtfunc = [](const std::string& id){ return std::make_shared<RingAccount>(id, false); };
generators_.insert(std::make_pair(RingAccount::ACCOUNT_TYPE, dhtfunc));
RING_DBG("registered %s account", RingAccount::ACCOUNT_TYPE);
#endif
}
std::shared_ptr<Account>
......
......@@ -28,10 +28,8 @@
#include "configurationmanager_interface.h"
#include "account_schema.h"
#include "manager.h"
#if HAVE_TLS && HAVE_DHT
#include "security/tlsvalidator.h"
#include "security/certstore.h"
#endif
#include "logger.h"
#include "fileutils.h"
#include "archiver.h"
......@@ -119,17 +117,12 @@ std::map<std::string, std::string>
validateCertificate(const std::string&,
const std::string& certificate)
{
#if HAVE_TLS && HAVE_DHT
try {
return TlsValidator{CertificateStore::instance().getCertificate(certificate)}.getSerializedChecks();
} catch(const std::runtime_error& e) {
RING_WARN("Certificate loading failed: %s", e.what());
return {{Certificate::ChecksNames::EXIST, Certificate::CheckValuesNames::FAILED}};
}
#else
RING_WARN("TLS not supported");
return {};
#endif
}
std::map<std::string, std::string>
......@@ -139,38 +132,28 @@ validateCertificatePath(const std::string&,
const std::string& privateKeyPass,
const std::string& caList)
{
#if HAVE_TLS && HAVE_DHT
try {
return TlsValidator{certificate, privateKey, privateKeyPass, caList}.getSerializedChecks();
} catch(const std::runtime_error& e) {
RING_WARN("Certificate loading failed: %s", e.what());
return {{Certificate::ChecksNames::EXIST, Certificate::CheckValuesNames::FAILED}};
}
#else
RING_WARN("TLS not supported");
return {};
#endif
}
std::map<std::string, std::string>
getCertificateDetails(const std::string& certificate)
{
#if HAVE_TLS && HAVE_DHT
try {
return TlsValidator{CertificateStore::instance().getCertificate(certificate)}.getSerializedDetails();
} catch(const std::runtime_error& e) {
RING_WARN("Certificate loading failed: %s", e.what());
}
#else
RING_WARN("TLS not supported");
#endif
return {};
}
std::map<std::string, std::string>
getCertificateDetailsPath(const std::string& certificate, const std::string& privateKey, const std::string& privateKeyPassword)
{
#if HAVE_TLS && HAVE_DHT
try {
auto crt = std::make_shared<dht::crypto::Certificate>(ring::fileutils::loadFile(certificate));
TlsValidator validator {certificate, privateKey, privateKeyPassword};
......@@ -179,20 +162,13 @@ getCertificateDetailsPath(const std::string& certificate, const std::string& pri
} catch(const std::runtime_error& e) {
RING_WARN("Certificate loading failed: %s", e.what());
}
#else
RING_WARN("TLS not supported");
#endif
return {};
}
std::vector<std::string>
getPinnedCertificates()
{
#if HAVE_TLS && HAVE_DHT
return ring::tls::CertificateStore::instance().getPinnedCertificates();
#else
RING_WARN("TLS not supported");
#endif
return {};
}
......@@ -390,11 +366,9 @@ getSupportedTlsMethod()
std::vector<std::string>
getSupportedCiphers(const std::string& accountID)
{
#if HAVE_TLS
if (auto sipaccount = ring::Manager::instance().getAccount<SIPAccount>(accountID))
return SIPAccount::getSupportedTlsCiphers();
RING_ERR("SIP account %s doesn't exist", accountID.c_str());
#endif
return {};
}
......
......@@ -39,13 +39,9 @@
#include "map_utils.h"
#include "account.h"
#include "string_utils.h"
#if HAVE_DHT
#include "ringdht/ringaccount.h"
#include <opendht/rng.h>
using random_device = dht::crypto::random_device;
#else
using random_device = std::random_device;
#endif
#include "call_factory.h"
......@@ -149,7 +145,6 @@ setSipLogLevel()
pj_log_set_level(level);
}
#if HAVE_TLS
/**
* Set gnutls's log level based on the RING_TLS_LOGLEVEL environment variable.
* RING_TLS_LOGLEVEL = 0 minimum logging (default)
......@@ -182,7 +177,6 @@ setGnuTlsLogLevel()
gnutls_global_set_log_level(level);
gnutls_global_set_log_function(tls_print_logs);
}
#endif // HAVE_TLS
Manager&
Manager::instance()
......@@ -276,10 +270,8 @@ Manager::init(const std::string &config_file)
RING_DBG("pjsip version %s for %s initialized",
pj_get_version(), PJ_OS_NAME);
#if HAVE_TLS
setGnuTlsLogLevel();
RING_DBG("GNU TLS version %s initialized", gnutls_check_version(nullptr));
#endif
ice_tf_.reset(new IceTransportFactory());
......@@ -2823,7 +2815,6 @@ Manager::newOutgoingCall(const std::string& toUrl,
{
auto preferred = getAccount(preferredAccountId);
#if HAVE_DHT
if (toUrl.find("ring:") != std::string::npos) {
if (preferred && preferred->getAccountType() == RingAccount::ACCOUNT_TYPE)
return preferred->newOutgoingCall(toUrl);
......@@ -2832,7 +2823,6 @@ Manager::newOutgoingCall(const std::string& toUrl,
if (acc->isEnabled())
return acc->newOutgoingCall(toUrl);
}
#endif
// If peer url is an IP, and the preferred account is not an "IP2IP like",
// we try to find a suitable one in all SIPAccount's.
auto strippedToUrl = toUrl;
......
include $(top_srcdir)/globals.mak
if USE_DHT
noinst_LTLIBRARIES = libringacc.la
libringacc_la_CXXFLAGS = @CXXFLAGS@
......@@ -14,5 +12,3 @@ libringacc_la_SOURCES = \
sip_transport_ice.h \
sips_transport_ice.cpp \
sips_transport_ice.h
endif
......@@ -41,12 +41,8 @@
#include "system_codec_container.h"
#include "intrin.h" // for UNUSED
#if HAVE_DHT
#include <opendht/rng.h>
using random_device = dht::crypto::random_device;
#else
using random_device = std::random_device;
#endif
#include <algorithm>
#include <cassert>
......
......@@ -185,10 +185,8 @@ SIPAccount::newOutgoingCall(const std::string& toUrl)
family = ipv6 ? pj_AF_INET6() : pj_AF_INET();
// TODO: resolve remote host using SIPVoIPLink::resolveSrvName
std::shared_ptr<SipTransport> t =
#if HAVE_TLS
isTlsEnabled() ? link_->sipTransportBroker->getTlsTransport(tlsListener_, IpAddr(sip_utils::getHostFromUri(to))) :
#endif
std::shared_ptr<SipTransport> t = isTlsEnabled() ?
link_->sipTransportBroker->getTlsTransport(tlsListener_, IpAddr(sip_utils::getHostFromUri(to))) :
transport_;
setTransport(t);
call->setTransport(t);
......@@ -655,7 +653,6 @@ SIPAccount::getVolatileAccountDetails() const
a.emplace(Conf::CONFIG_PRESENCE_NOTE, presence_->getNote());
}
#if HAVE_TLS
if (transport_ and transport_->isSecure() and transport_->isConnected()) {
const auto& tlsInfos = transport_->getTlsInfos();
auto cipher = pj_ssl_cipher_name(tlsInfos.cipher);
......@@ -673,7 +670,6 @@ SIPAccount::getVolatileAccountDetails() const
}
a.emplace(DRing::TlsTransport::TLS_PEER_CA_NUM, ring::to_string(n));
}
#endif
return a;
}
......@@ -788,7 +784,6 @@ void SIPAccount::doRegister2_()
ipv6 = hostIp_.isIpv6();
#endif
#if HAVE_TLS
// Init TLS settings if the user wants to use TLS
if (tlsEnable_) {
RING_DBG("TLS is enabled for account %s", accountID_.c_str());
......@@ -810,9 +805,7 @@ void SIPAccount::doRegister2_()
return;
}
}
} else
#endif
{
} else {
tlsListener_.reset();
transportType_ = ipv6 ? PJSIP_TRANSPORT_UDP6 : PJSIP_TRANSPORT_UDP;
}
......@@ -837,12 +830,9 @@ void SIPAccount::doRegister2_()
try {
RING_WARN("Creating transport");
transport_.reset();
#if HAVE_TLS
if (isTlsEnabled()) {
setTransport(link_->sipTransportBroker->getTlsTransport(tlsListener_, hostIp_, tlsServerName_.empty() ? hostname_ : tlsServerName_));
} else
#endif
{
} else {
setTransport(link_->sipTransportBroker->getUdpTransport(
SipTransportDescr { getTransportType(), getLocalPort(), getLocalInterface() }
));
......@@ -1143,7 +1133,6 @@ SIPAccount::sendUnregister()
}
}
#if HAVE_TLS
pj_uint32_t
SIPAccount::tlsProtocolFromString(const std::string& method)
{
......@@ -1231,8 +1220,6 @@ void SIPAccount::initTlsConfiguration()
tlsSetting_.qos_ignore_error = PJ_TRUE;
}
#endif
void SIPAccount::initStunConfiguration()
{
size_t pos;
......@@ -1260,13 +1247,10 @@ void SIPAccount::loadConfig()
if (registrationExpire_ == 0)
registrationExpire_ = DEFAULT_REGISTRATION_TIME; /** Default expire value for registration */
#if HAVE_TLS
if (tlsEnable_) {
initTlsConfiguration();
transportType_ = PJSIP_TRANSPORT_TLS;
} else
#endif
transportType_ = PJSIP_TRANSPORT_UDP;
}
......
......@@ -571,8 +571,6 @@ class SIPAccount : public SIPAccountBase {
*/
pjsip_transport_type_e transportType_ {PJSIP_TRANSPORT_UNSPECIFIED};
#if HAVE_TLS
/**
* Maps a string description of the SSL method
* to the corresponding enum value in pjsip_ssl_method.
......@@ -592,8 +590,6 @@ class SIPAccount : public SIPAccountBase {
*/
void trimCiphers();
#endif
/**
* Initializes STUN config from the config file
*/
......
......@@ -32,10 +32,8 @@
#include <pjsip.h>
#include <pjsip/sip_types.h>
#if HAVE_TLS
#include <pjsip/sip_transport_tls.h>
#include <pj/ssl_sock.h>
#endif
#include <pjnath.h>
#include <pjnath/stun_config.h>
#include <pjlib.h>
......@@ -123,7 +121,6 @@ SipTransport::stateCallback(pjsip_transport_state state,
{
connected_ = state == PJSIP_TP_STATE_CONNECTED;
#if HAVE_TLS
auto extInfo = static_cast<const pjsip_tls_state_info*>(info->ext_info);
if (isSecure() && extInfo && extInfo->ssl_sock_info && extInfo->ssl_sock_info->established) {
auto tlsInfo = extInfo->ssl_sock_info;
......@@ -142,7 +139,6 @@ SipTransport::stateCallback(pjsip_transport_state state,
} else {
tlsInfos_ = {};
}
#endif
std::vector<SipTransportStateCallback> cbs;
{
......@@ -180,11 +176,11 @@ SipTransportBroker::SipTransportBroker(pjsip_endpoint *endpt,
pj_caching_pool& cp, pj_pool_t& pool) :
cp_(cp), pool_(pool), endpt_(endpt)
{
/*#if HAVE_DHT
/*
pjsip_transport_register_type(PJSIP_TRANSPORT_DATAGRAM, "ICE",
pjsip_transport_get_default_port_for_type(PJSIP_TRANSPORT_UDP),
&ice_pj_transport_type_);
#endif*/
*/
RING_DBG("SipTransportBroker@%p", this);
}
......@@ -353,7 +349,6 @@ SipTransportBroker::createUdpTransport(const SipTransportDescr& d)
return ret;
}
#if HAVE_TLS
std::shared_ptr<TlsListener>
SipTransportBroker::getTlsListener(const SipTransportDescr& d, const pjsip_tls_setting* settings)
{
......@@ -423,9 +418,7 @@ SipTransportBroker::getTlsTransport(const std::shared_ptr<TlsListener>& l, const
}
return ret;
}
#endif
#if HAVE_DHT
std::shared_ptr<SipTransport>
SipTransportBroker::getIceTransport(const std::shared_ptr<IceTransport> ice,
unsigned comp_id)
......@@ -464,6 +457,5 @@ SipTransportBroker::getTlsIceTransport(const std::shared_ptr<ring::IceTransport>
}
return sip_tr;
}
#endif
} // namespace ring
......@@ -169,22 +169,18 @@ public:
std::shared_ptr<SipTransport> getUdpTransport(const SipTransportDescr&);
#if HAVE_TLS
std::shared_ptr<TlsListener>
getTlsListener(const SipTransportDescr&, const pjsip_tls_setting*);
std::shared_ptr<SipTransport>
getTlsTransport(const std::shared_ptr<TlsListener>&, const IpAddr& remote, const std::string& remote_name = {});
#endif
#if HAVE_DHT
std::shared_ptr<SipTransport>
getIceTransport(const std::shared_ptr<IceTransport>, unsigned comp_id);
std::shared_ptr<SipTransport>
getTlsIceTransport(const std::shared_ptr<IceTransport>, unsigned comp_id,
const tls::TlsParams&);
#endif
std::shared_ptr<SipTransport> addTransport(pjsip_transport*);
......@@ -221,9 +217,7 @@ private:
/**
* Storage for SIP/ICE transport instances.
*/
#if HAVE_DHT
int ice_pj_transport_type_ {PJSIP_TRANSPORT_START_OTHER};
#endif
pj_caching_pool& cp_;
pj_pool_t& pool_;
......
......@@ -32,9 +32,7 @@
#include "sipcall.h"
#include "sipaccount.h"
#if HAVE_DHT
#include "ringdht/ringaccount.h"
#endif
#include "manager.h"
#if HAVE_SDES
......@@ -634,7 +632,6 @@ SIPVoIPLink::guessAccount(const std::string& userName,
std::shared_ptr<SIPAccountBase> IP2IPAccount;
MatchRank best = MatchRank::NONE;
#if HAVE_DHT
// DHT accounts
for (const auto& account : Manager::instance().getAllAccounts<RingAccount>()) {
if (!account)
......@@ -649,7 +646,6 @@ SIPVoIPLink::guessAccount(const std::string& userName,
result = account;
}
}
#endif
// SIP accounts
for (const auto& account : Manager::instance().getAllAccounts<SIPAccount>()) {
......
......@@ -43,12 +43,8 @@
#include "upnp_igd.h"
#include "intrin.h"
#if HAVE_DHT
#include <opendht/rng.h>
using random_device = dht::crypto::random_device;
#else
using random_device = std::random_device;
#endif
namespace ring { namespace upnp {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment