]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Mesh tweaks (wasnt sending the ip in the + packet)
[user/henk/code/inspircd.git] / src / inspircd.cpp
index bed1d1be02a68310617012bd03f46b17875a32e3..ca587b58d328649c0a7ff052deac6de4a2784ccc 100644 (file)
@@ -6330,7 +6330,7 @@ void handle_N(char token,char* params,serverrec* source,serverrec* reply, char*
        strncpy(clientlist[nick]->host, host,160);
        strncpy(clientlist[nick]->dhost, dhost,160);
        strncpy(clientlist[nick]->server, server,256);
-       strncpy(clientlist[nick]->ident, ident,10); // +1 char to compensate for '~'
+       strncpy(clientlist[nick]->ident, ident,10); // +1 char to compensate for tilde
        strncpy(clientlist[nick]->fullname, gecos,128);
        clientlist[nick]->signon = TS;
        clientlist[nick]->nping = 0; // this is ignored for a remote user anyway.
@@ -6381,7 +6381,11 @@ void handle_plus(char token,char* params,serverrec* source,serverrec* reply, cha
        char* ipaddr = strtok(NULL," ");
        char* ipport = strtok(NULL," ");
        char* cookie = strtok(NULL," ");
+       log(DEBUG," ");
+       log(DEBUG," ");
+       log(DEBUG,"*** Connecting back to %s:%d",ipaddr,ipport);
        me[defaultRoute]->MeshCookie(ipaddr,atoi(ipport),atoi(cookie),servername);
+       log(DEBUG," ");
 }
 
 
@@ -6454,7 +6458,7 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve
 
                        // give the server its authcookie.
                        snprintf(buffer,MAXBUF,"~ %d",authcookie);
-                       source->SendPacket(data,udp_host);
+                       source->SendPacket(buffer,udp_host);
                        // tell all the other servers to use this authcookie to connect back again
                        snprintf(buffer,MAXBUF,"+ %s %s %d %d",udp_host,ipaddr,port,authcookie);
                        NetSendToAllExcept(udp_host,buffer);
@@ -6614,6 +6618,26 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv)
                        if (auth_cookies[u] == atoi(cookie))
                        {
                                WriteOpers("Allowed cookie from %s, is now part of the mesh",servername);
+
+
+                               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(),udp_host))
+                                                       {
+                                                               me[j]->connectors[k].SetServerName(servername);
+                                                               return;
+                                                       }
+                                               }
+                                       }
+                                       WriteOpers("\2WARNING!\2 %s sent us an authentication packet but we are not authenticating with this server right now! Possible intrusion attempt!",udp_host);
+                                       return;
+                               }
+
+
                                return;
                        }
                }