- if ((x->Name == servername) && ((ComparePass(this->MakePass(x->RecvPass,this->GetOurChallenge()),password) || x->RecvPass == password && (this->GetTheirChallenge().empty()))))
- {
- /* Check for fully initialized instances of the server by id */
- Instance->Log(DEBUG,"Looking for dupe SID %s", sid.c_str());
- TreeServer* CheckDupeSID = Utils->FindServerID(sid);
- if (CheckDupeSID)
- {
- this->SendError("Server ID "+CheckDupeSID->GetID()+" already exists on server "+CheckDupeSID->GetName()+"!");
- this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, server ID '"+CheckDupeSID->GetID()+
- "' already exists on server "+CheckDupeSID->GetName());
- return false;
- }
- /* Now check for fully initialized instances of the server by name */
- TreeServer* CheckDupe = Utils->FindServer(sname);
- if (CheckDupe)
- {
- this->SendError("Server "+sname+" already exists on server "+CheckDupe->GetParent()->GetName()+"!");
- this->Instance->SNO->WriteToSnoMask('l',"Server connection from \2"+sname+"\2 denied, already exists on server "+CheckDupe->GetParent()->GetName());
- return false;
- }
- this->Instance->SNO->WriteToSnoMask('l',"Verified incoming server connection from \002"+sname+"\002["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] ("+description+")");
- if (this->Hook)
- {
- std::string name = BufferedSocketNameRequest((Module*)Utils->Creator, this->Hook).Send();
- this->Instance->SNO->WriteToSnoMask('l',"Connection from \2"+sname+"\2["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] using transport \2"+name+"\2");
- }
-
- // 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 "+Instance->Config->GetSID()+" :"+this->Instance->Config->ServerDesc);
- // move to the next state, we are now waiting for THEM.
- this->LinkState = WAIT_AUTH_2;
- return true;
- }
+ // Save these for later, so when they accept our credentials (indicated by BURST) we remember them
+ this->capab->hidden = x->Hidden;
+ this->capab->sid = params[3];
+ this->capab->description = params.back();
+ this->capab->name = params[0];
+
+ // Send our details: Our server name and description and hopcount of 0,
+ // along with the sendpass from this block.
+ this->WriteLine("SERVER "+ServerInstance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
+
+ // move to the next state, we are now waiting for THEM.
+ this->LinkState = WAIT_AUTH_2;
+ return true;