From 99caa2a956e428096fcd42d5fd3b89aeccb07491 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 19 Apr 2005 03:33:02 +0000 Subject: Added 'server already exists' check for u-type links git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1131 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/commands.cpp b/src/commands.cpp index 40edee6e2..088dabe68 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1490,7 +1490,7 @@ void handle_connect(char **parameters, int pcnt, userrec *user) char Link_Pass[1024]; int LinkPort; bool found = false; - + for (int i = 0; i < ConfValueEnum("link",&config_f); i++) { if (!found) @@ -3082,7 +3082,7 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) char Link_Pass[1024]; char Link_SendPass[1024]; int LinkPort = 0; - + // search for a corresponding block in the config files for (int i = 0; i < ConfValueEnum("link",&config_f); i++) { @@ -3150,6 +3150,26 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) int LinkPort = 0; log(DEBUG,"U-token linked server detected."); + + + 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(),servername)) + { + char buffer[MAXBUF]; + sprintf(buffer,"E :Access is denied (Server exists in the mesh)"); + serv->SendPacket(buffer,tcp_host); + WriteOpers("CONNECT from %s denied, \"%s\" already exists!",tcp_host,servername); + RemoveServer(tcp_host); + return; + } + } + } + } // search for a corresponding block in the config files for (int i = 0; i < ConfValueEnum("link",&config_f); i++) -- cgit v1.2.3