Commit f820d86a authored by Jonas Smedegaard's avatar Jonas Smedegaard

New upstream version 4.0

parents eda4b75b 9634cdab
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Gcov files
*.gcno
*.gcov
*.gcda
# Python files
*.pyc
*.pyo
# Build directories
build/
# Clion directory
.idea/
\ No newline at end of file
before_script:
- uname -a
- whoami
- echo $LANG
- g++ --version
- clang++ --version
- rm -rf build/
- mkdir build/
- cd build
variables:
COMPILER: "g++"
BUILD_TYPE: "Debug"
BOTAN: "-DWITH_BOTAN=1"
CARES: "-DWITH_CARES=1"
SYSTEMD: "-DWITH_SYSTEMD=1"
LIBIDN: "-DWITH_LIBIDN=1"
LITESQL: "-DWITH_LITESQL=1"
.template:basic_build: &basic_build
stage: build
script:
- "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}"
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make biboumi -j$(nproc)
- make check -j$(nproc)
image: biboumi-test-fedora:latest
build:1:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
<<: *basic_build
build:2:
variables:
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:3:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
<<: *basic_build
build:4:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
BOTAN: "-DWITHOUT_BOTAN=1"
<<: *basic_build
build:5:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:6:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:6:
variables:
LIBIDN: "-DWITHOUT_LIBIDN=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:rpm:
stage: build
script:
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make rpm -j$(nproc)
artifacts:
paths:
- build/rpmbuild/RPMS
- build/rpmbuild/SRPMS
when: always
.template:basic_test: &basic_test
stage: test
script:
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make biboumi -j$(nproc)
- make check
- make coverage
- mkdir tests_outputs && pushd tests_outputs && make e2e -j$(nproc) -C .. && popd
artifacts:
paths:
- build/coverage/
- build/tests_outputs/
when: always
test:debian:
stage: test
image: biboumi-test-debian:latest
<<: *basic_test
test:fedora:
stage: test
image: biboumi-test-fedora:latest
<<: *basic_test
\ No newline at end of file
Version 4.0 - 2016-11-09
========================
- The separator between the IRC nickname and the IRC server is now '%'
instead of '!'. This makes things simpler (only one separator to
remember). The distinction between a JID referring to a channel and a JID
refering to a nickname is based on the first character (# or & by
default, but this can be customized by the server with the ISUPPORT
extension).
- Handle channel invitations in both directions.
- Add support for `JID escaping <.http://www.xmpp.org/extensions/xep-0106.html>`.
- Save all channel messages into the database, with an ad-hoc option to
disable this feature.
- When joining a room, biboumi sends an history of the most recents messages
found in the database.
- Channel history can be retrieved using Message Archive Management.
- Result Set Management can be used to request only parts of the IRC channel
list.
Version 3.0 - 2016-08-03
========================
......
......@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
project(biboumi)
set(${PROJECT_NAME}_VERSION_MAJOR 3)
set(${PROJECT_NAME}_VERSION_MAJOR 4)
set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_SUFFIX "")
......@@ -96,7 +96,7 @@ if(LITESQL_FOUND)
add_library(database STATIC src/database/database.cpp
${LITESQL_GENERATED_SOURCES})
target_link_libraries(database ${LITESQL_LIBRARIES})
target_link_libraries(database ${LITESQL_LIBRARIES} utils)
if(BOTAN_FOUND)
target_link_libraries(database ${BOTAN_LIBRARIES})
endif()
......@@ -215,7 +215,7 @@ if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp)
)
add_dependencies(test_suite catch)
endif()
add_custom_target(check COMMAND "test_suite" "-s"
add_custom_target(check COMMAND "test_suite"
DEPENDS test_suite biboumi)
add_custom_target(e2e COMMAND "python3" "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/"
DEPENDS biboumi)
......@@ -232,6 +232,10 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
test_suite
coverage
)
SETUP_TARGET_FOR_COVERAGE(coverage_e2e
make
coverage_e2e
e2e)
endif()
#
......@@ -246,8 +250,8 @@ install(FILES conf/biboumi.cfg DESTINATION /etc/bib
## Dist target
## Generate a release tarball from the git sources
#
add_custom_target(dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ --format=tar HEAD
add_custom_command(OUTPUT ${ARCHIVE_NAME}.tar.xz
COMMAND git archive --prefix=${ARCHIVE_NAME}/ --format=tar HEAD^{tree}
> ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar
# Append this specific file that is not part of the git repo
COMMAND tar -rf ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar -P ${SOURCE_DIR}/single_include/catch.hpp --xform 's|/.*/|${ARCHIVE_NAME}/tests/|g'
......@@ -258,13 +262,15 @@ add_custom_target(dist
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "${ARCHIVE_NAME}.tar.xz created."
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_dependencies(dist catch)
add_custom_target(dist
DEPENDS ${ARCHIVE_NAME}.tar.xz
DEPENDS catch)
add_custom_target(rpm
DEPENDS dist
COMMAND mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
COMMAND rpmbuild --define "_topdir `pwd`/rpmbuild/" --define "_sourcedir `pwd`" -ba biboumi.spec
)
add_dependencies(rpm dist)
if(BOTAN_FOUND)
set(STR_WITH_BOTAN "Botan: yes")
......
Contributing to biboumi
=======================
Biboumi’s main workplace is at https://lab.louiz.org/louiz/biboumi
The repository is also mirrored on other websites, for example on github,
but that’s mainly for the convenience of users.
Before doing anything, you can come on the `XMPP chatroom`_ to discuss your
changes, issues or ideas.
Bug reports, feature requests
-----------------------------
To open a bug report, or a feature request, please do so on `our gitlab’s
bug tracker`_.
If the issue you’re reporting may have security implications, please select
the “confidential” flag in your bug report.
Code
----
To contribute code, you can do so using git: commit your changes on any
publicly available git repository and communicate us its address. This can
be done with a `gitlab merge request`_, or a `github pull request`_ or just
by sending a message into the `XMPP chatroom`_.
It is suggested that you use gitlab’s merge requests: this will
automatically run our continuous integration tests.
It is also recommended to add some unit or end-to-end tests for the proposed
changes.
Coding style
------------
Please try to follow the existing style:
- Use only spaces, not tabs.
- Curly brackets are on their own lines.
- Use this-> everywhere it’s possible.
- Don’t start class attributes with “m_” or similar.
- Type names are in PascalCase.
- Everything else is in snake_case.
.. _our gitlab’s bug tracker: https://lab.louiz.org/louiz/biboumi/issues/new
.. _gitlab merge request: https://lab.louiz.org/louiz/biboumi/merge_requests/new
.. _github pull request: https://github.com/louiz/biboumi/pulls
.. _XMPP chatroom: xmpp:biboumi@muc.poez.io
Copyright (c) 2015 Florent Le Coz
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
......
Biboumi
=======
.. image:: https://lab.louiz.org/louiz/biboumi/badges/master/build.svg
:target: https://lab.louiz.org/louiz/biboumi/commits/master
.. image:: https://lab.louiz.org/louiz/biboumi/badges/master/coverage.svg
:target: https://lab.louiz.org/louiz/biboumi/commits/master
.. image:: https://sonarqube.com/api/badges/gate?key=biboumi
:target: https://sonarqube.com/component_issues/index?id=biboumi
.. image:: https://scan.coverity.com/projects/3726/badge.svg
:target: https://scan.coverity.com/projects/louiz-biboumi
.. image:: https://bestpractices.coreinfrastructure.org/projects/450/badge
:target: https://bestpractices.coreinfrastructure.org/projects/450
Biboumi is an XMPP gateway that connects to IRC servers and translates
between the two protocols. It can be used to access IRC channels using any
XMPP client as if these channels were XMPP MUCs.
......@@ -29,6 +44,7 @@ Usage
-----
Read `the documentation`_.
Authors
-------
Florent Le Coz (louiz’) <louiz@louiz.org>
......@@ -37,17 +53,9 @@ Florent Le Coz (louiz’) <louiz@louiz.org>
Contact/Support
---------------
* XMPP ChatRoom: biboumi@muc.poez.io
* Report a bug: https://dev.louiz.org/projects/biboumi/issues/new
To contribute, the preferred way is to commit your changes on some
publicly-available git repository (your own, or github
(https://github.com/louiz/biboumi), or a fork on https://lab.louiz.org) and
to notify the developers with a ticket on the bug tracker
(https://dev.louiz.org/projects/biboumi/issues/new), a pull request on
github or a merge request on gitlab.
* Report a bug: https://lab.louiz.org/louiz/biboumi/issues/new
Optionally you can come discuss your changes on the XMPP chat room,
beforehand.
Also, see the `contributing`_ page.
Licence
......@@ -60,3 +68,4 @@ Please read the COPYING file for details.
.. _INSTALL: INSTALL.rst
.. _the documentation: doc/biboumi.1.rst
.. _contributing: CONTRIBUTING.rst
......@@ -47,23 +47,23 @@
#
# 3. Set compiler flags to turn off optimization and enable coverage:
# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
#
# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target
# which runs your test executable and produces a lcov code coverage report:
# Example:
# SETUP_TARGET_FOR_COVERAGE(
# my_coverage_target # Name for custom target.
# test_driver # Name of the test driver executable that runs the tests.
# # NOTE! This should always have a ZERO as exit code
# # otherwise the coverage generation will not complete.
# coverage # Name of output directory.
# )
# SETUP_TARGET_FOR_COVERAGE(
# my_coverage_target # Name for custom target.
# test_driver # Name of the test driver executable that runs the tests.
# # NOTE! This should always have a ZERO as exit code
# # otherwise the coverage generation will not complete.
# coverage # Name of output directory.
# )
#
# 4. Build a Debug build:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
#
#
......@@ -76,9 +76,9 @@ FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
# Display an error when the target is called. If no error is found, this
# function will be overridden by the real one later in this file
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
ADD_CUSTOM_TARGET(${_targetname}
ADD_CUSTOM_TARGET(${_targetname}
COMMAND echo "Coverage is not available: ${ERROR_MSG}"
)
)
ENDFUNCTION()
IF(NOT GCOV_PATH)
......@@ -130,50 +130,50 @@ ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
# Param _targetname The name of new the custom make target
# Param _testrunner The name of the target which runs the tests.
# MUST return ZERO always, even on errors.
# If not, no coverage report will be created!
# MUST return ZERO always, even on errors.
# If not, no coverage report will be created!
# Param _outputname lcov output is generated as _outputname.info
# HTML report is generated in _outputname/index.html
# Optional fifth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
# Setup target
ADD_CUSTOM_TARGET(${_targetname}
# Setup target
ADD_CUSTOM_TARGET(${_targetname}
# Cleanup lcov
COMMAND ${LCOV_PATH} --directory . --zerocounters
# Cleanup lcov
COMMAND ${LCOV_PATH} --directory . --zerocounters
# Create baseline coverage data file
COMMAND ${LCOV_PATH} -c -i -d . -o ${_outputname}.baseline.info -q
# Create baseline coverage data file
COMMAND ${LCOV_PATH} -c -i -d . -o ${_outputname}.baseline.info -q
# Run tests
COMMAND ${_testrunner} ${ARGV3}
# Run tests
COMMAND ${_testrunner} ${ARGV3}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info -q
# Combine the baseline and the test data
COMMAND ${LCOV_PATH} -a ${_outputname}.info -a ${_outputname}.baseline.info -o ${_outputname}.info -q
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info -q
# Combine the baseline and the test data
COMMAND ${LCOV_PATH} -a ${_outputname}.info -a ${_outputname}.baseline.info -o ${_outputname}.info -q
# Remove information about source files that are not part of
# the test (system file, external libraries, etc)
COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' --output-file ${_outputname}.info.cleaned -q
# Remove information about source files that are not part of
# the test (system file, external libraries, etc)
COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' 'build/*' --output-file ${_outputname}.info.cleaned -q
# Generate the report
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
# Generate the report
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
# Clean the temporary files we created
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
# Clean the temporary files we created
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
......@@ -184,30 +184,30 @@ ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname)
IF(NOT PYTHON_EXECUTABLE)
MESSAGE(FATAL_ERROR "Python not found! Aborting...")
ENDIF() # NOT PYTHON_EXECUTABLE
IF(NOT PYTHON_EXECUTABLE)
MESSAGE(FATAL_ERROR "Python not found! Aborting...")
ENDIF() # NOT PYTHON_EXECUTABLE
IF(NOT GCOVR_PATH)
MESSAGE(FATAL_ERROR "gcovr not found! Aborting...")
ENDIF() # NOT GCOVR_PATH
IF(NOT GCOVR_PATH)
MESSAGE(FATAL_ERROR "gcovr not found! Aborting...")
ENDIF() # NOT GCOVR_PATH
MARK_AS_ADVANCED(GCOVR_PATH)
ADD_CUSTOM_TARGET(${_targetname}
ADD_CUSTOM_TARGET(${_targetname}
# Run tests
${_testrunner} ${ARGV3}
# Run tests
${_testrunner} ${ARGV3}
# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
......@@ -2,6 +2,16 @@
<!DOCTYPE database SYSTEM "litesql.dtd">
<database name="BibouDB" namespace="db">
<object name="GlobalOptions">
<field name="owner" type="string" length="3071"/>
<field name="maxHistoryLength" type="integer" default="20"/>
<field name="recordHistory" type="boolean" default="true"/>
<index unique="true">
<indexfield name="owner"/>
</index>
</object>
<object name="IrcServerOptions">
<field name="owner" type="string" length="3071"/>
<field name="server" type="string" length="3071"/>
......@@ -18,6 +28,7 @@
<field name="encodingOut" type="string" default="ISO-8859-1"/>
<field name="encodingIn" type="string" default="ISO-8859-1"/>
<field name="maxHistoryLength" type="integer" default="20"/>
<index unique="true">
<indexfield name="owner"/>
<indexfield name="server"/>
......@@ -32,6 +43,8 @@
<field name="encodingOut" type="string"/>
<field name="encodingIn" type="string"/>
<field name="maxHistoryLength" type="integer" default="20"/>
<index unique="true">
<indexfield name="owner"/>
<indexfield name="server"/>
......@@ -39,8 +52,17 @@
</index>
</object>
<object name="LogLine">
<field name="date" type="date" />
<field name="body" type="string" length="4096"/>
<object name="MucLogLine">
<field name="uuid" type="string" length="36" />
<!-- The bare JID of the user for which we stored the line. It's
the JID associated with the Bridge -->
<field name="owner" type="string" length="4096" />
<!-- The room IID -->
<field name="ircChanName" type="string" length="4096" />
<field name="ircServerName" type="string" length="4096" />
<field name="date" type="datetime" />
<field name="body" type="string" length="65536"/>
<field name="nick" type="string" length="4096" />
</object>
</database>
This diff is collapsed.
# This is an example configuration for the biboumi component.
# It only contains the default values, and some example values for the
# required fields (hostname and password).
hostname=biboumi.example.com
password=mypassword
xmpp_server_ip=127.0.0.1
port=5347
admin=
realname_customization=true
realname_from_jid=false
log_file=
ca_file=
outgoing_bind=
......@@ -39,6 +39,8 @@ RUN rm -rf /litesql
RUN ldconfig
# Install slixmpp, for e2e tests
RUN git clone https://github.com/saghul/aiodns.git
RUN cd aiodns && python3 setup.py build && python3 setup.py install
RUN apt install -y python3-pip
RUN git clone git://git.louiz.org/slixmpp
RUN pip3 install pyasn1
......@@ -48,10 +50,10 @@ RUN cd slixmpp && python3 setup.py build && python3 setup.py install
RUN useradd tester -m
# Install charybdis, for e2e tests
RUN apt install -y automake autoconf flex bison libltdl-dev openssl
RUN apt install -y automake autoconf flex bison libltdl-dev openssl zlib1g-dev
RUN apt install -y libtool
RUN git clone https://github.com/charybdis-ircd/charybdis.git && cd charybdis
RUN cd /charybdis && ./autogen.sh && ./configure --prefix=/home/tester/ircd --bindir=/usr/bin && make -j8 && make install
RUN cd /charybdis && git checkout 4f2b9a4 && ./autogen.sh && ./configure --prefix=/home/tester/ircd --bindir=/usr/bin && make -j8 && make install
RUN chown -R tester:tester /home/tester/ircd
RUN rm -rf /charybdis
......
......@@ -53,12 +53,17 @@ RUN useradd tester
RUN dnf install -y automake autoconf flex flex-devel bison libtool-ltdl-devel openssl-devel
RUN dnf install -y libtool
RUN git clone https://github.com/charybdis-ircd/charybdis.git && cd charybdis
RUN cd /charybdis && ./autogen.sh && ./configure --prefix=/home/tester/ircd --bindir=/usr/bin && make -j8 && make install
RUN cd /charybdis && git checkout 4f2b9a4 && ./autogen.sh && ./configure --prefix=/home/tester/ircd --bindir=/usr/bin --with-included-boost && make -j8 && make install
RUN chown -R tester:tester /home/tester/ircd
RUN rm -rf /charybdis
RUN su - tester -c "echo export LANG=en_GB.utf-8 >> /home/tester/.bashrc"
COPY coverity /home/tester/coverity
COPY sonar-scanner-2.8 /home/tester/sonar-scanner
RUN dnf install -y which java-1.8.0-openjdk
WORKDIR /home/tester
USER tester
......@@ -143,4 +143,25 @@ if(SYSTEMD_FOUND)
target_link_libraries(xmpplib ${SYSTEMD_LIBRARIES})
endif()
#
## Check if we have std::get_time
#
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <iomanip>
int main()
{ std::get_time(nullptr, \"\"); }"
HAS_GET_TIME)
mark_as_advanced(HAS_GET_TIME)
check_cxx_source_compiles("
#include <iomanip>
int main()
{ std::put_time(nullptr, \"\"); }"
HAS_PUT_TIME)
mark_as_advanced(HAS_PUT_TIME)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/louloulibs.h.cmake ${CMAKE_BINARY_DIR}/src/louloulibs.h)
......@@ -19,7 +19,7 @@ include(FindPkgConfig)
pkg_check_modules(LIBUUID uuid)
if(NOT LIBUUID_FOUND)
find_path(LIBUUID_INCLUDE_DIRS NAMES uuid.h
find_path(LIBUUID_INCLUDE_DIRS NAMES uuid/uuid.h
PATH_SUFFIXES uuid
DOC "The libuuid include directory")
......
......@@ -6,4 +6,6 @@
#cmakedefine BOTAN_FOUND
#cmakedefine CARES_FOUND
#cmakedefine SOFTWARE_VERSION "${SOFTWARE_VERSION}"
#cmakedefine PROJECT_NAME "${PROJECT_NAME}"
\ No newline at end of file
#cmakedefine PROJECT_NAME "${PROJECT_NAME}"
#cmakedefine HAS_GET_TIME
#cmakedefine HAS_PUT_TIME
......@@ -29,7 +29,7 @@ BasicCredentialsManager::BasicCredentialsManager(const TCPSocketHandler* const s
socket_handler(socket_handler),
trusted_fingerprint{}
{
this->load_certs();
BasicCredentialsManager::load_certs();
}
void BasicCredentialsManager::set_trusted_fingerprint(const std::string& fingerprint)
......@@ -62,17 +62,8 @@ void BasicCredentialsManager::verify_certificate_chain(const std::string& type,
}
}
void BasicCredentialsManager::load_certs()
bool BasicCredentialsManager::try_to_open_one_ca_bundle(const std::vector<std::string>& paths)
{
// Only load the certificates the first time
if (BasicCredentialsManager::certs_loaded)
return;
const std::string conf_path = Config::get("ca_file", "");
std::vector<std::string> paths;
if (conf_path.empty())
paths = default_cert_files;
else
paths.push_back(conf_path);
for (const auto& path: paths)
{
try
......@@ -87,25 +78,39 @@ void BasicCredentialsManager::load_certs()
// will be ignored. As a result, some TLS connection may be refused
// because the certificate is signed by an issuer that was ignored.
try {
const Botan::X509_Certificate cert(bundle);
BasicCredentialsManager::certificate_store.add_certificate(cert);
} catch (const Botan::Decoding_Error& error)
{
Botan::X509_Certificate cert(bundle);