diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-21 15:54:43 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-21 15:54:43 +0000 |
commit | 6c9a863c019952343ea558e16d3157f8ee575eab (patch) | |
tree | 96e329917e56f1d6b68887abb658f931cdb76449 /src | |
parent | c7ded82dec970bcb817d3ac57303d14e54fdba0d (diff) |
Updated to support services
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@686 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/InspIRCd.layout | 30 | ||||
-rw-r--r-- | src/commands.cpp | 90 | ||||
-rw-r--r-- | src/inspircd.cpp | 1 |
3 files changed, 105 insertions, 16 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 2085a6495..60c14f03f 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,5 +1,5 @@ [Editors] -Focused=-1 +Focused=43 Order=1,2,4,6,3,7,25,5,24,39,42,43,-1 [Editor_0] @@ -13,17 +13,17 @@ LeftChar=1 [Editor_1] Open=1 Top=0 -CursorCol=38 -CursorRow=2731 -TopLine=2686 +CursorCol=44 +CursorRow=2785 +TopLine=2772 LeftChar=1 [Editor_2] Open=1 Top=0 -CursorCol=4 -CursorRow=358 -TopLine=331 +CursorCol=54 +CursorRow=360 +TopLine=357 LeftChar=1 [Editor_3] @@ -287,10 +287,10 @@ TopLine=1 LeftChar=1 [Editor_37] Open=1 -Top=1 -CursorCol=37 -CursorRow=150 -TopLine=119 +Top=0 +CursorCol=47 +CursorRow=156 +TopLine=139 LeftChar=1 [Editor_38] Open=0 @@ -329,10 +329,10 @@ TopLine=16 LeftChar=1 [Editor_43] Open=1 -Top=0 -CursorCol=2 -CursorRow=1095 -TopLine=1115 +Top=1 +CursorCol=23 +CursorRow=2096 +TopLine=2061 LeftChar=1 [Editor_44] Open=0 diff --git a/src/commands.cpp b/src/commands.cpp index c84edf2ea..4c391aeb4 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -2081,6 +2081,17 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve snprintf(buffer,MAXBUF,"+ %s %s %d %d",tcp_host,ipaddr,port,authcookie); NetSendToAllExcept(tcp_host,buffer); break; + // F <TS> + // end netburst with no mesh creation + case 'f': + WriteOpers("Server %s has completed netburst. (%d secs)",tcp_host,time(NULL)-nb_start); + handle_F(token,params,source,reply,tcp_host); + nb_start = 0; + // tell everyone else about the new server name so they just add it in the disconnected + // state + snprintf(buffer,MAXBUF,"u %s :%s",tcp_host,GetServerDescription(tcp_host).c_str()); + NetSendToAllExcept(tcp_host,buffer); + break; // X <reserved> // Send netburst now case 'X': @@ -2101,12 +2112,24 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) { char response[10240]; char token = udp_msg[0]; + + if (token == ':') // leading :servername or details - strip them off (services does this, sucky) + { + while (udp_msg[0] != ' ') + udp_msg++; + udp_msg++; + token = udp_msg[0]; + } + + char* params = udp_msg + 2; char finalparam[1024]; strcpy(finalparam," :xxxx"); if (strstr(udp_msg," :")) { strncpy(finalparam,strstr(udp_msg," :"),1024); } + + if (token == '-') { char* cookie = strtok(params," "); char* servername = strtok(NULL," "); @@ -2310,6 +2333,73 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) return; } else + if (token == 'U') { + // U services.chatspike.net password :ChatSpike Services + // + // non-meshed link, used by services. Everything coming from a non-meshed link is auto broadcasted. + char* servername = strtok(params," "); + char* password = strtok(NULL," "); + char* serverdesc = finalparam+2; + + char Link_ServerName[1024]; + char Link_IPAddr[1024]; + char Link_Port[1024]; + char Link_Pass[1024]; + char Link_SendPass[1024]; + int LinkPort = 0; + + // search for a corresponding <link> block in the config files + for (int i = 0; i < ConfValueEnum("link",&config_f); i++) + { + ConfValue("link","name",i,Link_ServerName,&config_f); + ConfValue("link","ipaddr",i,Link_IPAddr,&config_f); + ConfValue("link","port",i,Link_Port,&config_f); + ConfValue("link","recvpass",i,Link_Pass,&config_f); + ConfValue("link","sendpass",i,Link_SendPass,&config_f); + log(DEBUG,"(%d) Comparing against name='%s', ipaddr='%s', port='%s', recvpass='%s'",i,Link_ServerName,Link_IPAddr,Link_Port,Link_Pass); + LinkPort = atoi(Link_Port); + if (!strcasecmp(Link_ServerName,servername)) + { + // matching link at this end too, we're all done! + // at this point we must begin key exchange and insert this + // server into our 'active' table. + for (int j = 0; j < 32; j++) + { + if (me[j] != NULL) + { + for (int k = 0; k < me[j]->connectors.size(); k++) + { + if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),tcp_host)) + { + char buffer[MAXBUF]; + me[j]->connectors[k].SetDescription(serverdesc); + me[j]->connectors[k].SetServerName(servername); + me[j]->connectors[k].SetState(STATE_CONNECTED); + sprintf(buffer,"X 0"); + serv->SendPacket(buffer,tcp_host); + DoSync(me[j],tcp_host); + NetSendMyRoutingTable(); + return; + } + } + } + WriteOpers("\2WARNING!\2 %s sent us an authentication packet but we are not authenticating with this server right noe! Possible intrusion attempt!",tcp_host); + return; + } + } + else { + log(DEBUG,"Server names '%s' and '%s' don't match",Link_ServerName,servername); + } + } + char buffer[MAXBUF]; + sprintf(buffer,"E :Access is denied (no matching link block)"); + serv->SendPacket(buffer,tcp_host); + WriteOpers("CONNECT from %s denied, no matching link block",servername); + RemoveServer(tcp_host); + RemoveServer(servername); + return; + } + else if (token == 'E') { char* error_message = finalparam+2; WriteOpers("ERROR from %s: %s",tcp_host,error_message); diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 0dd8233cc..ac32b0e92 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2819,7 +2819,6 @@ void DoSync(serverrec* serv, char* tcp_host) serv->SendPacket(data,tcp_host); } } - // send end of sync marker: E <timestamp> snprintf(data,MAXBUF,"F %d",time(NULL)); serv->SendPacket(data,tcp_host); // ircd sends its serverlist after the end of sync here |