summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/InspIRCd.layout26
-rw-r--r--src/connection.cpp3
-rw-r--r--src/inspircd.cpp50
3 files changed, 63 insertions, 16 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 19472df8c..61380c1db 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=31
-CursorRow=6996
-TopLine=6969
+Top=1
+CursorCol=1
+CursorRow=7038
+TopLine=7011
LeftChar=1
[Editor_2]
@@ -139,11 +139,11 @@ TopLine=1
LeftChar=1
[Editor_17]
-Open=0
+Open=1
Top=0
CursorCol=20
-CursorRow=128
-TopLine=64
+CursorRow=119
+TopLine=74
LeftChar=1
[Editor_18]
@@ -196,11 +196,11 @@ LeftChar=1
[Editor_24]
Open=1
-Top=1
-CursorCol=94
-CursorRow=175
-TopLine=161
-LeftChar=18
+Top=0
+CursorCol=7
+CursorRow=348
+TopLine=314
+LeftChar=1
[Editor_25]
Open=1
Top=0
diff --git a/src/connection.cpp b/src/connection.cpp
index ad9133031..c003f9ff7 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -366,8 +366,7 @@ bool connection::SendPacket(char *message, const char* host)
cn->CloseConnection();
cn->SetState(STATE_DISCONNECTED);
// retry the packet along a new route so either arrival OR failure are gauranteed (bugfix)
- this->SendPacket(message,host);
- return false;
+ return this->SendPacket(message,host);
}
return true;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index dc57048b1..e9a6bc1ae 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -6714,6 +6714,34 @@ void DoSplit(const char* params)
}
}
+// removes a server. Will NOT remove its users!
+
+void RemoveServer(char* name)
+{
+ bool go_again = true;
+ while (go_again)
+ {
+ go_again = false;
+ for (int i = 0; i < 32; i++)
+ {
+ if (me[i] != NULL)
+ {
+ for (vector<ircd_connector>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++)
+ {
+ if (!strcasecmp(j->GetServerName().c_str(),name))
+ {
+ j->routes.clear();
+ j->CloseConnection();
+ me[i]->connectors.erase(j);
+ go_again = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
void handle_amp(char token,char* params,serverrec* source,serverrec* reply, char* udp_host)
{
log(DEBUG,"Netsplit! %s split from mesh, removing!",params);
@@ -6998,12 +7026,26 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv)
WriteOpers("CONNECT from %s (%s) (their port: %d)",servername,udp_host,atoi(myport));
+ ircd_connector* cn = serv->FindHost(servername);
+
+ if (cn)
+ {
+ WriteOpers("CONNECT aborted: Server %s already exists from %s",servername,ServerName);
+ char buffer[MAXBUF];
+ sprintf(buffer,"E :Server %s already exists!",servername);
+ serv->SendPacket(buffer,udp_host);
+ RemoveServer(udp_host);
+ return;
+ }
+
if (atoi(revision) != GetRevision())
{
- WriteOpers("Could not link to %s, is an incompatible version %s, our version is %d",servername,revision,GetRevision());
+ WriteOpers("CONNECT aborted: Could not link to %s, is an incompatible version %s, our version is %d",servername,revision,GetRevision());
char buffer[MAXBUF];
sprintf(buffer,"E :Version number mismatch");
serv->SendPacket(buffer,udp_host);
+ RemoveServer(udp_host);
+ RemoveServer(servername);
return;
}
@@ -7057,6 +7099,8 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv)
sprintf(buffer,"E :Access is denied (no matching link block)");
serv->SendPacket(buffer,udp_host);
WriteOpers("CONNECT from %s denied, no matching link block",servername);
+ RemoveServer(udp_host);
+ RemoveServer(servername);
return;
}
else
@@ -7127,12 +7171,16 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv)
sprintf(buffer,"E :Access is denied (no matching link block)");
serv->SendPacket(buffer,udp_host);
WriteOpers("CONNECT from %s denied, no matching link block",servername);
+ RemoveServer(udp_host);
+ RemoveServer(servername);
return;
}
else
if (token == 'E') {
char* error_message = finalparam+2;
WriteOpers("ERROR from %s: %s",udp_host,error_message);
+ RemoveServer(udp_host);
+ RemoveServer(servername);
// remove this server from any lists
return;
}