Move check_if_ipmask() from support.* to match.*.
[ircu2.10.12-pk.git] / ircd / s_misc.c
1 /*
2  * IRC - Internet Relay Chat, ircd/s_misc.c (formerly ircd/date.c)
3  * Copyright (C) 1990 Jarkko Oikarinen and
4  *                    University of Oulu, Computing Center
5  *
6  * See file AUTHORS in IRC package for additional names of
7  * the programmers.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 1, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  * $Id$
24  */
25 #include "config.h"
26
27 #include "s_misc.h"
28 #include "IPcheck.h"
29 #include "channel.h"
30 #include "client.h"
31 #include "hash.h"
32 #include "ircd.h"
33 #include "ircd_alloc.h"
34 #include "ircd_auth.h"
35 #include "ircd_features.h"
36 #include "ircd_log.h"
37 #include "ircd_reply.h"
38 #include "ircd_snprintf.h"
39 #include "ircd_string.h"
40 #include "list.h"
41 #include "match.h"
42 #include "msg.h"
43 #include "numeric.h"
44 #include "numnicks.h"
45 #include "parse.h"
46 #include "querycmds.h"
47 #include "res.h"
48 #include "s_bsd.h"
49 #include "s_conf.h"
50 #include "s_debug.h"
51 #include "s_stats.h"
52 #include "s_user.h"
53 #include "send.h"
54 #include "struct.h"
55 #include "sys.h"
56 #include "uping.h"
57 #include "userload.h"
58
59 #include <assert.h>
60 #include <fcntl.h>
61 #include <netdb.h>
62 #include <stdio.h>
63 #include <string.h>
64 #include <sys/stat.h>
65 #include <unistd.h>
66
67 /** Array of English month names (0 = January). */
68 static char *months[] = {
69   "January", "February", "March", "April",
70   "May", "June", "July", "August",
71   "September", "October", "November", "December"
72 };
73
74 /** Array of English day names (0 = Sunday). */
75 static char *weekdays[] = {
76   "Sunday", "Monday", "Tuesday", "Wednesday",
77   "Thursday", "Friday", "Saturday"
78 };
79
80 /*
81  * stats stuff
82  */
83 /** Global statistics structure. */
84 static struct ServerStatistics ircst;
85 /** Public pointer to global statistics structure. */
86 struct ServerStatistics* ServerStats = &ircst;
87
88 /** Formats a Unix time as a readable string.
89  * @param clock Unix time to format (0 means #CurrentTime).
90  * @return Pointer to a static buffer containing something like
91  * "Sunday January 1 2000 -- 09:30 +01:00"
92  */
93 char *date(time_t clock)
94 {
95   static char buf[80], plus;
96   struct tm *lt, *gm;
97   struct tm gmbuf;
98   int minswest;
99
100   if (!clock)
101     clock = CurrentTime;
102   gm = gmtime(&clock);
103   memcpy(&gmbuf, gm, sizeof(gmbuf));
104   gm = &gmbuf;
105   lt = localtime(&clock);
106
107   /* There is unfortunately no clean portable way to extract time zone
108    * offset information, so do ugly things.
109    */
110   minswest = (gm->tm_hour - lt->tm_hour) * 60 + (gm->tm_min - lt->tm_min);
111   if (lt->tm_yday != gm->tm_yday)
112   {
113     if ((lt->tm_yday > gm->tm_yday && lt->tm_year == gm->tm_year) ||
114         (lt->tm_yday < gm->tm_yday && lt->tm_year != gm->tm_year))
115       minswest -= 24 * 60;
116     else
117       minswest += 24 * 60;
118   }
119
120   plus = (minswest > 0) ? '-' : '+';
121   if (minswest < 0)
122     minswest = -minswest;
123
124   sprintf(buf, "%s %s %d %d -- %02d:%02d %c%02d:%02d",
125       weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday,
126       1900 + lt->tm_year, lt->tm_hour, lt->tm_min,
127       plus, minswest / 60, minswest % 60);
128
129   return buf;
130 }
131
132 /** Like ctime() but with no trailing newline. Also, it takes
133  * the time value as parameter, instead of pointer to it.
134  * @param value Unix time to format.
135  * @return Pointer to a static buffer containing formatted time.
136  */
137 char *myctime(time_t value)
138 {
139   /* Use a secondary buffer in case ctime() would not replace an
140    * overwritten newline.
141    */
142   static char buf[28];
143   char *p;
144
145   strcpy(buf, ctime(&value));
146   if ((p = strchr(buf, '\n')) != NULL)
147     *p = '\0';
148
149   return buf;
150 }
151
152 /** Return the name of the client for various tracking and admin
153  * purposes. The main purpose of this function is to return the
154  * "socket host" name of the client, if that differs from the
155  * advertised name (other than case).  But, this can be used on any
156  * client structure.
157  * @param sptr Client to operate on.
158  * @param showip If non-zero, append [username\@text-ip] to name.
159  * @return Either cli_name(\a sptr) or a static buffer.
160  */
161 const char* get_client_name(const struct Client* sptr, int showip)
162 {
163   static char nbuf[HOSTLEN * 2 + USERLEN + 5];
164
165   if (MyConnect(sptr)) {
166     if (showip)
167       ircd_snprintf(0, nbuf, sizeof(nbuf), "%s[%s@%s]", cli_name(sptr),
168                     IsIdented(sptr) ? cli_username(sptr) : "unknown",
169                     cli_sock_ip(sptr));
170     else
171         return cli_name(sptr);
172     return nbuf;
173   }
174   return cli_name(sptr);
175 }
176
177 /** Set cli_sockhost(cptr) from \a host.
178  * If \a host contains an '@', copy starting after that byte.
179  * Otherwise copy all of \a host.
180  * @param cptr Client to operate on.
181  * @param host hostname or user\@hostname string.
182  */
183 void get_sockhost(struct Client *cptr, char *host)
184 {
185   char *s;
186   if ((s = strchr(host, '@')))
187     s++;
188   else
189     s = host;
190   ircd_strncpy(cli_sockhost(cptr), s, HOSTLEN);
191 }
192
193 /**
194  * Exit one client, local or remote. Assuming for local client that
195  * all dependants already have been removed, and socket is closed.
196  * @param bcptr Client being (s)quitted.
197  * @param comment The QUIT comment to send.
198  */
199 /* Rewritten by Run - 24 sept 94 */
200 static void exit_one_client(struct Client* bcptr, const char* comment)
201 {
202   struct SLink *lp;
203
204   if (cli_serv(bcptr) && cli_serv(bcptr)->client_list)  /* Was SetServerYXX called ? */
205     ClearServerYXX(bcptr);      /* Removes server from server_list[] */
206   if (IsUser(bcptr)) {
207     /*
208      * clear out uping requests
209      */
210     if (IsUPing(bcptr))
211       uping_cancel(bcptr, 0);
212     /*
213      * Stop a running /LIST clean
214      */
215     if (MyUser(bcptr) && cli_listing(bcptr)) {
216       cli_listing(bcptr)->chptr->mode.mode &= ~MODE_LISTED;
217       MyFree(cli_listing(bcptr));
218       cli_listing(bcptr) = NULL;
219     }
220     /*
221      * If a person is on a channel, send a QUIT notice
222      * to every client (person) on the same channel (so
223      * that the client can show the "**signoff" message).
224      * (Note: The notice is to the local clients *only*)
225      */
226     sendcmdto_common_channels_butone(bcptr, CMD_QUIT, NULL, ":%s", comment);
227
228     remove_user_from_all_channels(bcptr);
229
230     /* Clean up invitefield */
231     while ((lp = cli_user(bcptr)->invited))
232       del_invite(bcptr, lp->value.chptr);
233
234     /* Clean up silencefield */
235     while ((lp = cli_user(bcptr)->silence))
236       del_silence(bcptr, lp->value.cp);
237
238     /* Clean up snotice lists */
239     if (MyUser(bcptr))
240       set_snomask(bcptr, ~0, SNO_DEL);
241
242     if (IsInvisible(bcptr))
243       --UserStats.inv_clients;
244     if (IsOper(bcptr))
245       --UserStats.opers;
246     if (MyConnect(bcptr))
247       Count_clientdisconnects(bcptr, UserStats);
248     else {
249       Count_remoteclientquits(UserStats, bcptr);
250     }
251   }
252   else if (IsServer(bcptr))
253   {
254     /* Remove downlink list node of uplink */
255     remove_dlink(&(cli_serv(cli_serv(bcptr)->up))->down, cli_serv(bcptr)->updown);
256     cli_serv(bcptr)->updown = 0;
257
258     if (MyConnect(bcptr))
259       Count_serverdisconnects(UserStats);
260     else
261       Count_remoteserverquits(UserStats);
262   }
263   else if (IsMe(bcptr))
264   {
265     sendto_opmask_butone(0, SNO_OLDSNO, "ERROR: tried to exit me! : %s",
266                          comment);
267     return;                     /* ...must *never* exit self! */
268   }
269   else if (IsUnknown(bcptr) || IsConnecting(bcptr) || IsHandshake(bcptr))
270     Count_unknowndisconnects(UserStats);
271
272   /*
273    * Update IPregistry
274    */
275   if (IsIPChecked(bcptr))
276     IPcheck_disconnect(bcptr);
277
278   /* 
279    * Remove from serv->client_list
280    * NOTE: user is *always* NULL if this is a server
281    */
282   if (cli_user(bcptr)) {
283     assert(!IsServer(bcptr));
284     /* bcptr->user->server->serv->client_list[IndexYXX(bcptr)] = NULL; */
285     RemoveYXXClient(cli_user(bcptr)->server, cli_yxx(bcptr));
286     if (IsIAuthed(bcptr) || cli_iauth(bcptr))
287         iauth_exit_client(bcptr);
288   }
289
290   /* Remove bcptr from the client list */
291 #ifdef DEBUGMODE
292   if (hRemClient(bcptr) != 0)
293     Debug((DEBUG_ERROR, "%p !in tab %s[%s] %p %p %p %d %d %p",
294           bcptr, cli_name(bcptr), cli_from(bcptr) ? cli_sockhost(cli_from(bcptr)) : "??host",
295           cli_from(bcptr), cli_next(bcptr), cli_prev(bcptr), cli_fd(bcptr),
296           cli_status(bcptr), cli_user(bcptr)));
297 #else
298   hRemClient(bcptr);
299 #endif
300   remove_client_from_list(bcptr);
301 }
302
303 /* exit_downlinks - added by Run 25-9-94 */
304 /**
305  * Removes all clients and downlinks (+clients) of any server
306  * QUITs are generated and sent to local users.
307  * @param cptr server that must have all dependents removed
308  * @param sptr source who thought that this was a good idea
309  * @param comment comment sent as sign off message to local clients
310  */
311 static void exit_downlinks(struct Client *cptr, struct Client *sptr, char *comment)
312 {
313   struct Client *acptr;
314   struct DLink *next;
315   struct DLink *lp;
316   struct Client **acptrp;
317   int i;
318
319   /* Run over all its downlinks */
320   for (lp = cli_serv(cptr)->down; lp; lp = next)
321   {
322     next = lp->next;
323     acptr = lp->value.cptr;
324     /* Remove the downlinks and client of the downlink */
325     exit_downlinks(acptr, sptr, comment);
326     /* Remove the downlink itself */
327     exit_one_client(acptr, cli_name(&me));
328   }
329   /* Remove all clients of this server */
330   acptrp = cli_serv(cptr)->client_list;
331   for (i = 0; i <= cli_serv(cptr)->nn_mask; ++acptrp, ++i) {
332     if (*acptrp)
333       exit_one_client(*acptrp, comment);
334   }
335 }
336
337 /* exit_client, rewritten 25-9-94 by Run */
338 /**
339  * Eexits a client of *any* type (user, server, etc)
340  * from this server. Also, this generates all necessary prototol
341  * messages that this exit may cause.
342  *
343  * This function implicitly exits all other clients depending on
344  * this connection.
345  *
346  * For convenience, this function returns a suitable value for
347  * m_funtion return value:
348  *
349  *   CPTR_KILLED     if (cptr == bcptr)
350  *   0                if (cptr != bcptr)
351  *
352  * This function can be called in two ways:
353  * 1) From before or in parse(), exitting the 'cptr', in which case it was
354  *    invoked as exit_client(cptr, cptr, &me,...), causing it to always
355  *    return CPTR_KILLED.
356  * 2) Via parse from a m_function call, in which case it was invoked as
357  *    exit_client(cptr, acptr, sptr, ...). Here 'sptr' is known; the client
358  *    that generated the message in a way that we can assume he already
359  *    did remove acptr from memory himself (or in other cases we don't mind
360  *    because he will be delinked.) Or invoked as:
361  *    exit_client(cptr, acptr/sptr, &me, ...) when WE decide this one should
362  *    be removed.
363  * In general: No generated SQUIT or QUIT should be sent to source link
364  * sptr->from. And CPTR_KILLED should be returned if cptr got removed (too).
365  *
366  * --Run
367  * @param cptr Connection currently being handled by read_message.
368  * @param victim Client being killed.
369  * @param killer Client that made the decision to remove \a victim.
370  * @param comment Reason for the exit.
371  * @return CPTR_KILLED if cptr == bcptr, else 0.
372  */
373 int exit_client(struct Client *cptr,
374     struct Client* victim,
375     struct Client* killer,
376     const char* comment)
377 {
378   struct Client* acptr = 0;
379   struct DLink *dlp;
380   time_t on_for;
381
382   char comment1[HOSTLEN + HOSTLEN + 2];
383   assert(killer);
384   if (MyConnect(victim))
385   {
386     SetFlag(victim, FLAG_CLOSING);
387
388     if (feature_bool(FEAT_CONNEXIT_NOTICES) && IsUser(victim))
389       sendto_opmask_butone(0, SNO_CONNEXIT,
390                            "Client exiting: %s (%s@%s) [%s] [%s] <%s%s>",
391                            cli_name(victim), cli_user(victim)->username,
392                            cli_user(victim)->host, comment,
393                            ircd_ntoa(&cli_ip(victim)),
394                            NumNick(victim) /* two %s's */);
395     update_load();
396
397     on_for = CurrentTime - cli_firsttime(victim);
398
399     if (IsUser(victim))
400       log_write(LS_USER, L_TRACE, 0, "%Tu %i %s@%s %s %s %s%s %s :%s",
401                 cli_firsttime(victim), on_for,
402                 cli_user(victim)->username, cli_sockhost(victim),
403                 ircd_ntoa(&cli_ip(victim)),
404                 IsAccount(victim) ? cli_username(victim) : "0",
405                 NumNick(victim), /* two %s's */
406                 cli_name(victim), cli_info(victim));
407
408     if (victim != cli_from(killer)  /* The source knows already */
409         && IsClient(victim))    /* Not a Ping struct or Log file */
410     {
411       if (IsServer(victim) || IsHandshake(victim))
412         sendcmdto_one(killer, CMD_SQUIT, victim, "%s 0 :%s", cli_name(&me), comment);
413       else if (!IsConnecting(victim)) {
414         if (!IsDead(victim)) {
415           if (IsServer(victim))
416             sendcmdto_one(killer, CMD_ERROR, victim,
417                           ":Closing Link: %s by %s (%s)", cli_name(victim),
418                           cli_name(killer), comment);
419           else
420             sendrawto_one(victim, MSG_ERROR " :Closing Link: %s by %s (%s)",
421                           cli_name(victim), IsServer(killer) ? cli_name(&me) :
422                           cli_name(killer), comment);
423         }
424       }
425       if ((IsServer(victim) || IsHandshake(victim) || IsConnecting(victim)) &&
426           (killer == &me || (IsServer(killer) &&
427           (strncmp(comment, "Leaf-only link", 14) ||
428           strncmp(comment, "Non-Hub link", 12)))))
429       {
430         /*
431          * Note: check user == user needed to make sure we have the same
432          * client
433          */
434         if (cli_serv(victim)->user && *(cli_serv(victim))->by &&
435             (acptr = findNUser(cli_serv(victim)->by))) {
436           if (cli_user(acptr) == cli_serv(victim)->user) {
437             sendcmdto_one(&me, CMD_NOTICE, acptr,
438                           "%C :Link with %s cancelled: %s", acptr,
439                           cli_name(victim), comment);
440           }
441           else {
442             /*
443              * not right client, set by to empty string
444              */
445             acptr = 0;
446             *(cli_serv(victim))->by = '\0';
447           }
448         }
449         if (killer == &me)
450           sendto_opmask_butone(acptr, SNO_OLDSNO, "Link with %s cancelled: %s",
451                                cli_name(victim), comment);
452       }
453     }
454     /*
455      *  Close the Client connection first.
456      */
457     close_connection(victim);
458   }
459
460   if (IsServer(victim))
461   {
462     if (feature_bool(FEAT_HIS_NETSPLIT))
463       strcpy(comment1, "*.net *.split");
464     else
465     {
466       strcpy(comment1, cli_name(cli_serv(victim)->up));
467       strcat(comment1, " ");
468       strcat(comment1, cli_name(victim));
469     }
470
471     if (IsUser(killer))
472       sendto_opmask_butone(killer, SNO_OLDSNO, "%s SQUIT by %s [%s]:",
473                            (cli_user(killer)->server == victim ||
474                             cli_user(killer)->server == cli_serv(victim)->up) ?
475                            "Local" : "Remote",
476                            get_client_name(killer, HIDE_IP),
477                            cli_name(cli_user(killer)->server));
478     else if (killer != &me && cli_serv(victim)->up != killer)
479       sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :",
480                            cli_name(victim), IsServer(killer) ? cli_name(killer) :
481                            get_client_name(killer, HIDE_IP));
482     sendto_opmask_butone(0, SNO_NETWORK, "Net break: %C %C (%s)",
483                          cli_serv(victim)->up, victim, comment);
484   }
485
486   /*
487    * First generate the needed protocol for the other server links
488    * except the source:
489    */
490   for (dlp = cli_serv(&me)->down; dlp; dlp = dlp->next) {
491     if (dlp->value.cptr != cli_from(killer) && dlp->value.cptr != victim)
492     {
493       if (IsServer(victim))
494         sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%s %Tu :%s",
495                       cli_name(victim), cli_serv(victim)->timestamp, comment);
496       else if (IsUser(victim) && !HasFlag(victim, FLAG_KILLED))
497         sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
498     }
499   }
500   /* Then remove the client structures */
501   if (IsServer(victim))
502     exit_downlinks(victim, killer, comment1);
503   exit_one_client(victim, comment);
504
505   /*
506    *  cptr can only have been killed if it was cptr itself that got killed here,
507    *  because cptr can never have been a dependant of victim    --Run
508    */
509   return (cptr == victim) ? CPTR_KILLED : 0;
510 }
511
512 /**
513  * Exit client with formatted va_list message.
514  * Thin wrapper around exit_client().
515  * @param cptr Connection being processed.
516  * @param bcptr Connection being closed.
517  * @param sptr Connection who asked to close the victim.
518  * @param pattern Format string for message.
519  * @param vl Stdargs argument list.
520  * @return Has a tail call to exit_client().
521  */
522 /* added 25-9-94 by Run */
523 int vexit_client_msg(struct Client *cptr, struct Client *bcptr, struct Client *sptr,
524     const char *pattern, va_list vl)
525 {
526   char msgbuf[1024];
527   ircd_vsnprintf(0, msgbuf, sizeof(msgbuf), pattern, vl);
528   return exit_client(cptr, bcptr, sptr, msgbuf);
529 }
530
531 /**
532  * Exit client with formatted message using a variable-length argument list.
533  * Thin wrapper around exit_client().
534  * @param cptr Connection being processed.
535  * @param bcptr Connection being closed.
536  * @param sptr Connection who asked to close the victim.
537  * @param pattern Format string for message.
538  * @return Has a tail call to exit_client().
539  */
540 int exit_client_msg(struct Client *cptr, struct Client *bcptr,
541     struct Client *sptr, const char *pattern, ...)
542 {
543   va_list vl;
544   char msgbuf[1024];
545
546   va_start(vl, pattern);
547   ircd_vsnprintf(0, msgbuf, sizeof(msgbuf), pattern, vl);
548   va_end(vl);
549
550   return exit_client(cptr, bcptr, sptr, msgbuf);
551 }
552
553 /** Initialize global server statistics. */
554 /* (Kind of pointless since C guarantees it's already zero'ed, but... */
555 void initstats(void)
556 {
557   memset(&ircst, 0, sizeof(ircst));
558 }
559
560 /** Report server statistics to a client.
561  * @param cptr Client who wants statistics.
562  * @param sd StatDesc structure being looked up (unused).
563  * @param param Extra parameter passed by user (unused).
564  */
565 void tstats(struct Client *cptr, const struct StatDesc *sd, char *param)
566 {
567   struct Client *acptr;
568   int i;
569   struct ServerStatistics *sp;
570   struct ServerStatistics tmp;
571
572   sp = &tmp;
573   memcpy(sp, ServerStats, sizeof(struct ServerStatistics));
574   for (i = 0; i < MAXCONNECTIONS; i++)
575   {
576     if (!(acptr = LocalClientArray[i]))
577       continue;
578     if (IsServer(acptr))
579     {
580       sp->is_sbs += cli_sendB(acptr);
581       sp->is_sbr += cli_receiveB(acptr);
582       sp->is_sks += cli_sendK(acptr);
583       sp->is_skr += cli_receiveK(acptr);
584       sp->is_sti += CurrentTime - cli_firsttime(acptr);
585       sp->is_sv++;
586       if (sp->is_sbs > 1023)
587       {
588         sp->is_sks += (sp->is_sbs >> 10);
589         sp->is_sbs &= 0x3ff;
590       }
591       if (sp->is_sbr > 1023)
592       {
593         sp->is_skr += (sp->is_sbr >> 10);
594         sp->is_sbr &= 0x3ff;
595       }
596     }
597     else if (IsUser(acptr))
598     {
599       sp->is_cbs += cli_sendB(acptr);
600       sp->is_cbr += cli_receiveB(acptr);
601       sp->is_cks += cli_sendK(acptr);
602       sp->is_ckr += cli_receiveK(acptr);
603       sp->is_cti += CurrentTime - cli_firsttime(acptr);
604       sp->is_cl++;
605       if (sp->is_cbs > 1023)
606       {
607         sp->is_cks += (sp->is_cbs >> 10);
608         sp->is_cbs &= 0x3ff;
609       }
610       if (sp->is_cbr > 1023)
611       {
612         sp->is_ckr += (sp->is_cbr >> 10);
613         sp->is_cbr &= 0x3ff;
614       }
615     }
616     else if (IsUnknown(acptr))
617       sp->is_ni++;
618   }
619
620   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":accepts %u refused %u",
621              sp->is_ac, sp->is_ref);
622   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
623              ":unknown commands %u prefixes %u", sp->is_unco, sp->is_unpf);
624   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
625              ":nick collisions %u unknown closes %u", sp->is_kill, sp->is_ni);
626   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
627              ":wrong direction %u empty %u", sp->is_wrdi, sp->is_empt);
628   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
629              ":numerics seen %u mode fakes %u", sp->is_num, sp->is_fake);
630   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
631              ":auth successes %u fails %u", sp->is_asuc, sp->is_abad);
632   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":local connections %u",
633              sp->is_loc);
634   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":Client server");
635   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":connected %u %u",
636              sp->is_cl, sp->is_sv);
637   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":bytes sent %u.%uK %u.%uK",
638              sp->is_cks, sp->is_cbs, sp->is_sks, sp->is_sbs);
639   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":bytes recv %u.%uK %u.%uK",
640              sp->is_ckr, sp->is_cbr, sp->is_skr, sp->is_sbr);
641   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":time connected %Tu %Tu",
642              sp->is_cti, sp->is_sti);
643 }