TreeServer* recursive_server = Current->GetChild(q);
if (recursive_server != s)
{
- snprintf(command,1024,":%s SERVER %s * %d :%s",Current->GetName().c_str(),recursive_server->GetName().c_str(),hops,recursive_server->GetDesc().c_str());
+ snprintf(command,1024,":%s SERVER %s * %d %s :%s",Current->GetName().c_str(),recursive_server->GetName().c_str(),hops,
+ recursive_server->GetID().c_str(),
+ recursive_server->GetDesc().c_str());
this->WriteLine(command);
this->WriteLine(":"+recursive_server->GetName()+" VERSION :"+recursive_server->GetVersion());
/* down to next level */
}
else if (params[0] == "END")
{
+ std::string OurSID;
+
+ OurSID += (char)((Instance->Config->sid / 100) + 48);
+ OurSID += (char)((Instance->Config->sid / 10) % 10 + 48);
+ OurSID += (char)(Instance->Config->sid % 10 + 48);
+
std::string reason;
int ip6support = 0;
#ifdef SUPPORT_IP6LINKS
this->SetTheirChallenge(n->second);
if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING))
{
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 "+
+ OurSID+" :"+this->Instance->Config->ServerDesc);
}
}
else
{
/* They didnt specify a challenge or we don't have m_sha256.so, we use plaintext */
if (this->LinkState == CONNECTING)
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+OutboundPass+" 0 :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+OutboundPass+" 0 "+OurSID+" :"+this->Instance->Config->ServerDesc);
}
if (reason.length())
bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> ¶ms)
{
- if (params.size() < 4)
+ if (params.size() < 5)
return false;
std::string servername = params[0];
std::string password = params[1];
// hopcount is not used for a remote server, we calculate this ourselves
- std::string description = params[3];
+ std::string sid = params[3];
+ std::string description = params[4];
TreeServer* ParentOfThis = Utils->FindServer(prefix);
if (!ParentOfThis)
{
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];
+ Node->SetID(sid);
+ params[4] = ":" + params[4];
Utils->SetRemoteBursting(Node, true);
Utils->DoOneToAllButSender(prefix,"SERVER",params,prefix);
this->Instance->SNO->WriteToSnoMask('l',"Server \002"+prefix+"\002 introduced server \002"+servername+"\002 ("+description+")");
bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms)
{
- if (params.size() < 4)
+ if (params.size() < 5)
return false;
irc::string servername = params[0].c_str();
std::string sname = params[0];
std::string password = params[1];
- std::string description = params[3];
+ std::string sid = params[3];
+ std::string description = params[4];
int hops = atoi(params[2].c_str());
this->InboundServerName = sname;
this->InboundDescription = description;
+ this->InboundSID = sid;
if (!sentcapab)
this->SendCapabilities();
// node.
TreeServer* Node = new TreeServer(this->Utils,this->Instance,sname,description,Utils->TreeRoot,this,x->Hidden);
Utils->TreeRoot->AddChild(Node);
- params[3] = ":" + params[3];
+ params[4] = ":" + params[4];
+ Node->SetID(params[3]);
Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,sname);
this->bursting = true;
this->DoBurst(Node);
bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms)
{
- if (params.size() < 4)
+ if (params.size() < 5)
return false;
irc::string servername = params[0].c_str();
std::string sname = params[0];
std::string password = params[1];
- std::string description = params[3];
+ std::string sid = params[3];
+ std::string description = params[4];
+ std::string OurSID;
int hops = atoi(params[2].c_str());
this->InboundServerName = sname;
this->InboundDescription = description;
+ this->InboundSID = sid;
+
+ OurSID += (char)((Instance->Config->sid / 100) + 48);
+ OurSID += (char)((Instance->Config->sid / 10) % 10 + 48);
+ OurSID += (char)(Instance->Config->sid % 10 + 48);
if (!sentcapab)
this->SendCapabilities();
// this is good. Send our details: Our server name and description and hopcount of 0,
// along with the sendpass from this block.
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+OurSID+" :"+this->Instance->Config->ServerDesc);
// move to the next state, we are now waiting for THEM.
this->LinkState = WAIT_AUTH_2;
return true;
params.push_back(InboundServerName);
params.push_back("*");
params.push_back("1");
+ params.push_back(InboundSID);
params.push_back(":"+InboundDescription);
+ Node->SetID(InboundSID);
Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,InboundServerName);
this->bursting = true;
this->DoBurst(Node);