]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/treesocket2.cpp
Add IP address conversion utility functions, irc::sockets::aptosa and irc::sockets...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket2.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
17 #include "socket.h"
18 #include "xline.h"
19 #include "transport.h"
20 #include "socketengine.h"
21
22 #include "m_spanningtree/main.h"
23 #include "m_spanningtree/utils.h"
24 #include "m_spanningtree/treeserver.h"
25 #include "m_spanningtree/link.h"
26 #include "m_spanningtree/treesocket.h"
27 #include "m_spanningtree/resolvers.h"
28 #include "m_spanningtree/handshaketimer.h"
29
30 /* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/handshaketimer.h */
31
32 void TreeSocket::WriteLine(std::string line)
33 {
34         ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] O %s", this->GetFd(), line.c_str());
35         line.append("\r\n");
36         this->Write(line);
37 }
38
39
40 /* Handle ERROR command */
41 bool TreeSocket::Error(std::deque<std::string> &params)
42 {
43         if (params.size() < 1)
44                 return false;
45         this->ServerInstance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str());
46         /* we will return false to cause the socket to close. */
47         return false;
48 }
49
50 void TreeSocket::Split(const std::string &line, std::deque<std::string> &n)
51 {
52         n.clear();
53         irc::tokenstream tokens(line);
54         std::string param;
55         while (tokens.GetToken(param))
56         {
57                 n.push_back(param);
58         }
59         return;
60 }
61
62 bool TreeSocket::ProcessLine(std::string &line)
63 {
64         std::deque<std::string> params;
65         irc::string command;
66         std::string prefix;
67
68         line = line.substr(0, line.find_first_of("\r\n"));
69
70         if (line.empty())
71                 return true;
72
73         ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str());
74
75         this->Split(line.c_str(),params);
76
77         if (params.empty())
78                 return true;
79
80         if ((params[0][0] == ':') && (params.size() > 1))
81         {
82                 prefix = params[0].substr(1);
83                 params.pop_front();
84
85                 if (prefix.empty())
86                 {
87                         this->SendError("BUG (?) Empty prefix recieved.");
88                         return false;
89                 }
90         }
91
92         command = params[0].c_str();
93         params.pop_front();
94
95         switch (this->LinkState)
96         {
97                 TreeServer* Node;
98
99                 case WAIT_AUTH_1:
100                         /*
101                          * State WAIT_AUTH_1:
102                          *  Waiting for SERVER command from remote server. Server initiating
103                          *  the connection sends the first SERVER command, listening server
104                          *  replies with theirs if its happy, then if the initiator is happy,
105                          *  it starts to send its net sync, which starts the merge, otherwise
106                          *  it sends an ERROR.
107                          */
108                         if (command == "PASS")
109                         {
110                                 /*
111                                  * Ignore this silently. Some services packages insist on sending PASS, even
112                                  * when it is not required (i.e. by us). We have to ignore this here, otherwise
113                                  * as it's an unknown command (effectively), it will cause the connection to be
114                                  * closed, which probably isn't what people want. -- w00t
115                                  */
116                         }
117                         else if (command == "SERVER")
118                         {
119                                 return this->Inbound_Server(params);
120                         }
121                         else if (command == "ERROR")
122                         {
123                                 return this->Error(params);
124                         }
125                         else if (command == "USER")
126                         {
127                                 this->SendError("Client connections to this port are prohibited.");
128                                 return false;
129                         }
130                         else if (command == "CAPAB")
131                         {
132                                 return this->Capab(params);
133                         }
134                         else
135                         {
136                                 // XXX ...wtf.
137                                 irc::string error = "Invalid command in negotiation phase: " + command;
138                                 this->SendError(assign(error));
139                                 return false;
140                         }
141                 break;
142                 case WAIT_AUTH_2:
143                         /*
144                          * State WAIT_AUTH_2:
145                          *  We have sent SERVER to the other side of the connection. Now we're waiting for them to start BURST.
146                          *  The other option at this stage of things, of course, is for them to close our connection thanks
147                          *  to invalid credentials.. -- w
148                          */
149                         if (command == "SERVER")
150                         {
151                                 /*
152                                  * Connection is either attempting to re-auth itself (stupid) or sending netburst without sending BURST.
153                                  * Both of these aren't allowable, so block them here. -- w
154                                  */
155                                 this->SendError("You may not re-authenticate or commence netburst without sending BURST.");
156                                 return true;
157                         }
158                         else if (command == "BURST")
159                         {
160                                 if (params.size())
161                                 {
162                                         time_t them = atoi(params[0].c_str());
163                                         time_t delta = them - ServerInstance->Time();
164                                         if ((delta < -600) || (delta > 600))
165                                         {
166                                                 ServerInstance->SNO->WriteToSnoMask('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs((long)delta));
167                                                 SendError("Your clocks are out by "+ConvToStr(abs((long)delta))+" seconds (this is more than five minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!");
168                                                 return false;
169                                         }
170                                         else if ((delta < -30) || (delta > 30))
171                                         {
172                                                 ServerInstance->SNO->WriteToSnoMask('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta));
173                                         }
174                                 }
175                                 this->LinkState = CONNECTED;
176
177                                 Utils->timeoutlist.erase(this);
178
179                                 Link* lnk = Utils->FindLink(InboundServerName);
180
181                                 Node = new TreeServer(this->Utils, this->ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false);
182
183                                 Utils->TreeRoot->AddChild(Node);
184                                 parameterlist sparams;
185                                 sparams.push_back(InboundServerName);
186                                 sparams.push_back("*");
187                                 sparams.push_back("1");
188                                 sparams.push_back(InboundSID);
189                                 sparams.push_back(":"+InboundDescription);
190                                 Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",sparams,InboundServerName);
191                                 Utils->DoOneToAllButSenderRaw(line, InboundServerName, prefix, command, params);
192                                 Node->bursting = true;
193                                 this->DoBurst(Node);
194                         }
195                         else if (command == "ERROR")
196                         {
197                                 return this->Error(params);
198                         }
199                         else if (command == "CAPAB")
200                         {
201                                 return this->Capab(params);
202                         }
203
204                 break;
205                 case CONNECTING:
206                         /*
207                          * State CONNECTING:
208                          *  We're connecting (OUTGOING) to another server. They are in state WAIT_AUTH_1 until they verify
209                          *  our credentials, when they proceed into WAIT_AUTH_2 and send SERVER to us. We then send BURST
210                          *  + our netburst, which will put them into CONNECTED state. -- w
211                          */
212                         if (command == "SERVER")
213                         {
214                                 // Our credentials have been accepted, send netburst. (this puts US into the CONNECTED state)
215                                 return this->Outbound_Reply_Server(params);
216                         }
217                         else if (command == "ERROR")
218                         {
219                                 return this->Error(params);
220                         }
221                         else if (command == "CAPAB")
222                         {
223                                 return this->Capab(params);
224                         }
225                 break;
226                 case CONNECTED:
227                         /*
228                         * State CONNECTED:
229                          *  Credentials have been exchanged, we've gotten their 'BURST' (or sent ours).
230                          *  Anything from here on should be accepted a little more reasonably.
231                          */
232                         if (!prefix.empty())
233                         {
234                                 /*
235                                  * Check for fake direction here, and drop any instances that are found.
236                                  * What is fake direction? Imagine the following server setup:
237                                  *    0AA <-> 0AB <-> 0AC
238                                  * Fake direction would be 0AC sending a message to 0AB claiming to be from
239                                  * 0AA, or something similar. Basically, a message taking a path that *cannot*
240                                  * be correct.
241                                  *
242                                  * When would this be seen?
243                                  * Well, hopefully never. It could be caused by race conditions, bugs, or
244                                  * "miscreant" servers, though, so let's check anyway. -- w
245                                  *
246                                  * We also check here for totally invalid prefixes (prefixes that are neither
247                                  * a valid SID or a valid UUID, so that invalid UUID or SID never makes it
248                                  * to the higher level functions. -- B
249                                  */
250                                 std::string direction = prefix;
251
252                                 User *t = this->ServerInstance->FindUUID(prefix);
253                                 if (t)
254                                 {
255                                         /* Find UID */
256                                         direction = t->server;
257                                 }
258                                 else if (!this->Utils->FindServer(direction))
259                                 {
260                                         /* Find SID */
261                                         ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Protocol violation: Invalid prefix '%s' from connection '%s'", direction.c_str(), this->GetName().c_str());
262                                         return true;
263                                 }
264
265                                 TreeServer* route_back_again = Utils->BestRouteTo(direction);
266                                 if ((!route_back_again) || (route_back_again->GetSocket() != this))
267                                 {
268                                         if (route_back_again)
269                                                 ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str());
270                                         return true;
271                                 }
272                         }
273                         else
274                         {
275                                 /*
276                                  * Empty prefix from a server to server link:
277                                  *  This is somewhat bad/naughty, so let's set the prefix
278                                  *  to be the link that we got it from, so we don't break anything. -- w
279                                  */
280                                 TreeServer* n = Utils->FindServer(GetName());
281                                 if (n)
282                                         prefix = n->GetID();
283                                 else
284                                         prefix = GetName();
285                         }
286
287                         /*
288                          * First up, check for any malformed commands (e.g. MODE without a timestamp)
289                          * and rewrite commands where necessary (SVSMODE -> MODE for services). -- w
290                          */
291                         if (command == "SVSMODE") // This isn't in an "else if" so we still force FMODE for changes on channels.
292                                 command = "MODE";
293
294                         /*
295                          * Now, check for (and parse) commands as appropriate. -- w
296                          */
297
298                         /* Find the server that this command originated from, used in the handlers below */
299                         TreeServer *ServerSource = Utils->FindServer(prefix);
300
301                         /* Find the link we just got this from so we don't bounce it back incorrectly */
302                         std::string sourceserv = this->myhost;
303                         if (!this->InboundServerName.empty())
304                         {
305                                 sourceserv = this->InboundServerName;
306                         }
307
308                         /*
309                          * XXX one of these days, this needs to be moved into class Commands.
310                          */
311                         if (command == "UID")
312                         {
313                                 return this->ParseUID(prefix, params);
314                         }
315                         else if (command == "FJOIN")
316                         {
317                                 return this->ForceJoin(prefix,params);
318                         }
319                         else if ((command == "NOTICE" || command == "PRIVMSG") && (Utils->IsServer(prefix)))
320                         {
321                                 return this->ServerMessage(assign(command), prefix, params, sourceserv);
322                         }
323                         else if (command == "STATS")
324                         {
325                                 return this->Stats(prefix, params);
326                         }
327                         else if (command == "MOTD")
328                         {
329                                 return this->Motd(prefix, params);
330                         }
331                         else if (command == "KILL" && ServerSource)
332                         {
333                                 // Kill from a server
334                                 return this->RemoteKill(prefix,params);
335                         }
336                         else if (command == "MODULES")
337                         {
338                                 return this->Modules(prefix, params);
339                         }
340                         else if (command == "ADMIN")
341                         {
342                                 return this->Admin(prefix, params);
343                         }
344                         else if (command == "MAP")
345                         {
346                                 User* user = ServerInstance->FindNick(prefix);
347                                 if (user)
348                                 {
349                                         std::vector<std::string> p(params.begin(), params.end());
350                                         return Utils->Creator->HandleMap(p, user);
351                                 }
352                         }
353                         else if (command == "SERVER")
354                         {
355                                 return this->RemoteServer(prefix,params);
356                         }
357                         else if (command == "ERROR")
358                         {
359                                 return this->Error(params);
360                         }
361                         else if (command == "OPERTYPE")
362                         {
363                                 return this->OperType(prefix,params);
364                         }
365                         else if (command == "FMODE")
366                         {
367                                 return this->ForceMode(prefix,params);
368                         }
369                         else if (command == "FTOPIC")
370                         {
371                                 return this->ForceTopic(prefix,params);
372                         }
373                         else if (command == "METADATA")
374                         {
375                                 return this->MetaData(prefix,params);
376                         }
377                         else if (command == "PING")
378                         {
379                                 return this->LocalPing(prefix,params);
380                         }
381                         else if (command == "PONG")
382                         {
383                                 TreeServer *s = Utils->FindServer(prefix);
384                                 if (s && s->bursting)
385                                 {
386                                         ServerInstance->SNO->WriteToSnoMask('l',"Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", prefix.c_str());
387                                         s->FinishBurst();
388                                 }
389                                 return this->LocalPong(prefix,params);
390                         }
391                         else if (command == "VERSION")
392                         {
393                                 return this->ServerVersion(prefix,params);
394                         }
395                         else if (command == "FHOST")
396                         {
397                                 return this->ChangeHost(prefix,params);
398                         }
399                         else if (command == "FNAME")
400                         {
401                                 return this->ChangeName(prefix,params);
402                         }
403                         else if (command == "ADDLINE")
404                         {
405                                 return this->AddLine(prefix,params);
406                         }
407                         else if (command == "DELLINE")
408                         {
409                                 return this->DelLine(prefix,params);
410                         }
411                         else if (command == "SVSNICK")
412                         {
413                                 return this->ForceNick(prefix,params);
414                         }
415                         else if (command == "OPERQUIT")
416                         {
417                                 return this->OperQuit(prefix,params);
418                         }
419                         else if (command == "IDLE")
420                         {
421                                 return this->Whois(prefix,params);
422                         }
423                         else if (command == "PUSH")
424                         {
425                                 return this->Push(prefix,params);
426                         }
427                         else if (command == "TIME")
428                         {
429                                 return this->Time(prefix,params);
430                         }
431                         else if ((command == "KICK") && (Utils->IsServer(prefix)))
432                         {
433                                 if (params.size() == 3)
434                                 {
435                                         TreeServer* pf = Utils->FindServer(prefix);
436                                         if (pf)
437                                         {
438                                                 irc::commasepstream nicks(params[1]);
439                                                 std::string nick;
440                                                 Channel* chan = this->ServerInstance->FindChan(params[0]);
441                                                 if (chan)
442                                                 {
443                                                         while (nicks.GetToken(nick))
444                                                         {
445                                                                 User* user = this->ServerInstance->FindNick(nick);
446                                                                 if (user)
447                                                                 {
448                                                                         if (!chan->ServerKickUser(user, params[2].c_str(), pf->GetName().c_str()))
449                                                                                 /* Yikes, the channels gone! */
450                                                                                 delete chan;
451                                                                 }
452                                                         }
453                                                 }
454                                         }
455                                 }
456
457                                 return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params);
458                         }
459                         else if (command == "SVSJOIN")
460                         {
461                                 return this->ServiceJoin(prefix,params);
462                         }
463                         else if (command == "SVSPART")
464                         {
465                                 return this->ServicePart(prefix,params);
466                         }
467                         else if (command == "SQUIT")
468                         {
469                                 if (params.size() == 2)
470                                 {
471                                         this->Squit(Utils->FindServer(params[0]),params[1]);
472                                 }
473                                 return true;
474                         }
475                         else if (command == "MODENOTICE")
476                         {
477                                 if (params.size() >= 2)
478                                 {
479                                         if (ServerSource)
480                                                 ServerInstance->Users->WriteMode(params[0].c_str(), WM_AND, "*** From %s: %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str()), params[1].c_str());
481                                 }
482                                 return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params);
483                         }
484                         else if (command == "SNONOTICE")
485                         {
486                                 if (params.size() >= 2)
487                                 {
488                                         std::string oldprefix;
489                                         if (!ServerSource)
490                                         {
491                                                 oldprefix = prefix;
492                                                 User *u = ServerInstance->FindNick(prefix);
493                                                 if (!u)
494                                                         return true;
495                                                 prefix = u->nick;
496                                         }
497
498                                         ServerInstance->SNO->WriteToSnoMask(*(params[0].c_str()), "From " + (ServerSource ? ServerSource->GetName().c_str() : prefix) + ": "+ params[1]);
499                                         prefix = oldprefix;
500                                         return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params);
501                                 }
502
503                         }
504                         else if (command == "BURST")
505                         {
506                                 // Set prefix server as bursting
507                                 if (!ServerSource)
508                                 {
509                                         this->ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got BURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str()));
510                                         return false;
511                                 }
512
513                                 ServerSource->bursting = true;
514                                 return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params);
515                         }
516                         else if (command == "ENDBURST")
517                         {
518                                 if (!ServerSource)
519                                 {
520                                         this->ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got ENDBURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str()));
521                                         return false;
522                                 }
523
524                                 ServerSource->FinishBurst();
525                                 return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params);
526                         }
527                         else if (command == "ENCAP")
528                         {
529                                 return this->Encap(prefix, params);
530                         }
531                         else if (command == "MODE" && !this->ServerInstance->FindUUID(prefix)) // XXX we should check for no such serv?
532                         {
533                                 // Server-prefix MODE.
534                                 std::vector<std::string> modelist(params.begin(), params.end());
535
536                                 /* We don't support this for channel mode changes any more! */
537                                 if (params.size() >= 1)
538                                 {
539                                         if (ServerInstance->FindChan(params[0]))
540                                         {
541                                                 this->SendError("Protocol violation by '"+(ServerSource ? ServerSource->GetName().c_str() : prefix)+"'! MODE for channel mode changes is not supported by the InspIRCd 1.2 protocol. You must use FMODE to preserve channel timestamps.");
542                                                 return false;
543                                         }
544                                 }
545
546                                 // Insert into the parser
547                                 this->ServerInstance->SendMode(modelist, this->ServerInstance->FakeClient);
548
549                                 // Pass out to the network
550                                 return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params);
551                         }
552                         else
553                         {
554                                 /*
555                                  * Not a special s2s command. Emulate the user doing it.
556                                  * This saves us having a huge ugly command parser again.
557                                  */
558                                 User* who = this->ServerInstance->FindUUID(prefix);
559
560                                 if (!who)
561                                 {
562                                         /* this looks ugly because command is an irc::string
563                                          * It is important that we dont close the link here, unknown prefix can occur
564                                          * due to various race conditions such as the KILL message for a user somehow
565                                          * crossing the users QUIT further upstream from the server. Thanks jilles!
566                                          */
567                                         ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Command " + std::string(command.c_str()) + " from unknown prefix " + prefix + "! Dropping entire command.");
568                                         return true;
569                                 }
570
571                                 if (command == "NICK")
572                                 {
573                                         if (params.size() != 2)
574                                         {
575                                                 SendError("Protocol violation: NICK message without TS - :"+std::string(who->uuid)+" NICK "+params[0]);
576                                                 return false;
577                                         }
578                                         /* Update timestamp on user when they change nicks */
579                                         who->age = atoi(params[1].c_str());
580
581                                         /*
582                                          * On nick messages, check that the nick doesnt already exist here.
583                                          * If it does, perform collision logic.
584                                          */
585                                         User* x = this->ServerInstance->FindNickOnly(params[0]);
586                                         if ((x) && (x != who))
587                                         {
588                                                 int collideret = 0;
589                                                 /* x is local, who is remote */
590                                                 collideret = this->DoCollision(x, who->age, who->ident, who->GetIPString(), who->uuid);
591                                                 if (collideret != 1)
592                                                 {
593                                                         /*
594                                                          * Remote client lost, or both lost, parsing or passing on this
595                                                          * nickchange would be pointless, as the incoming client's server will
596                                                          * soon recieve SVSNICK to change its nick to its UID. :) -- w00t
597                                                          */
598                                                         return true;
599                                                 }
600                                         }
601                                 }
602
603                                 // its a user
604                                 std::vector<std::string> strparams(params.begin(), params.end());
605
606                                 switch (this->ServerInstance->CallCommandHandler(command.c_str(), strparams, who))
607                                 {
608                                         case CMD_INVALID:
609                                                 /*
610                                                  * XXX: command is irc::string, hence ugliness
611                                                  */
612                                                 this->SendError("Unrecognised or malformed command '" + std::string(command.c_str()) + "' -- possibly loaded mismatched modules");
613                                                 return false;
614                                                 break;
615                                         case CMD_FAILURE:
616                                                 /*
617                                                  * CMD_LOCALONLY is aliased to CMD_FAILURE, so this won't go out onto the network.
618                                                  */
619                                                 return true;
620                                                 break;
621                                         default:
622                                                 /* CMD_SUCCESS falls through here */
623                                                 break;
624                                 }
625
626                                 return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params);
627
628                         }
629                         return true;
630                         break; // end of state CONNECTED (phew).
631         }
632         return true;
633 }
634
635 std::string TreeSocket::GetName()
636 {
637         std::string sourceserv = this->myhost;
638         if (!this->InboundServerName.empty())
639         {
640                 sourceserv = this->InboundServerName;
641         }
642         return sourceserv;
643 }
644
645 void TreeSocket::OnTimeout()
646 {
647         if (this->LinkState == CONNECTING)
648         {
649                 this->ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str());
650                 Link* MyLink = Utils->FindLink(myhost);
651                 if (MyLink)
652                         Utils->DoFailOver(MyLink);
653         }
654 }
655
656 void TreeSocket::OnClose()
657 {
658         // Test fix for big fuckup
659         if (this->LinkState != CONNECTED)
660                 return;
661
662         // Connection closed.
663         // If the connection is fully up (state CONNECTED)
664         // then propogate a netsplit to all peers.
665         std::string quitserver = this->myhost;
666         if (!this->InboundServerName.empty())
667         {
668                 quitserver = this->InboundServerName;
669         }
670         TreeServer* s = Utils->FindServer(quitserver);
671         if (s)
672         {
673                 Squit(s,"Remote host closed the connection");
674         }
675
676         if (!quitserver.empty())
677         {
678                 this->ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' failed.",quitserver.c_str());
679
680                 time_t server_uptime = ServerInstance->Time() - this->age;
681                 if (server_uptime)
682                                 this->ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str());
683         }
684 }