Changeset - ab2424659344
[Not reviewed]
CMakeLists.txt
Show inline comments
 
@@ -3,14 +3,18 @@ project(libtransport)
 

	
 
set(CMAKE_MODULE_PATH "cmake_modules")
 

	
 
set(cppunit_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(cppunit)
 

	
 
if (WIN32)
 
ADD_SUBDIRECTORY(msvc-deps)
 
else()
 
set(sqlite3_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(sqlite3)
 
endif()
 

	
 
set(mysql_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(mysql)
 

	
 
set(purple_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(purple)
 
@@ -26,18 +30,20 @@ endif()
 
set(event_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(event)
 

	
 
set(Swiften_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(Swiften REQUIRED)
 

	
 
if (NOT WIN32)
 
set(openssl_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(openssl REQUIRED)
 
endif()
 

	
 
set(Boost_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
if (WIN32)
 
set(Boost_USE_STATIC_LIBS        ON)
 
set(Boost_USE_STATIC_LIBS      ON)
 
set(Boost_USE_MULTITHREADED      ON)
 
set(Boost_USE_STATIC_RUNTIME    OFF)
 
endif()
 
find_package(Boost COMPONENTS program_options date_time system filesystem regex  signals REQUIRED)
 
message( STATUS "Found Boost: ${Boost_LIBRARIES}, ${Boost_INCLUDE_DIR}")
 

	
 
@@ -53,14 +59,16 @@ find_package(log4cxx)
 
set(event_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(event)
 

	
 
set(pqxx_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(pqxx)
 

	
 
if (NOT WIN32)
 
set(dbus_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
find_package(dbus)
 
endif()
 

	
 
find_package(Doxygen)
 

	
 
INCLUDE(FindQt4)
 
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtNetwork)
 

	
 
@@ -72,13 +80,16 @@ message("  Supported features")
 
message("-----------------------")
 

	
 
if (SPECTRUM_VERSION)
 
	ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
else (SPECTRUM_VERSION)
 
	if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
		execute_process(COMMAND git "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git" rev-parse --short HEAD
 
		if (NOT GIT_EXECUTABLE)
 
		set (GIT_EXECUTABLE git)
 
		endif()
 
		execute_process(COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git" rev-parse --short HEAD
 
						OUTPUT_VARIABLE GIT_REVISION
 
						OUTPUT_STRIP_TRAILING_WHITESPACE
 
		)
 
		set(SPECTRUM_VERSION 2.0.0-beta-git-${GIT_REVISION})
 
		ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
	else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
@@ -91,14 +102,21 @@ message("Version           : " ${SPECTRUM_VERSION})
 

	
 
if (SQLITE3_FOUND)
 
	ADD_DEFINITIONS(-DWITH_SQLITE)
 
	include_directories(${SQLITE3_INCLUDE_DIR})
 
	message("SQLite3           : yes")
 
else (SQLITE3_FOUND)
 
if (WIN32)
 
	ADD_DEFINITIONS(-DWITH_SQLITE)
 
	include_directories(msvc-deps/sqlite3)
 
	set (SQLITE3_LIBRARIES "${CMAKE_SOURCE_DIR}/msvc-deps/sqlite3/sqlite3.lib")
 
	message("SQLite3           : bundled")
 
else()
 
	set(SQLITE3_LIBRARIES "")
 
	message("SQLite3           : no")
 
endif()
 
endif (SQLITE3_FOUND)
 

	
 
if (MYSQL_FOUND)
 
	ADD_DEFINITIONS(-DWITH_MYSQL)
 
	include_directories(${MYSQL_INCLUDE_DIR})
 
	message("MySQL             : yes")
 
@@ -145,38 +163,41 @@ if (PROTOBUF_FOUND)
 
		include_directories(${IRC_INCLUDE_DIR})
 
		include(${QT_USE_FILE})
 
	else()
 
		message("IRC plugin        : no (install libCommuni and libprotobuf-dev)")
 
	endif()
 

	
 
if (NOT WIN32)
 
	message("Frotz plugin      : yes")
 
	message("SMSTools3 plugin  : yes")
 

	
 
else()
 
	message("Frotz plugin      : no")
 
	message("SMSTools3 plugin  : no")
 
	if(${LIBDBUSGLIB_FOUND})
 
		message("Skype plugin      : yes")
 
		include_directories(${LIBDBUSGLIB_INCLUDE_DIRS})
 
	else()
 
		message("Skype plugin      : no (install dbus-glib-devel)")
 
	endif()
 
endif()
 

	
 
else()
 
	message("Network plugins   : no (install libprotobuf-dev)")
 
	message("Libpurple plugin  : no (install libpurple and libprotobuf-dev)")
 
	message("IRC plugin        : no (install libircclient-qt and libprotobuf-dev)")
 
	message("Frotz plugin      : no (install libprotobuf-dev)")
 
	message("SMSTools3 plugin  : no (install libprotobuf-dev)")
 
endif()
 

	
 
if (LOG4CXX_FOUND)
 
	message("Logging           : yes")
 
	include_directories(${LOG4CXX_INCLUDE_DIR})
 
else()
 
	message(FATAL_ERROR "Logging           : no (install log4cxx-devel)")
 
endif()
 

	
 
if (WIN32)
 
ADD_DEFINITIONS(-DLOG4CXX_STATIC)
 
ADD_DEFINITIONS(-D_WIN32_WINNT=0x501)
 
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
 
endif()
 

	
 
if(CMAKE_BUILD_TYPE MATCHES Debug)
 
if (CMAKE_COMPILER_IS_GNUCXX)
 
@@ -206,13 +227,16 @@ SET(PROJECT_VERSION 2.0)
 
include_directories(include)
 

	
 

	
 
include_directories(${EVENT_INCLUDE_DIRS})
 
include_directories(${SWIFTEN_INCLUDE_DIR})
 
include_directories(${Boost_INCLUDE_DIRS})
 

	
 
if (NOT WIN32)
 
include_directories(${OPENSSL_INCLUDE_DIR})
 
endif()
 

	
 
ADD_SUBDIRECTORY(src)
 
ADD_SUBDIRECTORY(plugin)
 
ADD_SUBDIRECTORY(include)
 
ADD_SUBDIRECTORY(spectrum)
 
ADD_SUBDIRECTORY(backends)
backends/CMakeLists.txt
Show inline comments
 
@@ -4,17 +4,16 @@ if (PROTOBUF_FOUND)
 
	endif()
 

	
 
	if (IRC_FOUND)
 
		ADD_SUBDIRECTORY(libcommuni)
 
	endif()
 

	
 
	ADD_SUBDIRECTORY(smstools3)
 

	
 
	ADD_SUBDIRECTORY(template)
 

	
 
if (NOT WIN32)
 
	ADD_SUBDIRECTORY(smstools3)
 
	ADD_SUBDIRECTORY(frotz)
 
	if (${LIBDBUSGLIB_FOUND})
 
		ADD_SUBDIRECTORY(skype)
 
	endif()
 
endif()
 

	
backends/template/CMakeLists.txt
Show inline comments
 
cmake_minimum_required(VERSION 2.6)
 
 
FILE(GLOB SRC *.c *.cpp)
 
 
ADD_EXECUTABLE(spectrum2_template_backend ${SRC})
 
 
if (NOT WIN32)
 
target_link_libraries(spectrum2_template_backend transport pthread ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
 
else()
 
target_link_libraries(spectrum2_template_backend transport ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
 
endif()
 
 
#INSTALL(TARGETS spectrum2_template_backend RUNTIME DESTINATION bin)
 
backends/template/main.cpp
Show inline comments
 
@@ -2,18 +2,19 @@
 
#include "transport/config.h"
 
#include "transport/networkplugin.h"
 

	
 
// Swiften
 
#include "Swiften/Swiften.h"
 

	
 
#ifndef _MSC_VER
 
// for signal handler
 
#include "unistd.h"
 
#include "signal.h"
 
#include "sys/wait.h"
 
#include "sys/signal.h"
 

	
 
#endif
 
// Log4cxx
 
#include "log4cxx/logger.h"
 
#include "log4cxx/consoleappender.h"
 
#include "log4cxx/patternlayout.h"
 
#include "log4cxx/propertyconfigurator.h"
 
#include "log4cxx/helpers/properties.h"
 
@@ -85,12 +86,14 @@ class TemplatePlugin : public NetworkPlugin {
 
		}
 

	
 
	private:
 
		Config *config;
 
};
 

	
 
#ifndef _MSC_VER
 

	
 
static void spectrum_sigchld_handler(int sig)
 
{
 
	int status;
 
	pid_t pid;
 

	
 
	do {
 
@@ -100,23 +103,24 @@ static void spectrum_sigchld_handler(int sig)
 
	if ((pid == (pid_t) - 1) && (errno != ECHILD)) {
 
		char errmsg[BUFSIZ];
 
		snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
 
		perror(errmsg);
 
	}
 
}
 

	
 
#endif
 

	
 
int main (int argc, char* argv[]) {
 
	std::string host;
 
	int port;
 

	
 
#ifndef _MSC_VER
 
	if (signal(SIGCHLD, spectrum_sigchld_handler) == SIG_ERR) {
 
		std::cout << "SIGCHLD handler can't be set\n";
 
		return -1;
 
	}
 

	
 
#endif
 
	boost::program_options::options_description desc("Usage: spectrum [OPTIONS] <config_file.cfg>\nAllowed options");
 
	desc.add_options()
 
		("host,h", value<std::string>(&host), "host")
 
		("port,p", value<int>(&port), "port")
 
		;
 
	try
cmake_modules/log4cxxConfig.cmake
Show inline comments
 
# LOG4CXX_FOUND - system has liblog4cxx
 
# LOG4CXX_INCLUDE_DIR - the liblog4cxx include directory
 
# LOG4CXX_LIBRARIES - liblog4cxx library
 

	
 
FIND_PATH(LOG4CXX_INCLUDE_DIR logger.h PATHS /include/log4cxx /usr/include/log4cxx /usr/local/include/log4cxx )
 
FIND_PATH(LOG4CXX_INCLUDE_DIR log4cxx/logger.h PATHS /include /usr/include /usr/local/include )
 
FIND_LIBRARY(LOG4CXX_LIBRARIES NAMES log4cxx log4cxxd PATHS /lib /usr/lib /usr/local/lib )
 

	
 
IF(LOG4CXX_INCLUDE_DIR AND LOG4CXX_LIBRARIES)
 
  SET(LOG4CXX_FOUND 1)
 
  #remove last /log4cxx string
 
  STRING(REGEX REPLACE "/log4cxx" " " LOG4CXX_INCLUDE_DIR_SUP_LEVEL ${LOG4CXX_INCLUDE_DIR})
include/Swiften/Server/Server.cpp
Show inline comments
 
@@ -146,12 +146,12 @@ void Server::handleSessionFinished(boost::shared_ptr<ServerFromClientSession> se
 
	session->onSessionStarted.disconnect(
 
			boost::bind(&Server::handleSessionStarted, this, session));
 
	session->onSessionFinished.disconnect(
 
			boost::bind(&Server::handleSessionFinished, this, session));
 
}
 

	
 
void Server::addTLSEncryption(TLSServerContextFactory* tlsContextFactory, const PKCS12Certificate& cert) {
 
void Server::addTLSEncryption(TLSServerContextFactory* tlsContextFactory, CertificateWithKey::ref cert) {
 
	tlsFactory = tlsContextFactory;
 
	this->cert = cert;
 
}
 

	
 
}
include/Swiften/Server/Server.h
Show inline comments
 
@@ -18,13 +18,13 @@
 
#include "Swiften/Server/ServerFromClientSession.h"
 
#include "Swiften/JID/JID.h"
 
#include "Swiften/Base/ByteArray.h"
 
#include "Swiften/Entity/Entity.h"
 
#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
 
#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
 
#include "Swiften/TLS/PKCS12Certificate.h"
 
#include <Swiften/TLS/CertificateWithKey.h>
 
#include <Swiften/Parser/PlatformXMLParserFactory.h>
 

	
 
namespace Swift {
 
	class ConnectionServer;
 
	class SessionTracer;
 
	class EventLoop;
 
@@ -57,13 +57,13 @@ namespace Swift {
 
				return serverFromClientConnectionServer;
 
			}
 

	
 
			boost::signal<void (const SafeByteArray&)> onDataRead;
 
			boost::signal<void (const SafeByteArray&)> onDataWritten;
 

	
 
			void addTLSEncryption(TLSServerContextFactory* tlsContextFactory, const PKCS12Certificate& cert);
 
			void addTLSEncryption(TLSServerContextFactory* tlsContextFactory, CertificateWithKey::ref cert);
 

	
 
		private:
 
			void handleNewClientConnection(boost::shared_ptr<Connection> c);
 
			void handleSessionStarted(boost::shared_ptr<ServerFromClientSession>);
 
			void handleSessionFinished(boost::shared_ptr<ServerFromClientSession>);
 
			void handleElementReceived(boost::shared_ptr<Element> element, boost::shared_ptr<ServerFromClientSession> session);
 
@@ -81,10 +81,10 @@ namespace Swift {
 
			std::vector<boost::bsignals::connection> serverFromClientConnectionServerSignalConnections;
 
			std::list<boost::shared_ptr<ServerFromClientSession> > serverFromClientSessions;
 
			JID selfJID;
 
			StanzaChannel *stanzaChannel_;
 
			IQRouter *iqRouter_;
 
			TLSServerContextFactory *tlsFactory;
 
			PKCS12Certificate cert;
 
			CertificateWithKey::ref cert;
 
			PlatformXMLParserFactory *parserFactory_;
 
	};
 
}
include/Swiften/Server/ServerFromClientSession.cpp
Show inline comments
 
@@ -24,12 +24,13 @@
 
#include <Swiften/SASL/PLAINMessage.h>
 
#include <Swiften/StreamStack/StreamStack.h>
 
#include <Swiften/StreamStack/TLSServerLayer.h>
 
#include <Swiften/Elements/StartTLSRequest.h>
 
#include <Swiften/Elements/TLSProceed.h>
 
#include <iostream>
 
#include <Swiften/TLS/CertificateWithKey.h>
 

	
 
namespace Swift {
 

	
 
ServerFromClientSession::ServerFromClientSession(
 
		const std::string& id,
 
		boost::shared_ptr<Connection> connection, 
 
@@ -159,13 +160,13 @@ void ServerFromClientSession::setAllowSASLEXTERNAL() {
 
}
 

	
 
void ServerFromClientSession::handleSessionFinished(const boost::optional<SessionError>&) {
 
	userRegistry_->stopLogin(JID(user_, getLocalJID().getDomain()), this);
 
}
 

	
 
void ServerFromClientSession::addTLSEncryption(TLSServerContextFactory* tlsContextFactory, const PKCS12Certificate& cert) {
 
void ServerFromClientSession::addTLSEncryption(TLSServerContextFactory* tlsContextFactory, CertificateWithKey::ref cert) {
 
	tlsLayer = new TLSServerLayer(tlsContextFactory);
 
	if (!tlsLayer->setServerCertificate(cert)) {
 
// 		std::cout << "error\n";
 
		// TODO:
 
// 		onClosed(boost::shared_ptr<Error>(new Error(Error::InvalidTLSCertificateError)));
 
	}
include/Swiften/Server/ServerFromClientSession.h
Show inline comments
 
@@ -12,12 +12,13 @@
 

	
 
#include <string>
 
#include <Swiften/Session/Session.h>
 
#include <Swiften/JID/JID.h>
 
#include <Swiften/Network/Connection.h>
 
#include <Swiften/Base/ByteArray.h>
 
#include <Swiften/TLS/CertificateWithKey.h>
 

	
 
namespace Swift {
 
	class ProtocolHeader;
 
	class Element;
 
	class Stanza;
 
	class PayloadParserFactoryCollection;
 
@@ -46,13 +47,13 @@ namespace Swift {
 
			boost::signal<void ()> onSessionStarted;
 
			void setAllowSASLEXTERNAL();
 
			const std::string &getUser() {
 
				return user_;
 
			}
 

	
 
			void addTLSEncryption(TLSServerContextFactory* tlsContextFactory, const PKCS12Certificate& cert);
 
			void addTLSEncryption(TLSServerContextFactory* tlsContextFactory, CertificateWithKey::ref cert);
 

	
 
			Swift::JID getBareJID() {
 
				return Swift::JID(user_, getLocalJID().getDomain());
 
			}
 

	
 
			void handlePasswordValid();
include/Swiften/StreamStack/TLSServerLayer.cpp
Show inline comments
 
@@ -34,13 +34,13 @@ void TLSServerLayer::writeData(const SafeByteArray& data) {
 
}
 

	
 
void TLSServerLayer::handleDataRead(const SafeByteArray& data) {
 
	context->handleDataFromNetwork(data);
 
}
 

	
 
bool TLSServerLayer::setServerCertificate(const PKCS12Certificate& certificate) {
 
bool TLSServerLayer::setServerCertificate(CertificateWithKey::ref certificate) {
 
	return context->setServerCertificate(certificate);
 
}
 

	
 
Certificate::ref TLSServerLayer::getPeerCertificate() const {
 
	return context->getPeerCertificate();
 
}
include/Swiften/StreamStack/TLSServerLayer.h
Show inline comments
 
@@ -6,12 +6,13 @@
 

	
 
#include "Swiften/Base/boost_bsignals.h"
 

	
 
#include "Swiften/Base/SafeByteArray.h"
 
#include "Swiften/StreamStack/StreamLayer.h"
 
#include "Swiften/TLS/Certificate.h"
 
#include <Swiften/TLS/CertificateWithKey.h>
 
#include "Swiften/TLS/CertificateVerificationError.h"
 

	
 
namespace Swift {
 
	class TLSServerContext;
 
	class TLSServerContextFactory;
 
	class PKCS12Certificate;
 
@@ -19,13 +20,13 @@ namespace Swift {
 
	class TLSServerLayer : public StreamLayer {
 
		public:
 
			TLSServerLayer(TLSServerContextFactory*);
 
			~TLSServerLayer();
 

	
 
			void connect();
 
			bool setServerCertificate(const PKCS12Certificate&);
 
			bool setServerCertificate(CertificateWithKey::ref cert);
 

	
 
			Certificate::ref getPeerCertificate() const;
 
			boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const;
 

	
 
			void writeData(const SafeByteArray& data);
 
			void handleDataRead(const SafeByteArray& data);
include/Swiften/TLS/TLSServerContext.h
Show inline comments
 
@@ -8,24 +8,25 @@
 

	
 
#include "Swiften/Base/boost_bsignals.h"
 
#include <boost/shared_ptr.hpp>
 

	
 
#include "Swiften/Base/SafeByteArray.h"
 
#include "Swiften/TLS/Certificate.h"
 
#include <Swiften/TLS/CertificateWithKey.h>
 
#include "Swiften/TLS/CertificateVerificationError.h"
 

	
 
namespace Swift {
 
	class PKCS12Certificate;
 

	
 
	class TLSServerContext {
 
		public:
 
			virtual ~TLSServerContext();
 

	
 
			virtual void connect() = 0;
 

	
 
			virtual bool setServerCertificate(const PKCS12Certificate& cert) = 0;
 
			virtual bool setServerCertificate(CertificateWithKey::ref cert) = 0;
 

	
 
			virtual void handleDataFromNetwork(const SafeByteArray&) = 0;
 
			virtual void handleDataFromApplication(const SafeByteArray&) = 0;
 

	
 
			virtual Certificate::ref getPeerCertificate() const = 0;
 
			virtual CertificateVerificationError::ref getPeerCertificateVerificationError() const = 0;
spectrum/src/main.cpp
Show inline comments
 
@@ -358,13 +358,13 @@ int main(int argc, char **argv)
 
			std::cerr << "Can't connect to database. Check the log to find out the reason.\n";
 
			return -1;
 
		}
 
	}
 
#else
 
	if (CONFIG_STRING(&config, "database.type") == "sqlite3") {
 
		std::cerr << "Spectrum2 is not compiled with mysql backend.\n";
 
		std::cerr << "Spectrum2 is not compiled with sqlite3 backend.\n";
 
		return -2;
 
	}
 
#endif
 

	
 
#ifdef WITH_MYSQL
 
	if (CONFIG_STRING(&config, "database.type") == "mysql") {
src/transport.cpp
Show inline comments
 
@@ -17,22 +17,29 @@
 
 * along with this program; if not, write to the Free Software
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 
 */
 

	
 
#include "transport/transport.h"
 
#include <boost/bind.hpp>
 
#include <boost/smart_ptr/make_shared.hpp>
 
#include <boost/algorithm/string/predicate.hpp>
 
#include "transport/storagebackend.h"
 
#include "transport/factory.h"
 
#include "transport/userregistry.h"
 
#include "discoinforesponder.h"
 
#include "discoitemsresponder.h"
 
#include "storageparser.h"
 
#include "Swiften/TLS/OpenSSL/OpenSSLServerContext.h"
 
#ifdef _WIN32
 
#include <Swiften/TLS/CAPICertificate.h>
 
#include "Swiften/TLS/Schannel/SchannelServerContext.h"
 
#include "Swiften/TLS/Schannel/SchannelServerContextFactory.h"
 
#else
 
#include "Swiften/TLS/PKCS12Certificate.h"
 
#include "Swiften/TLS/OpenSSL/OpenSSLServerContext.h"
 
#include "Swiften/TLS/OpenSSL/OpenSSLServerContextFactory.h"
 
#endif
 
#include "Swiften/Parser/PayloadParsers/AttentionParser.h"
 
#include "Swiften/Serializer/PayloadSerializers/AttentionSerializer.h"
 
#include "Swiften/Parser/PayloadParsers/XHTMLIMParser.h"
 
#include "Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.h"
 
#include "Swiften/Parser/PayloadParsers/StatsParser.h"
 
#include "Swiften/Serializer/PayloadSerializers/StatsSerializer.h"
 
@@ -78,14 +85,20 @@ Component::Component(Swift::EventLoop *loop, Swift::NetworkFactories *factories,
 
	if (CONFIG_BOOL(m_config, "service.server_mode")) {
 
		LOG4CXX_INFO(logger, "Creating component in server mode on port " << CONFIG_INT(m_config, "service.port"));
 
		m_server = new Swift::Server(loop, m_factories, m_userRegistry, m_jid, CONFIG_INT(m_config, "service.port"));
 
		if (!CONFIG_STRING(m_config, "service.cert").empty()) {
 
			LOG4CXX_INFO(logger, "Using PKCS#12 certificate " << CONFIG_STRING(m_config, "service.cert"));
 
			LOG4CXX_INFO(logger, "SSLv23_server_method used.");
 
#ifdef _WIN32
 
			TLSServerContextFactory *f = new SchannelServerContextFactory();
 
			m_server->addTLSEncryption(f, boost::make_shared<CAPICertificate>(CONFIG_STRING(m_config, "service.cert")));
 
#else
 
			TLSServerContextFactory *f = new OpenSSLServerContextFactory();
 
			m_server->addTLSEncryption(f, PKCS12Certificate(CONFIG_STRING(m_config, "service.cert"), createSafeByteArray(CONFIG_STRING(m_config, "service.cert_password"))));
 
			m_server->addTLSEncryption(f, boost::make_shared<PKCS12Certificate>(CONFIG_STRING(m_config, "service.cert"), createSafeByteArray(CONFIG_STRING(m_config, "service.cert_password"))));
 
#endif
 
			
 
		}
 
		else {
 
			LOG4CXX_WARN(logger, "No PKCS#12 certificate used. TLS is disabled.");
 
		}
 
// 		m_server->start();
 
		m_stanzaChannel = m_server->getStanzaChannel();
0 comments (0 inline, 0 general)