aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-08-20 15:58:54 +0100
committerGravatar Sadie Powell2021-08-20 16:31:47 +0100
commitb1cb8ef3a4a892b4f3d470d0e2380d4cc07d2a44 (patch)
tree21d721b0b4a49ed4dcac19cbc098d51406359ab9 /src
parentRefer to oper names in core_oper as "username" not "login". (diff)
Avoid duplicating User::MakeHostIP.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_oper/cmd_oper.cpp4
-rw-r--r--src/coremods/core_stats.cpp10
-rw-r--r--src/modules/m_customtitle.cpp4
-rw-r--r--src/modules/m_spanningtree/opertype.cpp3
-rw-r--r--src/modules/m_tline.cpp3
-rw-r--r--src/usermanager.cpp2
-rw-r--r--src/users.cpp4
7 files changed, 12 insertions, 18 deletions
diff --git a/src/coremods/core_oper/cmd_oper.cpp b/src/coremods/core_oper/cmd_oper.cpp
index cf4cd6f6f..786e047e1 100644
--- a/src/coremods/core_oper/cmd_oper.cpp
+++ b/src/coremods/core_oper/cmd_oper.cpp
@@ -43,13 +43,11 @@ CmdResult CommandOper::HandleLocal(LocalUser* user, const Params& parameters)
ServerConfig::OperIndex::const_iterator i = ServerInstance->Config->oper_blocks.find(parameters[0]);
if (i != ServerInstance->Config->oper_blocks.end())
{
- const std::string userHost = user->ident + "@" + user->GetRealHost();
- const std::string userIP = user->ident + "@" + user->GetIPString();
std::shared_ptr<OperInfo> ifo = i->second;
std::shared_ptr<ConfigTag> tag = ifo->oper_block;
match_user = true;
match_pass = ServerInstance->PassCompare(user, tag->getString("password"), parameters[1], tag->getString("hash"));
- match_hosts = InspIRCd::MatchMask(tag->getString("host"), userHost, userIP);
+ match_hosts = InspIRCd::MatchMask(tag->getString("host"), user->MakeHost(), user->MakeHostIP());
if (match_pass && match_hosts)
{
diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp
index 4b7043e7f..bb399c630 100644
--- a/src/coremods/core_stats.cpp
+++ b/src/coremods/core_stats.cpp
@@ -81,10 +81,8 @@ void CommandStats::DoStats(Stats::Context& stats)
if (!isPublic && !isRemoteOper && !isLocalOperWithPrivs)
{
- ServerInstance->SNO.WriteToSnoMask('t',
- "%s '%c' denied for %s (%s@%s)",
- (IS_LOCAL(user) ? "Stats" : "Remote stats"),
- statschar, user->nick.c_str(), user->ident.c_str(), user->GetRealHost().c_str());
+ const char* what = IS_LOCAL(user) ? "Stats" : "Remote stats";
+ ServerInstance->SNO.WriteToSnoMask('t', "%s '%c' denied for %s (%s)", what, user->nick.c_str(), user->MakeHost().c_str());
stats.AddRow(481, (std::string("Permission Denied - STATS ") + statschar + " requires the servers/auspex priv."));
return;
}
@@ -92,9 +90,9 @@ void CommandStats::DoStats(Stats::Context& stats)
ModResult res = statsevprov.FirstResult(&Stats::EventListener::OnStats, stats);
if (res == MOD_RES_DENY)
{
+ const char* what = IS_LOCAL(user) ? "Stats" : "Remote stats";
+ ServerInstance->SNO.WriteToSnoMask('t', "%s '%c' denied for %s (%s)", what, user->nick.c_str(), user->MakeHost().c_str());
stats.AddRow(219, statschar, "End of /STATS report");
- ServerInstance->SNO.WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
- (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->GetRealHost().c_str());
return;
}
diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp
index a1af43f5e..3dd168df3 100644
--- a/src/modules/m_customtitle.cpp
+++ b/src/modules/m_customtitle.cpp
@@ -48,9 +48,7 @@ struct CustomTitle
bool MatchUser(User* user) const
{
- const std::string userHost = user->ident + "@" + user->GetRealHost();
- const std::string userIP = user->ident + "@" + user->GetIPString();
- return InspIRCd::MatchMask(host, userHost, userIP);
+ return InspIRCd::MatchMask(host, user->MakeHost(), user->MakeHostIP());
}
bool CheckPass(User* user, const std::string& pass) const
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index 24e818397..066913e0c 100644
--- a/src/modules/m_spanningtree/opertype.cpp
+++ b/src/modules/m_spanningtree/opertype.cpp
@@ -57,7 +57,8 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& para
return CmdResult::SUCCESS;
}
- ServerInstance->SNO.WriteToSnoMask('O', "From %s: User %s (%s@%s) is now a server operator of type %s", u->server->GetName().c_str(), u->nick.c_str(),u->ident.c_str(), u->GetRealHost().c_str(), opertype.c_str());
+ ServerInstance->SNO.WriteToSnoMask('O', "From %s: User %s (%s) is now a server operator of type %s",
+ u->server->GetName().c_str(), u->nick.c_str(), u->MakeHost().c_str(), opertype.c_str());
return CmdResult::SUCCESS;
}
diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp
index f058cace3..f9e98b08e 100644
--- a/src/modules/m_tline.cpp
+++ b/src/modules/m_tline.cpp
@@ -49,8 +49,7 @@ class CommandTline : public Command
}
else
{
- std::string host = u->ident + "@" + u->GetIPString();
- if (InspIRCd::MatchCIDR(host, parameters[0]))
+ if (InspIRCd::MatchCIDR(u->MakeHostIP(), parameters[0]))
{
n_matched++;
n_match_ip++;
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index c45e5cda9..3970db722 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -272,7 +272,7 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std
ServerInstance->Logs.Log("USERS", LOG_DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitmessage.c_str());
if (localuser)
{
- ClientProtocol::Messages::Error errormsg(InspIRCd::Format("Closing link: (%s@%s) [%s]", user->ident.c_str(), user->GetRealHost().c_str(), operquitmsg.c_str()));
+ ClientProtocol::Messages::Error errormsg(InspIRCd::Format("Closing link: (%s) [%s]", user->MakeHost().c_str(), operquitmsg.c_str()));
localuser->Send(ServerInstance->GetRFCEvents().error, errormsg);
}
diff --git a/src/users.cpp b/src/users.cpp
index 8641c0d45..5110d600e 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -393,8 +393,8 @@ void User::Oper(std::shared_ptr<OperInfo> info)
if (info->oper_block)
opername = info->oper_block->getString("name");
- ServerInstance->SNO.WriteToSnoMask('o', "%s (%s@%s) is now a server operator of type %s (using oper '%s')",
- nick.c_str(), ident.c_str(), GetRealHost().c_str(), oper->name.c_str(), opername.c_str());
+ ServerInstance->SNO.WriteToSnoMask('o', "%s (%s) is now a server operator of type %s (using oper '%s')",
+ nick.c_str(), MakeHost().c_str(), oper->name.c_str(), opername.c_str());
this->WriteNumeric(RPL_YOUAREOPER, InspIRCd::Format("You are now %s %s", strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->name.c_str()));
ServerInstance->Users.all_opers.push_back(this);