aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-10-25 22:40:13 +0100
committerGravatar Sadie Powell2021-10-25 23:02:28 +0100
commitbeaae760bd7fb0afa05bc3fd7682e085b14b2930 (patch)
tree0b24ff90cc345b6869840dd610ae47935c094cfe /src
parentRespect <security:hideserver> in the 005 numeric. (diff)
downloadinspircd++-beaae760bd7fb0afa05bc3fd7682e085b14b2930.tar.gz
inspircd++-beaae760bd7fb0afa05bc3fd7682e085b14b2930.tar.bz2
inspircd++-beaae760bd7fb0afa05bc3fd7682e085b14b2930.zip
Add Server::GetPublicName(), fix not respecting <security:hideserver>.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_info/cmd_servlist.cpp2
-rw-r--r--src/coremods/core_message.cpp4
-rw-r--r--src/coremods/core_whowas.cpp2
-rw-r--r--src/modules/m_ircv3_ctctags.cpp2
-rw-r--r--src/modules/m_serverban.cpp2
-rw-r--r--src/server.cpp7
-rw-r--r--src/users.cpp6
7 files changed, 15 insertions, 10 deletions
diff --git a/src/coremods/core_info/cmd_servlist.cpp b/src/coremods/core_info/cmd_servlist.cpp
index 65dae7b8b..cb2267bfb 100644
--- a/src/coremods/core_info/cmd_servlist.cpp
+++ b/src/coremods/core_info/cmd_servlist.cpp
@@ -52,7 +52,7 @@ CmdResult CommandServList::HandleLocal(LocalUser* user, const Params& parameters
Numeric::Numeric numeric(RPL_SERVLIST);
numeric
.push(uline->nick)
- .push(uline->server->GetName())
+ .push(uline->server->GetPublicName())
.push("*")
.push(uline->IsOper() ? uline->oper->name : "*")
.push(0)
diff --git a/src/coremods/core_message.cpp b/src/coremods/core_message.cpp
index 57d813d9b..4592bc52b 100644
--- a/src/coremods/core_message.cpp
+++ b/src/coremods/core_message.cpp
@@ -223,7 +223,7 @@ class CommandMessage : public Command
{
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->FindNickOnly(parameters[0].substr(0, targetserver - parameters[0].c_str()));
- if (target && strcasecmp(target->server->GetName().c_str(), targetserver + 1))
+ if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1))
target = NULL;
}
else
@@ -358,7 +358,7 @@ class CommandSQuery : public SplitCommand
{
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->FindNickOnly(parameters[0].substr(0, targetserver - parameters[0].c_str()));
- if (target && strcasecmp(target->server->GetName().c_str(), targetserver + 1))
+ if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1))
target = NULL;
}
else
diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp
index 82438287f..da56f156a 100644
--- a/src/coremods/core_whowas.cpp
+++ b/src/coremods/core_whowas.cpp
@@ -394,7 +394,7 @@ WhoWas::Entry::Entry(User* user)
: host(user->GetRealHost())
, dhost(user->GetDisplayedHost())
, ident(user->ident)
- , server(user->server->GetName())
+ , server(user->server->GetPublicName())
, real(user->GetRealName())
, signon(user->signon)
{
diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp
index 8dd83bd7f..2a692bf49 100644
--- a/src/modules/m_ircv3_ctctags.cpp
+++ b/src/modules/m_ircv3_ctctags.cpp
@@ -163,7 +163,7 @@ class CommandTagMsg : public Command
{
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->FindNickOnly(parameters[0].substr(0, targetserver - parameters[0].c_str()));
- if (target && strcasecmp(target->server->GetName().c_str(), targetserver + 1))
+ if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1))
target = NULL;
}
else
diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp
index e4c70284c..5c7df8d23 100644
--- a/src/modules/m_serverban.cpp
+++ b/src/modules/m_serverban.cpp
@@ -37,7 +37,7 @@ class ModuleServerBan : public Module
{
if ((mask.length() > 2) && (mask[0] == 's') && (mask[1] == ':'))
{
- if (InspIRCd::Match(user->server->GetName(), mask.substr(2)))
+ if (InspIRCd::Match(user->server->GetPublicName(), mask.substr(2)))
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;
diff --git a/src/server.cpp b/src/server.cpp
index dbc51e37c..46e7d6567 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -162,6 +162,13 @@ std::string UIDGenerator::GetUID()
return current_uid;
}
+const std::string& Server::GetPublicName() const
+{
+ if (!ServerInstance->Config->HideServer.empty())
+ return ServerInstance->Config->HideServer;
+ return GetName();
+}
+
void ISupportManager::AppendValue(std::string& buffer, const std::string& value)
{
// If this token has no value then we have nothing to do.
diff --git a/src/users.cpp b/src/users.cpp
index 60014d297..4e91c31d1 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1249,14 +1249,12 @@ void User::WriteNotice(const std::string& text)
const std::string& FakeUser::GetFullHost()
{
- if (!ServerInstance->Config->HideServer.empty())
- return ServerInstance->Config->HideServer;
- return server->GetName();
+ return server->GetPublicName();
}
const std::string& FakeUser::GetFullRealHost()
{
- return GetFullHost();
+ return server->GetPublicName();
}
ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask)