aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_gateway.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-08-11 14:20:18 +0100
committerGravatar Sadie Powell2022-08-11 15:40:57 +0100
commitf88fbaa2fe91c22f1c7280ecd96c2bcf92f73a4d (patch)
treee35803070a6ca8e50ee2d07b2e6c0d71230d53f3 /src/modules/m_gateway.cpp
parentClean up the sockaddrs documentation comments. (diff)
Move aptosa/untosa into the sockaddrs union and add from/from_ip.
The struct will also now always be zero-initialized by default which removes the footgun which has happened previously where the union has been accessed before being initialized leading to it containing weird values.
Diffstat (limited to 'src/modules/m_gateway.cpp')
-rw-r--r--src/modules/m_gateway.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp
index a00d2d0df..d4a9a3d7b 100644
--- a/src/modules/m_gateway.cpp
+++ b/src/modules/m_gateway.cpp
@@ -140,8 +140,8 @@ public:
CmdResult HandleLocal(LocalUser* user, const Params& parameters) override
{
- irc::sockets::sockaddrs sa;
- if (irc::sockets::aptosa(parameters[0], 0, sa))
+ irc::sockets::sockaddrs sa(false);
+ if (sa.from_ip(parameters[0]))
{
if (sa.family() != AF_INET)
{
@@ -263,8 +263,8 @@ public:
if (!host.Matches(user, parameters[0], sslapi))
continue;
- irc::sockets::sockaddrs ipaddr;
- if (!irc::sockets::aptosa(parameters[3], user->client_sa.port(), ipaddr))
+ irc::sockets::sockaddrs ipaddr(false);
+ if (!ipaddr.from_ip_port(parameters[3], user->client_sa.port()))
{
ServerInstance->SNO.WriteGlobalSno('w', "Connecting user %s (%s) tried to use WEBIRC but gave an invalid IP address.",
user->uuid.c_str(), user->GetIPString().c_str());