diff options
-rw-r--r-- | CHANGELOG.rst | 11 | ||||
-rw-r--r-- | CMakeLists.txt | 14 | ||||
-rw-r--r-- | packaging/biboumi.spec.cmake | 6 | ||||
-rw-r--r-- | src/database/database.cpp | 4 | ||||
-rw-r--r-- | src/identd/identd_server.hpp | 1 | ||||
-rw-r--r-- | src/identd/identd_socket.cpp | 8 | ||||
-rw-r--r-- | src/network/dns_handler.cpp | 1 | ||||
-rw-r--r-- | src/network/resolver.cpp | 1 | ||||
-rw-r--r-- | src/network/tcp_client_socket_handler.cpp | 6 | ||||
-rw-r--r-- | src/network/tcp_client_socket_handler.hpp | 2 | ||||
-rw-r--r-- | src/utils/empty_if_fixed_server.hpp | 12 | ||||
-rw-r--r-- | src/utils/get_first_non_empty.hpp | 4 | ||||
-rw-r--r-- | tests/end_to_end/__main__.py | 18 |
13 files changed, 52 insertions, 36 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 45c13bd..35a7737 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,14 @@ +Version 8.5 - 2020-05-09 +======================== + +- Fix a build failure with GCC 10 + +Version 8.4 - 2020-02-25 +======================== + +- Fix a possible crash that could be caused by a very well timed identd + query + Version 8.3 - 2018-06-01 ======================== diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c09090..debdf06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0) project(biboumi) set(${PROJECT_NAME}_VERSION_MAJOR 8) -set(${PROJECT_NAME}_VERSION_MINOR 3) +set(${PROJECT_NAME}_VERSION_MINOR 5) set(${PROJECT_NAME}_VERSION_SUFFIX "") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -218,6 +218,8 @@ if(SQLITE3_FOUND OR PQ_FOUND) include_directories(database ${PQ_INCLUDE_DIRS}) endif() set(USE_DATABASE TRUE) +else() + add_library(database OBJECT "") endif() # @@ -233,7 +235,8 @@ add_executable(${PROJECT_NAME} src/main.cpp $<TARGET_OBJECTS:xmpp> $<TARGET_OBJECTS:bridge> $<TARGET_OBJECTS:irc> - $<TARGET_OBJECTS:identd>) + $<TARGET_OBJECTS:identd> + $<TARGET_OBJECTS:database>) ## test_suite file(GLOB source_tests @@ -246,12 +249,9 @@ add_executable(test_suite ${source_tests} $<TARGET_OBJECTS:xmpp> $<TARGET_OBJECTS:bridge> $<TARGET_OBJECTS:irc> - $<TARGET_OBJECTS:identd>) + $<TARGET_OBJECTS:identd> + $<TARGET_OBJECTS:database>) set_target_properties(test_suite PROPERTIES EXCLUDE_FROM_ALL TRUE) -if(USE_DATABASE) - target_link_libraries(${PROJECT_NAME} $<TARGET_OBJECTS:database>) - target_link_libraries(test_suite $<TARGET_OBJECTS:database>) -endif() # ## Link the executables with their libraries diff --git a/packaging/biboumi.spec.cmake b/packaging/biboumi.spec.cmake index 5950930..45f9376 100644 --- a/packaging/biboumi.spec.cmake +++ b/packaging/biboumi.spec.cmake @@ -63,6 +63,12 @@ make check %{?_smp_mflags} %changelog +* Sat May 9 2020 Le Coz Florent <louiz@louiz.org> - 8.5-1 + Update to version 8.5 + +* Tue Feb 25 2020 Le Coz Florent <louiz@louiz.org> - 8.4-1 + Update to version 8.4 + * Wed Jun 1 2018 Le Coz Florent <louiz@louiz.org> - 8.3-1 Update to version 8.3 diff --git a/src/database/database.cpp b/src/database/database.cpp index 4867f52..6e08ee1 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -242,9 +242,9 @@ std::tuple<bool, std::vector<Database::MucLogLine>> Database::get_muc_logs(const } if (paging == Database::Paging::first) - return std::make_tuple(complete, result); + return {complete, result}; else - return std::make_tuple(complete, std::vector<Database::MucLogLine>(result.crbegin(), result.crend())); + return {complete, {result.crbegin(), result.crend()}}; } Database::MucLogLine Database::get_muc_log(const std::string& owner, const std::string& chan_name, const std::string& server, diff --git a/src/identd/identd_server.hpp b/src/identd/identd_server.hpp index b1c8ec8..55fe225 100644 --- a/src/identd/identd_server.hpp +++ b/src/identd/identd_server.hpp @@ -24,6 +24,7 @@ class IdentdServer: public TcpSocketServer<IdentdSocket> if (this->poller->is_managing_socket(this->socket)) this->poller->remove_socket_handler(this->socket); ::close(this->socket); + this->sockets.clear(); } void clean() { diff --git a/src/identd/identd_socket.cpp b/src/identd/identd_socket.cpp index 92cd80b..7688bbe 100644 --- a/src/identd/identd_socket.cpp +++ b/src/identd/identd_socket.cpp @@ -25,10 +25,12 @@ void IdentdSocket::parse_in_buffer(const std::size_t) std::istringstream line(this->in_buf.substr(0, line_end)); this->consume_in_buffer(line_end + 1); - uint16_t local_port; - uint16_t remote_port; + uint16_t local_port{}; + uint16_t remote_port{}; char sep; line >> local_port >> sep >> remote_port; + if (line.fail()) // Data did not match the expected format, ignore the line entirely + continue; const auto& xmpp = this->server.get_biboumi_component(); auto response = this->generate_answer(xmpp, local_port, remote_port); @@ -47,7 +49,7 @@ std::string IdentdSocket::generate_answer(const BiboumiComponent& biboumi, uint1 { for (const auto& pair: bridge->get_irc_clients()) { - if (pair.second->match_port_pairt(local, remote)) + if (pair.second->match_port_pair(local, remote)) { std::ostringstream os; os << local << " , " << remote << " : USERID : OTHER : " << hash_jid(bridge->get_bare_jid()) << "\r\n"; diff --git a/src/network/dns_handler.cpp b/src/network/dns_handler.cpp index 7f0c96a..dd6f201 100644 --- a/src/network/dns_handler.cpp +++ b/src/network/dns_handler.cpp @@ -9,6 +9,7 @@ #include <udns.h> #include <cerrno> +#include <stdexcept> #include <cstring> class Resolver; diff --git a/src/network/resolver.cpp b/src/network/resolver.cpp index ef54ba2..ae5cecd 100644 --- a/src/network/resolver.cpp +++ b/src/network/resolver.cpp @@ -21,6 +21,7 @@ static std::map<int, std::string> dns_error_messages { {DNS_E_TEMPFAIL, "Timeout while contacting DNS servers"}, {DNS_E_PROTOCOL, "Misformatted DNS reply"}, {DNS_E_NXDOMAIN, "Domain name not found"}, + {DNS_E_NODATA, "Domain name not found"}, {DNS_E_NOMEM, "Out of memory"}, {DNS_E_BADQUERY, "Misformatted domain name"} }; diff --git a/src/network/tcp_client_socket_handler.cpp b/src/network/tcp_client_socket_handler.cpp index 9dda73d..dcf38f9 100644 --- a/src/network/tcp_client_socket_handler.cpp +++ b/src/network/tcp_client_socket_handler.cpp @@ -261,8 +261,10 @@ std::string TCPClientSocketHandler::get_port() const return this->port; } -bool TCPClientSocketHandler::match_port_pairt(const uint16_t local, const uint16_t remote) const +bool TCPClientSocketHandler::match_port_pair(const uint16_t local, const uint16_t remote) const { + if (!this->is_connected()) + return false; const auto remote_port = static_cast<uint16_t>(std::stoi(this->port)); - return this->is_connected() && local == this->local_port && remote == remote_port; + return local == this->local_port && remote == remote_port; } diff --git a/src/network/tcp_client_socket_handler.hpp b/src/network/tcp_client_socket_handler.hpp index 74caca9..38d8b84 100644 --- a/src/network/tcp_client_socket_handler.hpp +++ b/src/network/tcp_client_socket_handler.hpp @@ -34,7 +34,7 @@ class TCPClientSocketHandler: public TCPSocketHandler /** * Whether or not this connection is using the two given TCP ports. */ - bool match_port_pairt(const uint16_t local, const uint16_t remote) const; + bool match_port_pair(const uint16_t local, const uint16_t remote) const; protected: bool hostname_resolution_failed; diff --git a/src/utils/empty_if_fixed_server.hpp b/src/utils/empty_if_fixed_server.hpp index 9ccf5fd..2422ee4 100644 --- a/src/utils/empty_if_fixed_server.hpp +++ b/src/utils/empty_if_fixed_server.hpp @@ -7,17 +7,11 @@ namespace utils { - inline std::string empty_if_fixed_server(std::string&& str) + inline const std::string& empty_if_fixed_server(const std::string& str) { + static const std::string empty{}; if (!Config::get("fixed_irc_server", "").empty()) - return {}; - return str; - } - - inline std::string empty_if_fixed_server(const std::string& str) - { - if (!Config::get("fixed_irc_server", "").empty()) - return {}; + return empty; return str; } diff --git a/src/utils/get_first_non_empty.hpp b/src/utils/get_first_non_empty.hpp index a38f5fb..2e1828d 100644 --- a/src/utils/get_first_non_empty.hpp +++ b/src/utils/get_first_non_empty.hpp @@ -6,13 +6,13 @@ bool is_empty(const std::string& val); bool is_empty(const int& val); template <typename T> -T get_first_non_empty(T&& last) +T& get_first_non_empty(T&& last) { return last; } template <typename T, typename... Args> -T get_first_non_empty(T&& first, Args&&... args) +T& get_first_non_empty(T&& first, Args&&... args) { if (!is_empty(first)) return first; diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index a029bea..b5d56fc 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -108,10 +108,10 @@ class XMPPComponent(slixmpp.BaseXMPP): if self.biboumi: self.biboumi.stop() - @asyncio.coroutine - def accept_routine(self): - self.accepting_server = yield from self.loop.create_server(lambda: self, - "127.0.0.1", 8811, reuse_address=True) + + async def accept_routine(self): + self.accepting_server = await self.loop.create_server(lambda: self, + "127.0.0.1", 8811, reuse_address=True) def check_stanza_against_all_expected_xpaths(self): pass @@ -220,13 +220,11 @@ class ProcessRunner: self.signal_sent = False self.create = None - @asyncio.coroutine - def start(self): - self.process = yield from self.create + async def start(self): + self.process = await self.create - @asyncio.coroutine - def wait(self): - code = yield from self.process.wait() + async def wait(self): + code = await self.process.wait() return code def stop(self): |