summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2020-02-25 22:53:37 +0100
committerlouiz’ <louiz@louiz.org>2020-02-25 22:53:37 +0100
commit23f3f48b4aaca4d933b0fc448482c463dd2f31be (patch)
tree2de984557db6c3b03ac44b18028680355a3d458f /src
parentb18d81ae9faf6adcf4020680bc5d874bf92848c8 (diff)
downloadbiboumi-23f3f48b4aaca4d933b0fc448482c463dd2f31be.tar.gz
biboumi-23f3f48b4aaca4d933b0fc448482c463dd2f31be.tar.bz2
biboumi-23f3f48b4aaca4d933b0fc448482c463dd2f31be.tar.xz
biboumi-23f3f48b4aaca4d933b0fc448482c463dd2f31be.zip
Only consider sockets that are in valid states as identd candidates
When an identd query happens, we check all the connected sockets for their local and remote ports, to compare them with the query. But we MUST only consider the connected ones because: - It doesn’t make sense to answer for a connection that has just been closed - A non-connected sockets is not in a valid state for this (specifically here: its ::port attribute is empty) fix #3421
Diffstat (limited to 'src')
-rw-r--r--src/network/tcp_client_socket_handler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/tcp_client_socket_handler.cpp b/src/network/tcp_client_socket_handler.cpp
index e5b1b75..dcf38f9 100644
--- a/src/network/tcp_client_socket_handler.cpp
+++ b/src/network/tcp_client_socket_handler.cpp
@@ -263,6 +263,8 @@ std::string TCPClientSocketHandler::get_port() 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;
}