diff options
| author | 2023-01-24 02:58:46 +0000 | |
|---|---|---|
| committer | 2023-01-24 02:58:46 +0000 | |
| commit | f310e1c98dc262249146025ffffb81334b38680d (patch) | |
| tree | edd19152137e71db58efc5fbd289f34ce9b6919b /src/modules | |
| parent | Clean up some remaining old format string stuff. (diff) | |
Refactor the caching methods in User and rename to make more sense.
Diffstat (limited to 'src/modules')
41 files changed, 89 insertions, 90 deletions
diff --git a/src/modules/m_account.cpp b/src/modules/m_account.cpp index 12e6eae8a..9db381d28 100644 --- a/src/modules/m_account.cpp +++ b/src/modules/m_account.cpp @@ -70,12 +70,12 @@ public: if (value.empty()) { // Logged out. - user->WriteNumeric(RPL_LOGGEDOUT, user->GetFullHost(), "You are now logged out"); + user->WriteNumeric(RPL_LOGGEDOUT, user->GetMask(), "You are now logged out"); } else { // Logged in. - user->WriteNumeric(RPL_LOGGEDIN, user->GetFullHost(), value, INSP_FORMAT("You are now logged in as {}", value)); + user->WriteNumeric(RPL_LOGGEDIN, user->GetMask(), value, INSP_FORMAT("You are now logged in as {}", value)); } } @@ -319,7 +319,7 @@ public: if (!automatic) { ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they are not logged into the correct user account.", - user->nick, user->MakeHost(), user->GetIPString(), oper->GetName()); + user->nick, user->GetRealUserHost(), user->GetAddress(), oper->GetName()); } return MOD_RES_DENY; // Account required but it does not match. } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 310903eea..6cb06f5d9 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -311,11 +311,11 @@ public: } std::string ipmask(user->nick); - ipmask.append(1, '!').append(user->MakeHostIP()); + ipmask.append(1, '!').append(user->GetUserAddress()); for (const auto& redirect : *redirects) { - if(InspIRCd::Match(user->GetFullRealHost(), redirect.banmask) || InspIRCd::Match(user->GetFullHost(), redirect.banmask) || InspIRCd::MatchCIDR(ipmask, redirect.banmask)) + if (InspIRCd::Match(user->GetRealMask(), redirect.banmask) || InspIRCd::Match(user->GetMask(), redirect.banmask) || InspIRCd::MatchCIDR(ipmask, redirect.banmask)) { /* This prevents recursion when a user sets multiple ban redirects in a chain * (thanks Potter) diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 516d1d513..678d923cb 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -426,8 +426,7 @@ public: if (now > (dat->lastnotify + long(notify_cooldown))) { user->WriteNumeric(RPL_TARGNOTIFY, dest->nick, "has been informed that you messaged them."); - dest->WriteRemoteNumeric(RPL_UMODEGMSG, user->nick, - INSP_FORMAT("{}@{}", user->ident, user->GetDisplayedHost()), + dest->WriteRemoteNumeric(RPL_UMODEGMSG, user->nick, user->GetUserHost(), INSP_FORMAT("is messaging you, and you have user mode +{} set. Use /ACCEPT +{} to allow.", myumode.GetModeChar(), user->nick) ); dat->lastnotify = now; diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index f2cf6e2db..2ecffeda5 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -42,7 +42,7 @@ public: { if ((created) && (IS_LOCAL(memb->user))) { - ServerInstance->SNO.WriteGlobalSno('j', "Channel {} created by {}", memb->chan->name, memb->user->GetFullRealHost()); + ServerInstance->SNO.WriteGlobalSno('j', "Channel {} created by {}", memb->chan->name, memb->user->GetRealMask()); } } }; diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index eb2229d7b..c3b8efd4c 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -44,7 +44,7 @@ struct HistoryItem final : ts(ServerInstance->Time()) , text(details.text) , type(details.type) - , sourcemask(source->GetFullHost()) + , sourcemask(source->GetMask()) { tags.reserve(details.tags_out.size()); for (const auto& [tagname, tagvalue] : details.tags_out) diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 110621510..9f9c69647 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -166,8 +166,8 @@ public: { LocalUser* localtarget = IS_LOCAL(targetuser); /* /check on a user */ - context.Write("nuh", targetuser->GetFullHost()); - context.Write("realnuh", targetuser->GetFullRealHost()); + context.Write("nuh", targetuser->GetMask()); + context.Write("realnuh", targetuser->GetRealMask()); context.Write("realname", targetuser->GetRealName()); context.Write("modes", targetuser->GetModeLetters()); context.Write("snomasks", GetSnomasks(targetuser)); @@ -212,7 +212,7 @@ public: context.Write("serializer", localtarget->serializer->name.substr(11)); } else - context.Write("onip", targetuser->GetIPString()); + context.Write("onip", targetuser->GetAddress()); CheckContext::List chanlist(context, "onchans"); for (const auto* memb : targetuser->chans) @@ -244,7 +244,7 @@ public: */ const UserManager::CloneCounts& clonecount = ServerInstance->Users.GetCloneCounts(u); context.Write("member", INSP_FORMAT("{} {}{} ({}\x0F)", clonecount.global, memb->GetAllPrefixChars(), - u->GetFullHost(), u->GetRealName())); + u->GetMask(), u->GetRealName())); } for (auto* lm : ServerInstance->Modes.GetListModes()) @@ -275,7 +275,7 @@ public: if (InspIRCd::Match(u->GetDisplayedHost(), parameters[0], ascii_case_insensitive_map)) matches.push_back("dhost"); - if (InspIRCd::MatchCIDR(u->GetIPString(), parameters[0])) + if (InspIRCd::MatchCIDR(u->GetAddress(), parameters[0])) matches.push_back("ipaddr"); if (InspIRCd::MatchCIDR(u->GetRealName(), parameters[0])) @@ -285,7 +285,7 @@ public: { const std::string whatmatch = stdalgo::string::join(matches, ','); context.Write("match", INSP_FORMAT("{} {} {} {} {} {} {} :{}", ++x, whatmatch, u->nick, u->ident, - u->GetRealHost(), u->GetDisplayedHost(), u->GetIPString(), u->GetRealName())); + u->GetRealHost(), u->GetDisplayedHost(), u->GetAddress(), u->GetRealName())); matches.clear(); } } diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp index bc6849258..170faeccf 100644 --- a/src/modules/m_clearchan.cpp +++ b/src/modules/m_clearchan.cpp @@ -119,7 +119,7 @@ public: XLine* xline; try { - mask = (method[0] == 'Z') ? curr->GetIPString() : (curr->GetBanIdent() + "@" + curr->GetRealHost()); + mask = (method[0] == 'Z') ? curr->GetAddress() : (curr->GetBanIdent() + "@" + curr->GetRealHost()); xline = xlf->Generate(ServerInstance->Time(), 60*60, user->nick, reason, mask); } catch (const ModuleException&) diff --git a/src/modules/m_cloak.cpp b/src/modules/m_cloak.cpp index 0f1e8f256..84dbc5d6c 100644 --- a/src/modules/m_cloak.cpp +++ b/src/modules/m_cloak.cpp @@ -138,7 +138,7 @@ public: cloaks->push_back(cloak); ServerInstance->Logs.Debug(MODNAME, "Cloaked {} ({}/{}) as {} using the {} method.", - user->uuid, user->GetIPString(), user->GetRealHost(), + user->uuid, user->GetAddress(), user->GetRealHost(), cloak, cloakmethod->GetName()); } ext.Set(user, cloaks); diff --git a/src/modules/m_cloak_md5.cpp b/src/modules/m_cloak_md5.cpp index dc6f33613..45bb07e6a 100644 --- a/src/modules/m_cloak_md5.cpp +++ b/src/modules/m_cloak_md5.cpp @@ -255,7 +255,7 @@ struct CloakInfo final if (!Hash || !user->client_sa.is_ip()) return {}; - return GenCloak(user->client_sa, user->GetIPString(), user->GetRealHost()); + return GenCloak(user->client_sa, user->GetAddress(), user->GetRealHost()); } std::string Generate(const std::string& hostip) override diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 49bf1796e..ccc9c37f8 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -48,7 +48,7 @@ struct CustomTitle final bool MatchUser(User* user) const { - return InspIRCd::MatchMask(host, user->MakeHost(), user->MakeHostIP()); + return InspIRCd::MatchMask(host, user->GetRealUserHost(), user->GetUserAddress()); } bool CheckPass(const std::string& pass) const diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 24f2c4758..20dfc5897 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -447,7 +447,7 @@ public: { for (const auto& dccallow : *dl) { - if (InspIRCd::Match(user->GetFullHost(), dccallow.hostmask)) + if (InspIRCd::Match(user->GetMask(), dccallow.hostmask)) return MOD_RES_PASSTHRU; } } diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp index e791236f0..c4d58d74d 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -149,7 +149,7 @@ public: // The user has tried to execute a disabled command! user->CommandFloodPenalty += 2000; - WriteLog("{} was blocked from executing the disabled {} command", user->GetFullRealHost(), command); + WriteLog("{} was blocked from executing the disabled {} command", user->GetRealMask(), command); if (fakenonexistent) { @@ -179,7 +179,7 @@ public: // The user has tried to change a disabled mode! const char* what = change.mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user"; WriteLog("{} was blocked from {}setting the disabled {} mode {} ({})", - user->GetFullRealHost().c_str(), change.adding ? "" : "un", + user->GetRealMask().c_str(), change.adding ? "" : "un", what, change.mh->GetModeChar(), change.mh->name.c_str()); if (fakenonexistent) diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index f30b1e44c..556a5339d 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -314,7 +314,7 @@ public: { const std::string reason = Template::Replace(config->reason, { { "dnsbl", config->name }, - { "ip", them->GetIPString() }, + { "ip", them->GetAddress() }, { "result", ConvToStr(result) }, }); @@ -344,23 +344,23 @@ public: } case DNSBLEntry::Action::KLINE: { - AddLine<KLine>("K-line", reason, config->xlineduration, them->GetBanIdent(), them->GetIPString()); + AddLine<KLine>("K-line", reason, config->xlineduration, them->GetBanIdent(), them->GetAddress()); break; } case DNSBLEntry::Action::GLINE: { - AddLine<GLine>("G-line", reason, config->xlineduration, them->GetBanIdent(), them->GetIPString()); + AddLine<GLine>("G-line", reason, config->xlineduration, them->GetBanIdent(), them->GetAddress()); break; } case DNSBLEntry::Action::ZLINE: { - AddLine<ZLine>("Z-line", reason, config->xlineduration, them->GetIPString()); + AddLine<ZLine>("Z-line", reason, config->xlineduration, them->GetAddress()); break; } } ServerInstance->SNO.WriteGlobalSno('d', "Connecting user {} ({}) detected as being on the '{}' DNS blacklist with result {}", - them->GetFullRealHost(), them->GetIPString(), config->name, result); + them->GetRealMask(), them->GetAddress(), config->name, result); } else config->stats_misses++; @@ -394,7 +394,7 @@ public: return; ServerInstance->SNO.WriteGlobalSno('d', "An error occurred whilst checking whether {} ({}) is on the '{}' DNS blacklist: {}", - them->GetFullRealHost(), them->GetIPString(), config->name, data.dns->GetErrorStr(q->error)); + them->GetRealMask(), them->GetAddress(), config->name, data.dns->GetErrorStr(q->error)); } }; @@ -478,7 +478,7 @@ public: else return; - ServerInstance->Logs.Debug(MODNAME, "Reversed IP {} -> {}", user->GetIPString(), reversedip); + ServerInstance->Logs.Debug(MODNAME, "Reversed IP {} -> {}", user->GetAddress(), reversedip); data.countext.Set(user, dnsbls.size()); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index f66e207b3..859a26265 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -463,7 +463,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar } else if (f->action == FA_SHUN && (ServerInstance->XLines->GetFactory("SHUN"))) { - auto* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); + auto* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was shunned for {} (expires on {}) because their message to {} matched {} ({})", user->nick, sh->Displayable(), Duration::ToString(f->duration), InspIRCd::TimeString(ServerInstance->Time() + f->duration), @@ -477,7 +477,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar } else if (f->action == FA_GLINE) { - auto* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetIPString()); + auto* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was G-lined for {} (expires on {}) because their message to {} matched {} ({})", user->nick, gl->Displayable(), Duration::ToString(f->duration), InspIRCd::TimeString(ServerInstance->Time() + f->duration), @@ -491,7 +491,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar } else if (f->action == FA_ZLINE) { - auto* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); + auto* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was Z-lined for {} (expires on {}) because their message to {} matched {} ({})", user->nick, zl->Displayable(), Duration::ToString(f->duration), InspIRCd::TimeString(ServerInstance->Time() + f->duration), @@ -568,7 +568,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& if (f->action == FA_GLINE) { /* Note: We G-line *@IP so that if their host doesn't resolve the G-line still applies. */ - auto* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetIPString()); + auto* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was G-lined for {} (expires on {}) because their {} message matched {} ({})", user->nick, gl->Displayable(), Duration::ToString(f->duration), @@ -584,7 +584,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& } if (f->action == FA_ZLINE) { - auto* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); + auto* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was Z-lined for {} (expires on {}) because their {} message matched {} ({})", user->nick, zl->Displayable(), Duration::ToString(f->duration), @@ -601,7 +601,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& else if (f->action == FA_SHUN && (ServerInstance->XLines->GetFactory("SHUN"))) { /* Note: We shun *!*@IP so that if their host doesnt resolve the shun still applies. */ - auto* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); + auto* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was shunned for {} (expires on {}) because their {} message matched {} ({})", user->nick, sh->Displayable(), Duration::ToString(f->duration), diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp index a61910985..1c4e3970a 100644 --- a/src/modules/m_gateway.cpp +++ b/src/modules/m_gateway.cpp @@ -66,7 +66,7 @@ public: return true; // Does the user's IP address match this hostmask? - if (InspIRCd::MatchCIDR(user->GetIPString(), mask, ascii_case_insensitive_map)) + if (InspIRCd::MatchCIDR(user->GetAddress(), mask, ascii_case_insensitive_map)) return true; } @@ -118,7 +118,7 @@ public: return true; // Does the user's IP address match this hostmask? - if (InspIRCd::MatchCIDR(user->GetIPString(), mask, ascii_case_insensitive_map)) + if (InspIRCd::MatchCIDR(user->GetAddress(), mask, ascii_case_insensitive_map)) return true; } @@ -265,7 +265,7 @@ public: if (!ipaddr.from_ip_port(parameters[3], user->client_sa.port())) { ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} ({}) tried to use WEBIRC but gave an invalid IP address.", - user->uuid, user->GetIPString()); + user->uuid, user->GetAddress()); ServerInstance->Users.QuitUser(user, "WEBIRC: IP address is invalid: " + parameters[3]); return CmdResult::FAILURE; } @@ -273,10 +273,10 @@ public: // The user matched a WebIRC block! extban.gateway.Set(user, parameters[1]); realhost.Set(user, user->GetRealHost()); - realip.Set(user, user->GetIPString()); + realip.Set(user, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} is using the {} WebIRC gateway; changing their IP from {} to {}.", - user->uuid, parameters[1], user->GetIPString(), parameters[3]); + user->uuid, parameters[1], user->GetAddress(), parameters[3]); // If we have custom flags then deal with them. WebIRC::FlagMap flags; @@ -320,7 +320,7 @@ public: } ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} ({}) tried to use WEBIRC but didn't match any configured WebIRC hosts.", - user->uuid, user->GetIPString()); + user->uuid, user->GetAddress()); ServerInstance->Users.QuitUser(user, "WEBIRC: you don't match any configured WebIRC hosts."); return CmdResult::FAILURE; } @@ -455,11 +455,11 @@ public: // Store the hostname and IP of the gateway for later use. cmdwebirc.realhost.Set(user, user->GetRealHost()); - cmdwebirc.realip.Set(user, user->GetIPString()); + cmdwebirc.realip.Set(user, user->GetAddress()); const std::string& newident = host.GetIdent(); ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} is using an ident gateway; changing their IP from {} to {} and their ident from {} to {}.", - user->uuid, user->GetIPString(), address.addr(), user->ident, newident); + user->uuid, user->GetAddress(), address.addr(), user->ident, newident); user->ChangeIdent(newident); user->ChangeRemoteAddress(address); diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 6970ab2ce..6234f7c93 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -174,7 +174,7 @@ public: extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime); } - stats.AddGenericRow(INSP_FORMAT("\x02{}\x02 ({}){}", oper->nick, oper->MakeHost(), extra)); + stats.AddGenericRow(INSP_FORMAT("\x02{}\x02 ({}){}", oper->nick, oper->GetRealUserHost(), extra)); } stats.AddGenericRow(INSP_FORMAT("{} server operator{} total", opers, opers ? "s" : "")); return MOD_RES_DENY; diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index be2956c73..6efab2b20 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -106,10 +106,10 @@ public: if (!ports.empty() && !ports.count(user->server_sa.port())) return false; - if (InspIRCd::MatchCIDR(user->MakeHost(), mask)) + if (InspIRCd::MatchCIDR(user->GetRealUserHost(), mask)) return true; - return InspIRCd::MatchCIDR(user->MakeHostIP(), mask); + return InspIRCd::MatchCIDR(user->GetUserAddress(), mask); } void Wrap(const std::string& value, std::string& out) const diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 06efed523..fcc0e65d7 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -265,7 +265,7 @@ namespace Stats .Attribute("nickchanged", u->nickchanged) .Attribute("modes", u->GetModeLetters().substr(1)) .Attribute("ident", u->ident) - .Attribute("ipaddress", u->GetIPString()); + .Attribute("ipaddress", u->GetAddress()); if (u->IsAway()) { diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index 0e808d2c8..9af2f52ad 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -173,7 +173,7 @@ private: // Drop attempts to send a tag message to a server. This usually happens when the // server is started in debug mode and a client tries to send a typing notification // to a query window created by the debug message. - if (!target && irc::equals(parameters[0], ServerInstance->FakeClient->GetFullHost())) + if (!target && irc::equals(parameters[0], ServerInstance->FakeClient->GetMask())) return CmdResult::FAILURE; } } diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 330d50c58..ea0764d5d 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -138,7 +138,7 @@ public: if (notify & KN_SEND_NUMERIC) { Numeric::Numeric numeric(RPL_KNOCK); - numeric.push(c->name).push(user->GetFullHost()).push("is KNOCKing: " + parameters[1]); + numeric.push(c->name).push(user->GetMask()).push("is KNOCKing: " + parameters[1]); ClientProtocol::Messages::Numeric numericmsg(numeric, c->name); c->Write(ServerInstance->GetRFCEvents().numeric, numericmsg, status); diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp index 642dbad88..b10945a43 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -124,7 +124,7 @@ public: if (!checkingAttributes && requiredattributes.empty()) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from {} (dn={})", user->GetFullRealHost(), DN); + ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from {} (dn={})", user->GetRealMask(), DN); // We're done, there are no attributes to check SetVHost(user, DN); @@ -143,7 +143,7 @@ public: passed = true; if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from {} (dn={})", user->GetFullRealHost(), DN); + ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from {} (dn={})", user->GetRealMask(), DN); SetVHost(user, DN); authed->Set(user); @@ -181,7 +181,7 @@ public: if (verbose) { ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (dn={}) (unable to validate attributes)", - user->GetFullRealHost(), DN); + user->GetRealMask(), DN); } ServerInstance->Users.QuitUser(user, killreason); delete this; @@ -205,7 +205,7 @@ public: if (verbose) { ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} ({})", - user->GetFullRealHost(), err.getError()); + user->GetRealMask(), err.getError()); } ServerInstance->Users.QuitUser(user, killreason); } @@ -400,7 +400,7 @@ public: for (const auto& whitelistedcidr : whitelistedcidrs) { - if (InspIRCd::MatchCIDR(user->GetIPString(), whitelistedcidr, ascii_case_insensitive_map)) + if (InspIRCd::MatchCIDR(user->GetAddress(), whitelistedcidr, ascii_case_insensitive_map)) { ldapAuthed.Set(user, true); return MOD_RES_PASSTHRU; @@ -410,7 +410,7 @@ public: if (user->password.empty()) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (no password provided)", user->GetFullRealHost()); + ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (no password provided)", user->GetRealMask()); ServerInstance->Users.QuitUser(user, killreason); return MOD_RES_DENY; } @@ -418,7 +418,7 @@ public: if (!LDAP) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (unable to find LDAP provider)", user->GetFullRealHost()); + ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (unable to find LDAP provider)", user->GetRealMask()); ServerInstance->Users.QuitUser(user, killreason); return MOD_RES_DENY; } diff --git a/src/modules/m_ldapoper.cpp b/src/modules/m_ldapoper.cpp index 342fbc3f3..40be350de 100644 --- a/src/modules/m_ldapoper.cpp +++ b/src/modules/m_ldapoper.cpp @@ -226,7 +226,7 @@ public: return MOD_RES_PASSTHRU; std::string acceptedhosts = it->second->GetConfig()->getString("host"); - if (!InspIRCd::MatchMask(acceptedhosts, user->MakeHost(), user->MakeHostIP())) + if (!InspIRCd::MatchMask(acceptedhosts, user->GetRealUserHost(), user->GetUserAddress())) return MOD_RES_PASSTHRU; if (!LDAP) diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 8460f7f96..bdb32b9ce 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -54,7 +54,7 @@ public: Command* thiscommand = ServerInstance->Parser.GetHandler(command); if ((thiscommand) && (thiscommand->access_needed == CmdAccess::OPERATOR)) { - std::string msg = "[" + user->GetFullRealHost() + "] " + command + " " + stdalgo::string::join(parameters); + std::string msg = "[" + user->GetRealMask() + "] " + command + " " + stdalgo::string::join(parameters); if (tosnomask) ServerInstance->SNO.WriteGlobalSno('o', msg); else diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 0c694208f..4c804fe09 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -55,7 +55,7 @@ public: return false; const std::string host = u->nick + "!" + u->ident + "@" + u->GetRealHost() + " " + u->GetRealName(); - const std::string ip = u->nick + "!" + u->ident + "@" + u->GetIPString() + " " + u->GetRealName(); + const std::string ip = u->nick + "!" + u->ident + "@" + u->GetAddress() + " " + u->GetRealName(); return (regex->IsMatch(host) || regex->IsMatch(ip)); } @@ -68,18 +68,18 @@ public: { if (ZlineOnMatch) { - auto* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, MODNAME "@" + ServerInstance->Config->ServerName, reason, u->GetIPString()); + auto* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, MODNAME "@" + ServerInstance->Config->ServerName, reason, u->GetAddress()); if (ServerInstance->XLines->AddLine(zl, nullptr)) { if (!duration) { ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Z-line on {}: {}", - zl->source, u->GetIPString(), zl->reason); + zl->source, u->GetAddress(), zl->reason); } else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}", - zl->source, u->GetIPString(), Duration::ToString(zl->duration), + zl->source, u->GetAddress(), Duration::ToString(zl->duration), InspIRCd::TimeString(zl->duration), zl->reason); } added_zline = true; diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index c9f585cbe..85aba2d0f 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -188,7 +188,7 @@ private: std::vector<std::string> params; params.reserve(3); params.push_back(user->GetRealHost()); - params.push_back(user->GetIPString()); + params.push_back(user->GetAddress()); params.emplace_back(sslapi && sslapi->GetCertificate(user) ? "S" : "P"); SendSASL(user, "*", 'H', params); diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index e07c3b973..18d6e495d 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -90,10 +90,10 @@ public: // Allow if the source matches an <securehost> entry. for (const auto& allowhost : allowlist) { - if (InspIRCd::Match(user->MakeHost(), allowhost, ascii_case_insensitive_map)) + if (InspIRCd::Match(user->GetRealUserHost(), allowhost, ascii_case_insensitive_map)) return MOD_RES_PASSTHRU; - if (InspIRCd::Match(user->MakeHostIP(), allowhost, ascii_case_insensitive_map)) + if (InspIRCd::Match(user->GetUserAddress(), allowhost, ascii_case_insensitive_map)) return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 20bafbadb..b51d18651 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -77,7 +77,7 @@ public: auto* find = ServerInstance->Users.Find(target, true); if (find) - target = "*!" + find->GetBanIdent() + "@" + find->GetIPString(); + target = "*!" + find->GetBanIdent() + "@" + find->GetAddress(); if (parameters.size() == 1) { diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 4c3c8d26e..15690fb47 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -439,7 +439,7 @@ private: if (!(entry.flags & flag)) continue; - if (InspIRCd::Match(source->GetFullHost(), entry.mask)) + if (InspIRCd::Match(source->GetMask(), entry.mask)) return entry.flags & SilenceEntry::SF_EXEMPT; } diff --git a/src/modules/m_spanningtree/ftopic.cpp b/src/modules/m_spanningtree/ftopic.cpp index 19c2e36ea..4ecf5d616 100644 --- a/src/modules/m_spanningtree/ftopic.cpp +++ b/src/modules/m_spanningtree/ftopic.cpp @@ -45,7 +45,7 @@ CmdResult CommandFTopic::Handle(User* user, Params& params) const std::string& newtopic = params.back(); // If there is a setter in the message use that, otherwise use the message source - const std::string& setter = ((params.size() > 4) ? params[3] : (ServerInstance->Config->FullHostInTopic ? user->GetFullHost() : user->nick)); + const std::string& setter = ((params.size() > 4) ? params[3] : (ServerInstance->Config->FullHostInTopic ? user->GetMask() : user->nick)); /* * If the topics were updated at the exact same second, accept diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 2354f5587..3e6ba9ec9 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -611,7 +611,7 @@ void ModuleSpanningTree::OnUserQuit(User* user, const std::string& reason, const if (!hide) { ServerInstance->SNO.WriteToSnoMask('Q', "Client exiting on server {}: {} ({}) [{}]", user->server->GetName(), - user->GetFullRealHost(), user->GetIPString(), oper_message); + user->GetRealMask(), user->GetAddress(), oper_message); } } diff --git a/src/modules/m_spanningtree/nick.cpp b/src/modules/m_spanningtree/nick.cpp index a4c5cb120..daea6d236 100644 --- a/src/modules/m_spanningtree/nick.cpp +++ b/src/modules/m_spanningtree/nick.cpp @@ -42,7 +42,7 @@ CmdResult CommandNick::HandleRemote(::RemoteUser* user, Params& params) { // 'x' is the already existing user using the same nick as params[0] // 'user' is the user trying to change nick to the in use nick - bool they_change = SpanningTreeUtilities::DoCollision(x, TreeServer::Get(user), newts, user->ident, user->GetIPString(), user->uuid, "NICK"); + bool they_change = SpanningTreeUtilities::DoCollision(x, TreeServer::Get(user), newts, user->ident, user->GetAddress(), user->uuid, "NICK"); if (they_change) { // Remote client lost, or both lost, rewrite this nick change as a change to uuid before diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index c44196e92..97a63e7e3 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -70,7 +70,7 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo { /* first, let's see if ident@host matches. */ const std::string& localident = u->ident; - const std::string& localip = u->GetIPString(); + const std::string& localip = u->GetAddress(); bool SamePerson = (localident == remoteident) && (localip == remoteip); @@ -91,7 +91,7 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo } ServerInstance->Logs.Debug(MODNAME, "Nick collision on \"{}\" caused by {}: {}/{}/{}@{} {} <-> {}/{}/{}@{} {}", u->nick, collidecmd, - u->uuid, localts, u->ident, u->GetIPString(), bChangeLocal, + u->uuid, localts, u->ident, u->GetAddress(), bChangeLocal, remoteuid, remotets, remoteident, remoteip, bChangeRemote); /* diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index 74892d4b3..4e994124d 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -110,7 +110,7 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& para } ServerInstance->SNO.WriteToSnoMask('O', "From {}: {} ({}) [{}] is now a server operator of type \x02{}\x02{}.", - u->server->GetName(), u->nick, u->MakeHost(), u->GetIPString(), u->oper->GetType(), extra); + u->server->GetName(), u->nick, u->GetRealUserHost(), u->GetAddress(), u->oper->GetType(), extra); return CmdResult::SUCCESS; } diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp index 95bd2fea3..5f39d95fd 100644 --- a/src/modules/m_spanningtree/override_squit.cpp +++ b/src/modules/m_spanningtree/override_squit.cpp @@ -45,7 +45,7 @@ ModResult ModuleSpanningTree::HandleSquit(const CommandBase::Params& parameters, if (s->IsLocal()) { ServerInstance->SNO.WriteToSnoMask('l', "SQUIT: Server \002{}\002 removed from network by {}", parameters[0], user->nick); - s->SQuit("Server quit by " + user->GetFullRealHost()); + s->SQuit("Server quit by " + user->GetRealMask()); } else { diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index d57510bb0..1a9426e8b 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -59,7 +59,7 @@ CmdResult CommandRSQuit::Handle(User* user, const Params& parameters) // We have been asked to remove server_target. const char* reason = parameters.size() == 2 ? parameters[1].c_str() : "No reason"; ServerInstance->SNO.WriteToSnoMask('l', "RSQUIT: Server \002{}\002 removed from network by {} ({})", parameters[0], user->nick, reason); - server_target->SQuit("Server quit by " + user->GetFullRealHost() + " (" + reason + ")"); + server_target->SQuit("Server quit by " + user->GetRealMask() + " (" + reason + ")"); } return CmdResult::SUCCESS; diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 96dfa9fff..7e8ff1383 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -137,7 +137,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params if (dosend) { ServerInstance->SNO.WriteToSnoMask('C', "Client connecting at {}: {} ({}) [{}\x0F]", remoteserver->GetName(), - _new->GetFullRealHost(), _new->GetIPString(), _new->GetRealName()); + _new->GetRealMask(), _new->GetAddress(), _new->GetRealName()); } FOREACH_MOD(OnPostConnect, (_new)); @@ -179,7 +179,7 @@ CommandUID::Builder::Builder(User* user) push(user->GetRealHost()); push(user->GetDisplayedHost()); push(user->ident); - push(user->GetIPString()); + push(user->GetAddress()); push_int(user->signon); push(user->GetModeLetters(true)); push_last(user->GetRealName()); diff --git a/src/modules/m_sqlauth.cpp b/src/modules/m_sqlauth.cpp index 3692c0373..d31ad53b3 100644 --- a/src/modules/m_sqlauth.cpp +++ b/src/modules/m_sqlauth.cpp @@ -70,7 +70,7 @@ public: if (!hashprov) { if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (a provider for {} was not loaded)", user->GetFullRealHost(), kdf); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (a provider for {} was not loaded)", user->GetRealMask(), kdf); pendingExt.Set(user, AUTH_STATE_FAIL); return; } @@ -79,7 +79,7 @@ public: if (!pwcolumn.empty() && !res.HasColumn(pwcolumn, colindex)) { if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (the column specified ({}) was not returned)", user->GetFullRealHost(), pwcolumn); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (the column specified ({}) was not returned)", user->GetRealMask(), pwcolumn); pendingExt.Set(user, AUTH_STATE_FAIL); return; } @@ -95,7 +95,7 @@ public: } if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (password from the SQL query did not match the user provided password)", user->GetFullRealHost()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (password from the SQL query did not match the user provided password)", user->GetRealMask()); pendingExt.Set(user, AUTH_STATE_FAIL); return; } @@ -105,7 +105,7 @@ public: else { if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL query returned no matches)", user->GetFullRealHost()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL query returned no matches)", user->GetRealMask()); pendingExt.Set(user, AUTH_STATE_FAIL); } } @@ -117,7 +117,7 @@ public: return; pendingExt.Set(user, AUTH_STATE_FAIL); if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL query failed: {})", user->GetFullRealHost(), error.ToString()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL query failed: {})", user->GetRealMask(), error.ToString()); } }; @@ -181,7 +181,7 @@ public: if (!SQL) { - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL database not present)", user->GetFullRealHost()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL database not present)", user->GetRealMask()); ServerInstance->Users.QuitUser(user, killreason); return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index f08c99e0c..5341f5c96 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -165,7 +165,7 @@ public: void SetCertificate(User* user, ssl_cert* cert) override { ServerInstance->Logs.Debug(MODNAME, "Setting TLS client certificate for {}: {}", - user->GetFullHost(), sslext.ToNetwork(user, cert)); + user->GetMask(), sslext.ToNetwork(user, cert)); sslext.Set(user, cert); } }; @@ -342,7 +342,7 @@ public: if (!automatic) { ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they are not connected using TLS.", - user->nick, user->MakeHost(), user->GetIPString(), oper->GetName()); + user->nick, user->GetRealUserHost(), user->GetAddress(), oper->GetName()); } return MOD_RES_DENY; } @@ -353,7 +353,7 @@ public: if (!automatic) { ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they are not using the correct TLS client certificate.", - user->nick, user->MakeHost(), user->GetIPString(), oper->GetName()); + user->nick, user->GetRealUserHost(), user->GetAddress(), oper->GetName()); } return MOD_RES_DENY; } diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index 52bb3cec4..3dd38bf89 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -44,14 +44,14 @@ public: for (const auto& [_, u] : ServerInstance->Users.GetUsers()) { - if (InspIRCd::Match(u->GetFullRealHost(), parameters[0])) + if (InspIRCd::Match(u->GetRealMask(), parameters[0])) { n_matched++; n_match_host++; } else { - if (InspIRCd::MatchCIDR(u->MakeHostIP(), parameters[0])) + if (InspIRCd::MatchCIDR(u->GetUserAddress(), parameters[0])) { n_matched++; n_match_ip++; diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index 73255ffab..0777d5c4f 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -45,7 +45,7 @@ public: ModResult OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) override { if (cap.IsEnabled(issuer)) - nick = memb->user->GetFullHost(); + nick = memb->user->GetMask(); return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp index e0af106cc..0ad907c69 100644 --- a/src/modules/m_websocket.cpp +++ b/src/modules/m_websocket.cpp @@ -435,7 +435,7 @@ class WebSocketHook final } for (const auto& proxyrange : config.proxyranges) { - if (InspIRCd::MatchCIDR(luser->GetIPString(), proxyrange, ascii_case_insensitive_map)) + if (InspIRCd::MatchCIDR(luser->GetAddress(), proxyrange, ascii_case_insensitive_map)) { // Give the user their real IP address. if (realsa != luser->client_sa) |
