diff options
| author | 2022-08-11 14:20:18 +0100 | |
|---|---|---|
| committer | 2022-08-11 15:40:57 +0100 | |
| commit | f88fbaa2fe91c22f1c7280ecd96c2bcf92f73a4d (patch) | |
| tree | e35803070a6ca8e50ee2d07b2e6c0d71230d53f3 /src/modules/m_cloaking.cpp | |
| parent | Clean 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_cloaking.cpp')
| -rw-r--r-- | src/modules/m_cloaking.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index b04295ef1..c8a8cfaa2 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -509,8 +509,8 @@ public: { std::string chost; - irc::sockets::sockaddrs hostip; - bool host_is_ip = irc::sockets::aptosa(host, ip.port(), hostip) && hostip == ip; + irc::sockets::sockaddrs hostip(false); + bool host_is_ip = hostip.from_ip_port(host, ip.port()) && hostip == ip; switch (info.mode) { @@ -569,7 +569,7 @@ CmdResult CommandCloak::Handle(User* user, const Params& parameters) // If we're cloaking an IP address we pass it in the IP field too. irc::sockets::sockaddrs sa; - const char* ipaddr = irc::sockets::aptosa(parameters[0], 0, sa) ? parameters[0].c_str() : ""; + const char* ipaddr = sa.from_ip(parameters[0]) ? parameters[0].c_str() : ""; unsigned int id = 0; for (const auto& info : mod->cloaks) |
