# looking for the error 'Could not assign requested #
# address' in your log when connecting to servers. #
# #
+# hidden - If this is set to true, yes, or 1, then the server #
+# is completely hidden from non-opers. It does not #
+# show in LINKS and it does not show in MAP. Also, #
+# any servers which are child servers of this one #
+# in the network will *also* be hidden. Use with #
+# care! You can use this to 'mask off' sections of #
+# the network so that users only see a small portion #
+# of a much larger net. It should NOT be relied upon #
+# as a security tool, unless it is being used for #
+# example to hide a non-client hub, for which clients #
+# do not have an IP address or resolvable hostname. #
+# #
# to u:line a server (give it extra privilages required for running #
# services, Q, etc) you must include the <uline server> tag as shown #
# in the example below. You can have as many of these as you like. #
timeout="15"
transport="gnutls"
bind="1.2.3.4"
+ hidden="no"
sendpass="outgoing!password"
recvpass="incoming!password">
std::string Hook;
int Timeout;
std::string Bind;
+ bool Hidden;
};
#endif
}
for (unsigned int q = 0; q < Current->ChildCount(); q++)
{
- if ((Utils->HideULines) && (ServerInstance->ULine(Current->GetChild(q)->GetName().c_str())))
+ if ((Current->GetChild(q)->Hidden) || ((Utils->HideULines) && (ServerInstance->ULine(Current->GetChild(q)->GetName().c_str()))))
{
if (*user->oper)
{
}
}
/* Don't display the line if its a uline, hide ulines is on, and the user isnt an oper */
- if ((Utils->HideULines) && (ServerInstance->ULine(Current->GetName().c_str())) && (!*user->oper))
+ if ((Utils->HideULines) && (ServerInstance->ULine(Current->GetName().c_str())) && (!IS_OPER(user)))
return;
- user->WriteServ("364 %s %s %s :%d %s",user->nick,Current->GetName().c_str(),(Utils->FlatLinks && (!*user->oper)) ? ServerInstance->Config->ServerName : Parent.c_str(),(Utils->FlatLinks && (!*user->oper)) ? 0 : hops,Current->GetDesc().c_str());
+ /* Or if the server is hidden and they're not an oper */
+ else if ((Current->Hidden) && (!IS_OPER(user)))
+ return;
+
+ user->WriteServ("364 %s %s %s :%d %s", user->nick,Current->GetName().c_str(),
+ (Utils->FlatLinks && (!IS_OPER(user))) ? ServerInstance->Config->ServerName : Parent.c_str(),
+ (Utils->FlatLinks && (!IS_OPER(user))) ? 0 : hops,
+ Current->GetDesc().c_str());
}
int ModuleSpanningTree::CountLocalServs()
line++;
for (unsigned int q = 0; q < Current->ChildCount(); q++)
{
- if ((Utils->HideULines) && (ServerInstance->ULine(Current->GetChild(q)->GetName().c_str())))
+ if ((Current->GetChild(q)->Hidden) || ((Utils->HideULines) && (ServerInstance->ULine(Current->GetChild(q)->GetName().c_str()))))
{
if (*user->oper)
{
VersionString = "";
UserCount = OperCount = 0;
rtt = LastPing = 0;
+ Hidden = false;
VersionString = ServerInstance->GetVersionString();
}
Route = NULL;
Socket = NULL; /* Fix by brain */
rtt = LastPing = 0;
+ Hidden = false;
AddHashEntry();
}
* This constructor initializes the server's Route and Parent, and sets up
* its ping counters so that it will be pinged one minute from now.
*/
-TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, TreeServer* Above, TreeSocket* Sock)
- : ServerInstance(Instance), Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util)
+TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, TreeServer* Above, TreeSocket* Sock, bool Hide)
+ : ServerInstance(Instance), Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util), Hidden(Hide)
{
VersionString = "";
UserCount = OperCount = 0;
* This constructor initializes the server's Route and Parent, and sets up
* its ping counters so that it will be pinged one minute from now.
*/
- TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, TreeServer* Above, TreeSocket* Sock);
+ TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, TreeServer* Above, TreeSocket* Sock, bool Hide);
int QuitUsers(const std::string &reason);
*/
time_t rtt;
+ /** True if this server is hidden
+ */
+ bool Hidden;
+
/** True if the server answered their last ping
*/
bool AnsweredLastPing();
this->Instance->SNO->WriteToSnoMask('l',"Server \2"+servername+"\2 being introduced from \2" + prefix + "\2 denied, already exists. Closing link with " + prefix);
return false;
}
- TreeServer* Node = new TreeServer(this->Utils,this->Instance,servername,description,ParentOfThis,NULL);
+ Link* lnk = Utils->FindLink(servername);
+ TreeServer* Node = new TreeServer(this->Utils,this->Instance,servername,description,ParentOfThis,NULL, lnk ? lnk->Hidden : false);
ParentOfThis->AddChild(Node);
params[3] = ":" + params[3];
Utils->DoOneToAllButSender(prefix,"SERVER",params,prefix);
// we should add the details of this server now
// to the servers tree, as a child of the root
// node.
- TreeServer* Node = new TreeServer(this->Utils,this->Instance,sname,description,Utils->TreeRoot,this);
+ TreeServer* Node = new TreeServer(this->Utils,this->Instance,sname,description,Utils->TreeRoot,this,x->Hidden);
Utils->TreeRoot->AddChild(Node);
params[3] = ":" + params[3];
Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,sname);
}
}
this->LinkState = CONNECTED;
- Node = new TreeServer(this->Utils,this->Instance,InboundServerName,InboundDescription,Utils->TreeRoot,this);
+ Link* lnk = Utils->FindLink(InboundServerName);
+ Node = new TreeServer(this->Utils,this->Instance, InboundServerName, InboundDescription, Utils->TreeRoot, this, lnk ? lnk->Hidden : false);
Utils->TreeRoot->AddChild(Node);
params.clear();
params.push_back(InboundServerName);
for (int j =0; j < Conf->Enumerate("link"); j++)
{
Link L;
- std::string Allow = Conf->ReadValue("link","allowmask",j);
- L.Name = (Conf->ReadValue("link","name",j)).c_str();
- L.IPAddr = Conf->ReadValue("link","ipaddr",j);
- L.FailOver = Conf->ReadValue("link","failover",j).c_str();
- L.Port = Conf->ReadInteger("link","port",j,true);
- L.SendPass = Conf->ReadValue("link","sendpass",j);
- L.RecvPass = Conf->ReadValue("link","recvpass",j);
- L.AutoConnect = Conf->ReadInteger("link","autoconnect",j,true);
- L.HiddenFromStats = Conf->ReadFlag("link","hidden",j);
- L.Timeout = Conf->ReadInteger("link","timeout",j,true);
+ std::string Allow = Conf->ReadValue("link", "allowmask", j);
+ L.Name = (Conf->ReadValue("link", "name", j)).c_str();
+ L.IPAddr = Conf->ReadValue("link", "ipaddr", j);
+ L.FailOver = Conf->ReadValue("link", "failover", j).c_str();
+ L.Port = Conf->ReadInteger("link", "port", j, true);
+ L.SendPass = Conf->ReadValue("link", "sendpass", j);
+ L.RecvPass = Conf->ReadValue("link", "recvpass", j);
+ L.AutoConnect = Conf->ReadInteger("link", "autoconnect", j, true);
+ L.HiddenFromStats = Conf->ReadFlag("link", "hidden", j);
+ L.Timeout = Conf->ReadInteger("link", "timeout", j, true);
L.Hook = Conf->ReadValue("link", "transport", j);
L.Bind = Conf->ReadValue("link", "bind", j);
+ L.Hidden = Conf->ReadFlag("link", "hidden", j);
if ((!L.Hook.empty()) && (hooks.find(L.Hook.c_str()) == hooks.end()))
{