From 02173f727f5cd7c97f3faba9f044fa2e81c3fdcc Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 18 Apr 2004 15:30:59 +0000 Subject: Added back authorised state checking in server/server links (untested!) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@643 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/InspIRCd.layout | 20 ++++++++++---------- src/inspircd.cpp | 33 +++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index f7e388107..2232312fe 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,5 +1,5 @@ [Editors] -Focused=24 +Focused=1 Order=1,2,4,6,3,7,25,5,24,-1 [Editor_0] @@ -12,10 +12,10 @@ LeftChar=1 [Editor_1] Open=1 -Top=0 -CursorCol=2 -CursorRow=6673 -TopLine=6641 +Top=1 +CursorCol=37 +CursorRow=6901 +TopLine=7059 LeftChar=1 [Editor_2] @@ -23,7 +23,7 @@ Open=1 Top=0 CursorCol=8 CursorRow=278 -TopLine=270 +TopLine=1 LeftChar=1 [Editor_3] @@ -31,7 +31,7 @@ Open=1 Top=0 CursorCol=3 CursorRow=81 -TopLine=2 +TopLine=28 LeftChar=1 [Editor_4] @@ -196,9 +196,9 @@ LeftChar=1 [Editor_24] Open=1 -Top=1 -CursorCol=96 -CursorRow=132 +Top=0 +CursorCol=27 +CursorRow=134 TopLine=102 LeftChar=1 [Editor_25] diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 874f9b9ff..d9e9169cd 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -6897,8 +6897,8 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) char* params = udp_msg + 2; char finalparam[1024]; strcpy(finalparam," :xxxx"); - if (strstr(params," :")) { - strncpy(finalparam,strstr(params," :"),1024); + if (strstr(udp_msg," :")) { + strncpy(finalparam,strstr(udp_msg," :"),1024); } if (token == '-') { char* cookie = strtok(params," "); @@ -6923,6 +6923,7 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),udp_host)) { me[j]->connectors[k].SetServerName(servername); + me[j]->connectors[k].SetState(STATE_CONNECTED); NetSendMyRoutingTable(); return; } @@ -6982,6 +6983,15 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) // send a 'diminutive' server message back... snprintf(response,10240,"s %s %s :%s",ServerName,Link_SendPass,ServerDesc); serv->SendPacket(response,servername); + + for (int t = 0; t < serv->connectors.size(); t++) + { + if (!strcasecmp(serv->connectors[t].GetServerName().c_str(),servername)) + { + serv->connectors[t].SetState(STATE_CONNECTED); + } + } + return; } } @@ -7003,9 +7013,6 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) // to an 'S' command. If we didn't recently send an 'S' to this server, theyre trying to spoof // a connect, so put out an oper alert! - - - // for now, just accept all, we'll fix that later. WriteOpers("%s accepted our link credentials ",servername); @@ -7040,6 +7047,7 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),udp_host)) { char buffer[MAXBUF]; + me[j]->connectors[k].SetState(STATE_CONNECTED); sprintf(buffer,"X 0"); serv->SendPacket(buffer,udp_host); DoSync(me[j],udp_host); @@ -7082,12 +7090,12 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) log(DEBUG,"Servers are: '%s' '%s'",udp_host,me[j]->connectors[x].GetServerName().c_str()); if (!strcasecmp(me[j]->connectors[x].GetServerName().c_str(),udp_host)) { - log(DEBUG,"match! process restricted stuff here"); - // found a valid ircd_connector. - // TODO: Fix this so it only lets servers in that are in the - // STATE_CONNECTED state!!! - process_restricted_commands(token,params,me[j],serv,udp_host,me[j]->connectors[x].GetServerIP(),me[j]->connectors[x].GetServerPort()); - return; + if (me[j]->connectors[x].GetState() == STATE_CONNECTED) + { + // found a valid ircd_connector. + process_restricted_commands(token,params,me[j],serv,udp_host,me[j]->connectors[x].GetServerIP(),me[j]->connectors[x].GetServerPort()); + return; + } } } } @@ -7453,7 +7461,8 @@ int InspIRCd(void) if (result) { - log(DEBUG,"Read %d characters from socket",result); + if (result > 0) + log(DEBUG,"Read %d characters from socket",result); userrec* current = count2a->second; int currfd = current->fd; char* l = strtok(data,"\n"); -- cgit v1.2.3