summaryrefslogtreecommitdiff
path: root/src/identd
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2020-02-25 23:30:29 +0100
committerlouiz’ <louiz@louiz.org>2020-02-25 23:30:29 +0100
commitc35e1aaa768c2d331ce4699245f820d6bbfcea7c (patch)
tree3b697303f3a5cc3ecb51da80612deef1775b5d76 /src/identd
parent440e04c6ba1dfae2d6fbb55b120763e3d0da6cd1 (diff)
parent4b0fb8b37e5d2ff79da1c568ca38d4c8905dc9eb (diff)
downloadbiboumi-c35e1aaa768c2d331ce4699245f820d6bbfcea7c.tar.gz
biboumi-c35e1aaa768c2d331ce4699245f820d6bbfcea7c.tar.bz2
biboumi-c35e1aaa768c2d331ce4699245f820d6bbfcea7c.tar.xz
biboumi-c35e1aaa768c2d331ce4699245f820d6bbfcea7c.zip
Merge branch 'v8'
Diffstat (limited to 'src/identd')
-rw-r--r--src/identd/identd_server.hpp1
-rw-r--r--src/identd/identd_socket.cpp8
2 files changed, 6 insertions, 3 deletions
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";