ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/client.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/src/client.c (file contents), Revision 650 by michael, Thu Jun 8 07:00:17 2006 UTC vs.
ircd-hybrid/trunk/src/client.c (file contents), Revision 1636 by michael, Sun Nov 4 17:09:47 2012 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 < #include "tools.h"
26 > #include "list.h"
27   #include "client.h"
28   #include "channel_mode.h"
29 #include "common.h"
29   #include "event.h"
30   #include "fdlist.h"
31   #include "hash.h"
32   #include "irc_string.h"
34 #include "sprintf_irc.h"
33   #include "ircd.h"
36 #include "list.h"
34   #include "s_gline.h"
35   #include "numeric.h"
36   #include "packet.h"
37   #include "s_auth.h"
38   #include "s_bsd.h"
39 < #include "s_conf.h"
40 < #include "s_log.h"
39 > #include "conf.h"
40 > #include "log.h"
41   #include "s_misc.h"
42   #include "s_serv.h"
43   #include "send.h"
# Line 53 | Line 50
50   #include "listener.h"
51   #include "irc_res.h"
52   #include "userhost.h"
53 + #include "watch.h"
54  
55   dlink_list listing_client_list = { NULL, NULL, 0 };
56   /* Pointer to beginning of Client list */
# Line 76 | Line 74 | static dlink_node *eac_next;  /* next ab
74  
75   static void check_pings_list(dlink_list *);
76   static void check_unknowns_list(void);
77 < static void ban_them(struct Client *client_p, struct ConfItem *conf);
77 > static void ban_them(struct Client *, struct MaskItem *);
78  
79  
80   /* init_client()
# Line 118 | Line 116 | make_client(struct Client *from)
116  
117    if (from == NULL)
118    {
119 <    client_p->from  = client_p; /* 'from' of local client is self! */
120 <    client_p->since = client_p->lasttime = client_p->firsttime = CurrentTime;
121 <
122 <    client_p->localClient = BlockHeapAlloc(lclient_heap);
119 >    client_p->from                      = client_p; /* 'from' of local client is self! */
120 >    client_p->localClient               = BlockHeapAlloc(lclient_heap);
121 >    client_p->localClient->since        = CurrentTime;
122 >    client_p->localClient->lasttime     = CurrentTime;
123 >    client_p->localClient->firsttime    = CurrentTime;
124      client_p->localClient->registration = REG_INIT;
125 +
126      /* as good a place as any... */
127 <    dlinkAdd(client_p, make_dlink_node(), &unknown_list);
127 >    dlinkAdd(client_p, &client_p->localClient->lclient_node, &unknown_list);
128    }
129    else
130      client_p->from = from; /* 'from' of local client is self! */
131  
132 +  client_p->idhnext = client_p;
133    client_p->hnext  = client_p;
134    client_p->status = STAT_UNKNOWN;
135    strcpy(client_p->username, "unknown");
136 +  strcpy(client_p->svid, "0");
137  
138    return client_p;
139   }
# Line 149 | Line 151 | free_client(struct Client *client_p)
151    assert(client_p != NULL);
152    assert(client_p != &me);
153    assert(client_p->hnext == client_p);
154 +  assert(client_p->idhnext == client_p);
155    assert(client_p->channel.head == NULL);
156    assert(dlink_list_length(&client_p->channel) == 0);
157 +  assert(dlink_list_length(&client_p->whowas) == 0);
158 +  assert(!IsServer(client_p) || IsServer(client_p) && client_p->serv);
159  
155  MyFree(client_p->away);
160    MyFree(client_p->serv);
161  
162    if (MyConnect(client_p))
163    {
164      assert(client_p->localClient->invited.head == NULL);
165      assert(dlink_list_length(&client_p->localClient->invited) == 0);
166 +    assert(dlink_list_length(&client_p->localClient->watches) == 0);
167      assert(IsClosing(client_p) && IsDead(client_p));
168  
169      MyFree(client_p->localClient->response);
# Line 246 | Line 251 | check_pings_list(dlink_list *list)
251        continue;
252      }
253  
249    if (client_p->localClient->reject_delay > 0)
250    {
251      if (client_p->localClient->reject_delay <= CurrentTime)
252        exit_client(client_p, &me, "Rejected");
253      continue;
254    }
255
256    if (GlobalSetOptions.idletime && IsClient(client_p))
257    {
258      if (!IsExemptKline(client_p) && !IsOper(client_p) &&
259          !IsIdlelined(client_p) &&
260          ((CurrentTime - client_p->localClient->last) > GlobalSetOptions.idletime))
261      {
262        struct ConfItem *conf;
263        struct AccessItem *aconf;
264
265        conf = make_conf_item(KLINE_TYPE);
266        aconf = (struct AccessItem *)map_to_conf(conf);
267
268        DupString(aconf->host, client_p->host);
269        DupString(aconf->reason, "idle exceeder");
270        DupString(aconf->user, client_p->username);
271        aconf->hold = CurrentTime + 60;
272        add_temp_line(conf);
273
274        sendto_realops_flags(UMODE_ALL, L_ALL,
275                             "Idle time limit exceeded for %s - temp k-lining",
276                             get_client_name(client_p, HIDE_IP));
277        exit_client(client_p, &me, aconf->reason);
278        continue;
279      }
280    }
281
254      if (!IsRegistered(client_p))
255        ping = CONNECTTIMEOUT, pingwarn = 0;
256      else
257 <      ping = get_client_ping(client_p, &pingwarn);
257 >      ping = get_client_ping(&client_p->localClient->confs, &pingwarn);
258  
259 <    if (ping < CurrentTime - client_p->lasttime)
259 >    if (ping < CurrentTime - client_p->localClient->lasttime)
260      {
261        if (!IsPingSent(client_p))
262        {
# Line 295 | Line 267 | check_pings_list(dlink_list *list)
267           */
268          SetPingSent(client_p);
269          ClearPingWarning(client_p);
270 <        client_p->lasttime = CurrentTime - ping;
270 >        client_p->localClient->lasttime = CurrentTime - ping;
271          sendto_one(client_p, "PING :%s", ID_or_name(&me, client_p));
272        }
273        else
274        {
275 <        if (CurrentTime - client_p->lasttime >= 2 * ping)
275 >        if (CurrentTime - client_p->localClient->lasttime >= 2 * ping)
276          {
277            /*
278             * If the client/server hasn't talked to us in 2*ping seconds
# Line 308 | Line 280 | check_pings_list(dlink_list *list)
280             */
281            if (IsServer(client_p) || IsHandshake(client_p))
282            {
283 <            sendto_realops_flags(UMODE_ALL, L_ADMIN,
283 >            sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
284                                   "No response from %s, closing link",
285                                   get_client_name(client_p, HIDE_IP));
286 <            sendto_realops_flags(UMODE_ALL, L_OPER,
286 >            sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
287                                   "No response from %s, closing link",
288                                   get_client_name(client_p, MASK_IP));
289 <            ilog(L_NOTICE, "No response from %s, closing link",
289 >            ilog(LOG_TYPE_IRCD, "No response from %s, closing link",
290                   get_client_name(client_p, HIDE_IP));
291            }
292  
293 <          ircsprintf(scratch, "Ping timeout: %d seconds",
294 <                     (int)(CurrentTime - client_p->lasttime));
293 >          snprintf(scratch, sizeof(scratch), "Ping timeout: %d seconds",
294 >                   (int)(CurrentTime - client_p->localClient->lasttime));
295            exit_client(client_p, &me, scratch);
296          }
297          else if (!IsPingWarning(client_p) && pingwarn > 0 &&
298                   (IsServer(client_p) || IsHandshake(client_p)) &&
299 <                 CurrentTime - client_p->lasttime >= ping + pingwarn)
299 >                 CurrentTime - client_p->localClient->lasttime >= ping + pingwarn)
300          {
301            /*
302             * If the server hasn't replied in pingwarn seconds after sending
303             * the PING, notify the opers so that they are aware of the problem.
304             */
305            SetPingWarning(client_p);
306 <          sendto_realops_flags(UMODE_ALL, L_ADMIN,
306 >          sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
307                                 "Warning, no response from %s in %d seconds",
308                                 get_client_name(client_p, HIDE_IP), pingwarn);
309 <          sendto_realops_flags(UMODE_ALL, L_OPER,
309 >          sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
310                                 "Warning, no response from %s in %d seconds",
311                                 get_client_name(client_p, MASK_IP), pingwarn);
312 <          ilog(L_NOTICE, "No response from %s in %d seconds",
312 >          ilog(LOG_TYPE_IRCD, "No response from %s in %d seconds",
313                 get_client_name(client_p, HIDE_IP), pingwarn);
314          }
315        }
# Line 360 | Line 332 | check_unknowns_list(void)
332    {
333      struct Client *client_p = ptr->data;
334  
363    if (client_p->localClient->reject_delay > 0)
364    {
365      if (client_p->localClient->reject_delay <= CurrentTime)
366        exit_client(client_p, &me, "Rejected");
367      continue;
368    }
369
335      /*
336       * Check UNKNOWN connections - if they have been in this state
337       * for > 30s, close them.
338       */
339 <    if (IsAuthFinished(client_p) && (CurrentTime - client_p->firsttime) > 30)
339 >    if (IsAuthFinished(client_p) && (CurrentTime - client_p->localClient->firsttime) > 30)
340        exit_client(client_p, &me, "Registration timed out");
341    }
342   }
# Line 387 | Line 352 | void
352   check_conf_klines(void)
353   {              
354    struct Client *client_p = NULL;       /* current local client_p being examined */
355 <  struct AccessItem *aconf = NULL;
391 <  struct ConfItem *conf = NULL;
355 >  struct MaskItem *conf = NULL;
356    dlink_node *ptr, *next_ptr;
357  
358    DLINK_FOREACH_SAFE(ptr, next_ptr, local_client_list.head)
# Line 400 | Line 364 | check_conf_klines(void)
364      if (IsDead(client_p) || !IsClient(client_p))
365        continue;
366  
367 <    /* if there is a returned struct ConfItem then kill it */
404 <    if ((aconf = find_dline_conf(&client_p->localClient->ip,
367 >    if ((conf = find_dline_conf(&client_p->localClient->ip,
368                                    client_p->localClient->aftype)) != NULL)
369      {
370 <      if (aconf->status & CONF_EXEMPTDLINE)
370 >      if (conf->type == CONF_EXEMPT)
371          continue;
372  
410      conf = unmap_conf_item(aconf);
373        ban_them(client_p, conf);
374        continue; /* and go examine next fd/client_p */
375      }
376  
377 <    if (ConfigFileEntry.glines && (aconf = find_gline(client_p)))
377 >    if (ConfigFileEntry.glines && (conf = find_gline(client_p)))
378      {
379        if (IsExemptKline(client_p) ||
380            IsExemptGline(client_p))
381        {
382 <        sendto_realops_flags(UMODE_ALL, L_ALL,
382 >        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
383                               "GLINE over-ruled for %s, client is %sline_exempt",
384                               get_client_name(client_p, HIDE_IP), IsExemptKline(client_p) ? "k" : "g");
385          continue;
386        }
387  
426      conf = unmap_conf_item(aconf);
388        ban_them(client_p, conf);
389        /* and go examine next fd/client_p */    
390        continue;
391      }
392  
393 <    if ((aconf = find_kill(client_p)) != NULL)
393 >    if ((conf = find_kill(client_p)) != NULL)
394      {
434
435      /* if there is a returned struct AccessItem.. then kill it */
395        if (IsExemptKline(client_p))
396        {
397 <        sendto_realops_flags(UMODE_ALL, L_ALL,
397 >        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
398                               "KLINE over-ruled for %s, client is kline_exempt",
399                               get_client_name(client_p, HIDE_IP));
400          continue;
401        }
402  
444      conf = unmap_conf_item(aconf);
403        ban_them(client_p, conf);
404        continue;
405      }
406  
407 <    /* if there is a returned struct MatchItem then kill it */
450 <    if ((conf = find_matching_name_conf(XLINE_TYPE,  client_p->info,
407 >    if ((conf = find_matching_name_conf(CONF_XLINE,  client_p->info,
408                                          NULL, NULL, 0)) != NULL ||
409 <        (conf = find_matching_name_conf(RXLINE_TYPE, client_p->info,
409 >        (conf = find_matching_name_conf(CONF_RXLINE, client_p->info,
410                                          NULL, NULL, 0)) != NULL)
411      {
412        ban_them(client_p, conf);
# Line 462 | Line 419 | check_conf_klines(void)
419    {
420      client_p = ptr->data;
421  
422 <    if ((aconf = find_dline_conf(&client_p->localClient->ip,
423 <                                  client_p->localClient->aftype)))
422 >    if ((conf = find_dline_conf(&client_p->localClient->ip,
423 >                                 client_p->localClient->aftype)))
424      {
425 <      if (aconf->status & CONF_EXEMPTDLINE)
425 >      if (conf->type == CONF_EXEMPT)
426          continue;
427  
428        exit_client(client_p, &me, "D-lined");
# Line 477 | Line 434 | check_conf_klines(void)
434   * ban_them
435   *
436   * inputs       - pointer to client to ban
437 < *              - pointer to ConfItem
437 > *              - pointer to MaskItem
438   * output       - NONE
439   * side effects - given client_p is banned
440   */
441   static void
442 < ban_them(struct Client *client_p, struct ConfItem *conf)
442 > ban_them(struct Client *client_p, struct MaskItem *conf)
443   {
444    const char *user_reason = NULL;       /* What is sent to user */
488  const char *channel_reason = NULL;    /* What is sent to channel */
489  struct AccessItem *aconf = NULL;
490  struct MatchItem *xconf = NULL;
445    const char *type_string = NULL;
446    const char dline_string[] = "D-line";
447    const char kline_string[] = "K-line";
# Line 496 | Line 450 | ban_them(struct Client *client_p, struct
450  
451    switch (conf->type)
452    {
453 <    case RKLINE_TYPE:
454 <    case KLINE_TYPE:
453 >    case CONF_RKLINE:
454 >    case CONF_KLINE:
455        type_string = kline_string;
502      aconf = map_to_conf(conf);
456        break;
457 <    case DLINE_TYPE:
457 >    case CONF_DLINE:
458        type_string = dline_string;
506      aconf = map_to_conf(conf);
459        break;
460 <    case GLINE_TYPE:
460 >    case CONF_GLINE:
461        type_string = gline_string;
510      aconf = map_to_conf(conf);
462        break;
463 <    case RXLINE_TYPE:
464 <    case XLINE_TYPE:
463 >    case CONF_RXLINE:
464 >    case CONF_XLINE:
465        type_string = xline_string;
466 <      xconf = map_to_conf(conf);
516 <      ++xconf->count;
466 >      ++conf->count;
467        break;
468      default:
469        assert(0);
470        break;
471    }
472  
473 <  if (ConfigFileEntry.kline_with_reason)
524 <  {
525 <    if (aconf != NULL)
526 <      user_reason = aconf->reason ? aconf->reason : type_string;
527 <    if (xconf != NULL)
528 <      user_reason = xconf->reason ? xconf->reason : type_string;
529 <  }
530 <  else
531 <    user_reason = type_string;
532 <
533 <  if (ConfigFileEntry.kline_reason != NULL)
534 <    channel_reason = ConfigFileEntry.kline_reason;
535 <  else
536 <    channel_reason = user_reason;
473 >  user_reason = conf->reason ? conf->reason : type_string;
474  
475 <  sendto_realops_flags(UMODE_ALL, L_ALL, "%s active for %s",
475 >  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s active for %s",
476                         type_string, get_client_name(client_p, HIDE_IP));
477  
478    if (IsClient(client_p))
479      sendto_one(client_p, form_str(ERR_YOUREBANNEDCREEP),
480                 me.name, client_p->name, user_reason);
481  
482 <  exit_client(client_p, &me, channel_reason);
482 >  exit_client(client_p, &me, user_reason);
483   }
484  
485   /* update_client_exit_stats()
# Line 554 | Line 491 | ban_them(struct Client *client_p, struct
491   static void
492   update_client_exit_stats(struct Client *client_p)
493   {
494 <  if (IsServer(client_p))
558 <  {
559 <    sendto_realops_flags(UMODE_EXTERNAL, L_ALL,
560 <                         "Server %s split from %s",
561 <                         client_p->name, client_p->servptr->name);
562 <  }
563 <  else if (IsClient(client_p))
494 >  if (IsClient(client_p))
495    {
496 +    assert(Count.total > 0);
497      --Count.total;
498 <    if (IsOper(client_p))
498 >    if (HasUMode(client_p, UMODE_OPER))
499        --Count.oper;
500 <    if (IsInvisible(client_p))
500 >    if (HasUMode(client_p, UMODE_INVISIBLE))
501        --Count.invisi;
502    }
503 +  else if (IsServer(client_p))
504 +    sendto_realops_flags(UMODE_EXTERNAL, L_ALL, SEND_NOTICE,
505 +                         "Server %s split from %s",
506 +                         client_p->name, client_p->servptr->name);
507  
508    if (splitchecking && !splitmode)
509      check_splitmode(NULL);
# Line 579 | Line 515 | update_client_exit_stats(struct Client *
515   * output       - return client pointer
516   * side effects - find person by (nick)name
517   */
582 /* XXX - ugly wrapper */
518   struct Client *
519   find_person(const struct Client *client_p, const char *name)
520   {
521 <  struct Client *c2ptr;
521 >  struct Client *c2ptr = NULL;
522  
523    if (IsDigit(*name))
524    {
525      if ((c2ptr = hash_find_id(name)) != NULL)
526      {
527        /* invisible users shall not be found by UID guessing */
528 <      if (IsInvisible(c2ptr) && !IsServer(client_p))
529 <        c2ptr = NULL;
528 >      if (HasUMode(c2ptr, UMODE_INVISIBLE))
529 >        if (!IsServer(client_p) && !HasFlag(client_p, FLAGS_SERVICE))
530 >          c2ptr = NULL;
531      }
532    }
533    else
534 <    c2ptr = find_client(name);
534 >    c2ptr = hash_find_client(name);
535  
536    return ((c2ptr != NULL && IsClient(c2ptr)) ? c2ptr : NULL);
537   }
# Line 615 | Line 551 | find_chasing(struct Client *client_p, st
551      *chasing = 0;
552  
553    if (who)
554 <    return(who);
554 >    return who;
555  
556    if (IsDigit(*user))
557 <    return(NULL);
557 >    return NULL;
558  
559    if ((who = get_history(user,
560                          (time_t)ConfigFileEntry.kill_chase_time_limit))
# Line 626 | Line 562 | find_chasing(struct Client *client_p, st
562    {
563      sendto_one(source_p, form_str(ERR_NOSUCHNICK),
564                 me.name, source_p->name, user);
565 <    return(NULL);
565 >    return NULL;
566    }
567  
568    if (chasing)
569      *chasing = 1;
570  
571 <  return(who);
571 >  return who;
572   }
573  
574   /*
# Line 654 | Line 590 | find_chasing(struct Client *client_p, st
590   *        to modify what it points!!!
591   */
592   const char *
593 < get_client_name(struct Client *client, int showip)
593 > get_client_name(const struct Client *client, enum addr_mask_type type)
594   {
595    static char nbuf[HOSTLEN * 2 + USERLEN + 5];
596  
597    assert(client != NULL);
598  
599 <  if (irccmp(client->name, client->host) == 0)
600 <    return(client->name);
599 >  if (!MyConnect(client))
600 >    return client->name;
601  
602 <  if (ConfigServerHide.hide_server_ips)
603 <    if (IsServer(client) || IsConnecting(client) || IsHandshake(client))
604 <      showip = MASK_IP;
602 >  if (IsServer(client) || IsConnecting(client) || IsHandshake(client))
603 >  {
604 >    if (!irccmp(client->name, client->host))
605 >      return client->name;
606 >    else if (ConfigServerHide.hide_server_ips)
607 >      type = MASK_IP;
608 >  }
609  
610    if (ConfigFileEntry.hide_spoof_ips)
611 <    if (showip == SHOW_IP && IsIPSpoof(client))
612 <      showip = MASK_IP;
611 >    if (type == SHOW_IP && IsIPSpoof(client))
612 >      type = MASK_IP;
613  
614    /* And finally, let's get the host information, ip or name */
615 <  switch (showip)
615 >  switch (type)
616    {
617      case SHOW_IP:
618 <      if (MyConnect(client))
619 <      {
620 <        ircsprintf(nbuf, "%s[%s@%s]", client->name, client->username,
621 <                   client->sockhost);
682 <        break;
683 <      }
618 >      snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
619 >               client->name,
620 >               client->username, client->sockhost);
621 >      break;
622      case MASK_IP:
623 <      ircsprintf(nbuf, "%s[%s@255.255.255.255]", client->name,
624 <                 client->username);
623 >      if (client->localClient->aftype == AF_INET)
624 >        snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
625 >                 client->name, client->username);
626 >      else
627 >        snprintf(nbuf, sizeof(nbuf), "%s[%s@ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]",
628 >                 client->name, client->username);
629        break;
630      default:
631 <      ircsprintf(nbuf, "%s[%s@%s]", client->name, client->username,
632 <                 client->host);
631 >      snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
632 >               client->name,
633 >               client->username, client->host);
634    }
635  
636 <  return(nbuf);
636 >  return nbuf;
637   }
638  
639   void
640   free_exited_clients(void)
641   {
642 <  dlink_node *ptr, *next;
700 <  struct Client *target_p;
642 >  dlink_node *ptr = NULL, *next = NULL;
643    
644    DLINK_FOREACH_SAFE(ptr, next, dead_list.head)
645    {
646 <    target_p = ptr->data;
705 <
706 <    if (ptr->data == NULL)
707 <    {
708 <      sendto_realops_flags(UMODE_ALL, L_ALL,
709 <                           "Warning: null client on dead_list!");
710 <      dlinkDelete(ptr, &dead_list);
711 <      free_dlink_node(ptr);
712 <      continue;
713 <    }
714 <
715 <    free_client(target_p);
646 >    free_client(ptr->data);
647      dlinkDelete(ptr, &dead_list);
648      free_dlink_node(ptr);
649    }
# Line 731 | Line 662 | exit_one_client(struct Client *source_p,
662  
663    assert(!IsMe(source_p));
664  
665 <  if (IsServer(source_p))
735 <  {
736 <    dlinkDelete(&source_p->lnode, &source_p->servptr->serv->servers);
737 <
738 <    if ((lp = dlinkFindDelete(&global_serv_list, source_p)) != NULL)
739 <      free_dlink_node(lp);
740 <
741 <    if (!MyConnect(source_p))
742 <    {
743 <      source_p->from->serv->dep_servers--;
744 <      assert(source_p->from->serv->dep_servers > 0);
745 <    }
746 <  }
747 <  else if (IsClient(source_p))
665 >  if (IsClient(source_p))
666    {
667      if (source_p->servptr->serv != NULL)
668 <      dlinkDelete(&source_p->lnode, &source_p->servptr->serv->users);
668 >      dlinkDelete(&source_p->lnode, &source_p->servptr->serv->client_list);
669  
670 <    /* If a person is on a channel, send a QUIT notice
671 <    ** to every client (person) on the same channel (so
672 <    ** that the client can show the "**signoff" message).
673 <    ** (Note: The notice is to the local clients *only*)
674 <    */
670 >    /*
671 >     * If a person is on a channel, send a QUIT notice
672 >     * to every client (person) on the same channel (so
673 >     * that the client can show the "**signoff" message).
674 >     * (Note: The notice is to the local clients *only*)
675 >     */
676      sendto_common_channels_local(source_p, 0, ":%s!%s@%s QUIT :%s",
677                                   source_p->name, source_p->username,
678                                   source_p->host, quitmsg);
679      DLINK_FOREACH_SAFE(lp, next_lp, source_p->channel.head)
680        remove_user_from_channel(lp->data);
681  
763    /* Clean up allow lists */
764    del_all_accepts(source_p);
682      add_history(source_p, 0);
683      off_history(source_p);
684  
685 <    if (!MyConnect(source_p))
686 <    {
687 <      source_p->from->serv->dep_users--;
771 <      assert(source_p->from->serv->dep_users >= 0);
772 <    }
773 <    else
685 >    watch_check_hash(source_p, RPL_LOGOFF);
686 >
687 >    if (MyConnect(source_p))
688      {
689        /* Clean up invitefield */
690        DLINK_FOREACH_SAFE(lp, next_lp, source_p->localClient->invited.head)
691          del_invite(lp->data, source_p);
692 +
693 +      del_all_accepts(source_p);
694      }
695    }
696 +  else if (IsServer(source_p))
697 +  {
698 +    dlinkDelete(&source_p->lnode, &source_p->servptr->serv->server_list);
699 +
700 +    if ((lp = dlinkFindDelete(&global_serv_list, source_p)) != NULL)
701 +      free_dlink_node(lp);
702 +  }
703  
704    /* Remove source_p from the client lists */
705    if (HasID(source_p))
# Line 816 | Line 739 | exit_one_client(struct Client *source_p,
739   static void
740   recurse_send_quits(struct Client *original_source_p, struct Client *source_p,
741                     struct Client *from, struct Client *to, const char *comment,
742 <                   const char *splitstr, const char *myname)
742 >                   const char *splitstr)
743   {
744    dlink_node *ptr, *next;
745    struct Client *target_p;
823  int hidden = match(myname, source_p->name);
746  
747    assert(to != source_p);  /* should be already removed from serv_list */
748  
749    /* If this server can handle quit storm (QS) removal
750     * of dependents, just send the SQUIT
829   *
830   * Always check *all* dependent servers if some of them are
831   * hidden behind fakename. If so, send out the QUITs -adx
751     */
752 <  if (hidden || !IsCapable(to, CAP_QS))
753 <    DLINK_FOREACH_SAFE(ptr, next, source_p->serv->users.head)
752 >  if (!IsCapable(to, CAP_QS))
753 >    DLINK_FOREACH_SAFE(ptr, next, source_p->serv->client_list.head)
754      {
755        target_p = ptr->data;
756        sendto_one(to, ":%s QUIT :%s", target_p->name, splitstr);
757      }
758  
759 <  DLINK_FOREACH_SAFE(ptr, next, source_p->serv->servers.head)
759 >  DLINK_FOREACH_SAFE(ptr, next, source_p->serv->server_list.head)
760      recurse_send_quits(original_source_p, ptr->data, from, to,
761 <                       comment, splitstr, myname);
761 >                       comment, splitstr);
762  
763 <  if (!hidden && ((source_p == original_source_p && to != from) ||
764 <                  !IsCapable(to, CAP_QS)))
763 >  if ((source_p == original_source_p && to != from) ||
764 >                  !IsCapable(to, CAP_QS))
765    {
766      /* don't use a prefix here - we have to be 100% sure the message
767       * will be accepted without Unknown prefix etc.. */
# Line 861 | Line 780 | recurse_remove_clients(struct Client *so
780   {
781    dlink_node *ptr, *next;
782  
783 <  DLINK_FOREACH_SAFE(ptr, next, source_p->serv->users.head)
783 >  DLINK_FOREACH_SAFE(ptr, next, source_p->serv->client_list.head)
784      exit_one_client(ptr->data, quitmsg);
785  
786 <  DLINK_FOREACH_SAFE(ptr, next, source_p->serv->servers.head)
786 >  DLINK_FOREACH_SAFE(ptr, next, source_p->serv->server_list.head)
787    {
788      recurse_remove_clients(ptr->data, quitmsg);
789      exit_one_client(ptr->data, quitmsg);
790    }
872
873  assert(source_p->serv->dep_servers == 1);
874  assert(source_p->serv->dep_users == 0);
791   }
792  
793   /*
# Line 883 | Line 799 | static void
799   remove_dependents(struct Client *source_p, struct Client *from,
800                    const char *comment, const char *splitstr)
801   {
802 <  struct Client *to;
887 <  struct ConfItem *conf;
888 <  static char myname[HOSTLEN+1];
889 <  dlink_node *ptr;
802 >  dlink_node *ptr = NULL;
803  
804    DLINK_FOREACH(ptr, serv_list.head)
805 <  {
806 <    to = ptr->data;
894 <
895 <    if ((conf = to->serv->sconf) != NULL)
896 <      strlcpy(myname, my_name_for_link(conf), sizeof(myname));
897 <    else
898 <      strlcpy(myname, me.name, sizeof(myname));
899 <    recurse_send_quits(source_p, source_p, from, to,
900 <                       comment, splitstr, myname);
901 <  }
805 >    recurse_send_quits(source_p, source_p, from, ptr->data,
806 >                       comment, splitstr);
807  
808    recurse_remove_clients(source_p, splitstr);
809   }
# Line 908 | Line 813 | remove_dependents(struct Client *source_
813   * this on any struct Client, regardless of its state.
814   *
815   * Note, you shouldn't exit remote _users_ without first doing
816 < * SetKilled and propagating a kill or similar message. However,
817 < * it is perfectly correct to call exit_client to force a _server_
816 > * AddFlag(x, FLAGS_KILLED) and propagating a kill or similar message.
817 > * However, it is perfectly correct to call exit_client to force a _server_
818   * quit (either local or remote one).
819   *
820   * inputs:       - a client pointer that is going to be exited
# Line 924 | Line 829 | remove_dependents(struct Client *source_
829   void
830   exit_client(struct Client *source_p, struct Client *from, const char *comment)
831   {
832 <  dlink_node *m;
832 >  dlink_node *m = NULL;
833  
834    if (MyConnect(source_p))
835    {
# Line 939 | Line 844 | exit_client(struct Client *source_p, str
844      if (IsIpHash(source_p))
845        remove_one_ip(&source_p->localClient->ip);
846  
847 <    delete_auth(source_p);
847 >    if (source_p->localClient->auth)
848 >    {
849 >      delete_auth(source_p->localClient->auth);
850 >      source_p->localClient->auth = NULL;
851 >    }
852  
853 <    /* This source_p could have status of one of STAT_UNKNOWN, STAT_CONNECTING
853 >    /*
854 >     * This source_p could have status of one of STAT_UNKNOWN, STAT_CONNECTING
855       * STAT_HANDSHAKE or STAT_UNKNOWN
856       * all of which are lumped together into unknown_list
857       *
# Line 949 | Line 859 | exit_client(struct Client *source_p, str
859       */
860      if (!IsRegistered(source_p))
861      {
862 <      if ((m = dlinkFindDelete(&unknown_list, source_p)) != NULL)
863 <        free_dlink_node(m);
862 >      assert(dlinkFind(&unknown_list, source_p));
863 >
864 >      dlinkDelete(&source_p->localClient->lclient_node, &unknown_list);
865      }
866      else if (IsClient(source_p))
867      {
868 +      time_t on_for = CurrentTime - source_p->localClient->firsttime;
869 +      assert(Count.local > 0);
870        Count.local--;
871  
872 <      if (IsOper(source_p))
960 <      {
872 >      if (HasUMode(source_p, UMODE_OPER))
873          if ((m = dlinkFindDelete(&oper_list, source_p)) != NULL)
874            free_dlink_node(m);
963      }
875  
876 +      assert(dlinkFind(&local_client_list, source_p));
877        dlinkDelete(&source_p->localClient->lclient_node, &local_client_list);
878 +
879        if (source_p->localClient->list_task != NULL)
880          free_list_task(source_p->localClient->list_task, source_p);
881  
882 <      sendto_realops_flags(UMODE_CCONN, L_ALL, "Client exiting: %s (%s@%s) [%s] [%s]",
882 >      watch_del_watch_list(source_p);
883 >      sendto_realops_flags(UMODE_CCONN, L_ALL, SEND_NOTICE,
884 >                           "Client exiting: %s (%s@%s) [%s] [%s]",
885                             source_p->name, source_p->username, source_p->host, comment,
886                             ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
887                             "255.255.255.255" : source_p->sockhost);
888 +      sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, SEND_NOTICE,
889 +                           "CLIEXIT: %s %s %s %s 0 %s",
890 +                           source_p->name,
891 +                           source_p->username,
892 +                           source_p->host,
893 +                           ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
894 +                           "255.255.255.255" : source_p->sockhost,
895 +                           comment);
896 +      ilog(LOG_TYPE_USER, "%s (%3u:%02u:%02u): %s!%s@%s %llu/%llu",
897 +           myctime(source_p->localClient->firsttime), (unsigned int)(on_for / 3600),
898 +           (unsigned int)((on_for % 3600)/60), (unsigned int)(on_for % 60),
899 +           source_p->name, source_p->username, source_p->host,
900 +           source_p->localClient->send.bytes>>10,
901 +           source_p->localClient->recv.bytes>>10);
902 +    }
903 +    else if (IsServer(source_p))
904 +    {
905 +      assert(Count.myserver > 0);
906 +      --Count.myserver;
907 +
908 +      assert(dlinkFind(&serv_list, source_p));
909 +      dlinkDelete(&source_p->localClient->lclient_node, &serv_list);
910 +      unset_chcap_usage_counts(source_p);
911      }
912  
975    /* As soon as a client is known to be a server of some sort
976     * it has to be put on the serv_list, or SJOIN's to this new server
977     * from the connect burst will not be seen.
978     */
979    if (IsServer(source_p) || IsConnecting(source_p) ||
980        IsHandshake(source_p))
981    {
982      if ((m = dlinkFindDelete(&serv_list, source_p)) != NULL)
983      {
984        free_dlink_node(m);
985        unset_chcap_usage_counts(source_p);
986      }
987
988      if (IsServer(source_p))
989      {
990        Count.myserver--;
991        if (ServerInfo.hub)
992          remove_lazylink_flags(source_p->localClient->serverMask);
993        else
994          uplink = NULL;
995      }
996    }
997
998    log_user_exit(source_p);
999
913      if (!IsDead(source_p))
914      {
915        if (IsServer(source_p))
# Line 1032 | Line 945 | exit_client(struct Client *source_p, str
945      assert(source_p->serv != NULL && source_p->servptr != NULL);
946  
947      if (ConfigServerHide.hide_servers)
948 <      /* set netsplit message to "*.net *.split" to still show
948 >      /*
949 >       * Set netsplit message to "*.net *.split" to still show
950         * that its a split, but hide the servers splitting
951         */
952        strcpy(splitstr, "*.net *.split");
# Line 1044 | Line 958 | exit_client(struct Client *source_p, str
958  
959      if (source_p->servptr == &me)
960      {
961 <      sendto_realops_flags(UMODE_ALL, L_ALL,
961 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
962                             "%s was connected for %d seconds.  %llu/%llu sendK/recvK.",
963 <                           source_p->name, (int)(CurrentTime - source_p->firsttime),
963 >                           source_p->name, (int)(CurrentTime - source_p->localClient->firsttime),
964                             source_p->localClient->send.bytes >> 10,
965                             source_p->localClient->recv.bytes >> 10);
966 <      ilog(L_NOTICE, "%s was connected for %d seconds.  %llu/%llu sendK/recvK.",
967 <           source_p->name, (int)(CurrentTime - source_p->firsttime),
966 >      ilog(LOG_TYPE_IRCD, "%s was connected for %d seconds.  %llu/%llu sendK/recvK.",
967 >           source_p->name, (int)(CurrentTime - source_p->localClient->firsttime),
968             source_p->localClient->send.bytes >> 10,
969             source_p->localClient->recv.bytes >> 10);
970      }
971    }
972 <  else if (IsClient(source_p) && !IsKilled(source_p))
972 >  else if (IsClient(source_p) && !HasFlag(source_p, FLAGS_KILLED))
973    {
974 <    sendto_server(from->from, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS,
974 >    sendto_server(from->from, CAP_TS6, NOCAPS,
975                    ":%s QUIT :%s", ID(source_p), comment);
976 <    sendto_server(from->from, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS,
976 >    sendto_server(from->from, NOCAPS, CAP_TS6,
977                    ":%s QUIT :%s", source_p->name, comment);
978    }
979  
# Line 1118 | Line 1032 | dead_link_on_read(struct Client *client_
1032  
1033    if (IsServer(client_p) || IsHandshake(client_p))
1034    {
1035 <    int connected = CurrentTime - client_p->firsttime;
1035 >    int connected = CurrentTime - client_p->localClient->firsttime;
1036        
1037      if (error == 0)
1038      {
1039        /* Admins get the real IP */
1040 <      sendto_realops_flags(UMODE_ALL, L_ADMIN,
1040 >      sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1041                             "Server %s closed the connection",
1042                             get_client_name(client_p, SHOW_IP));
1043  
1044        /* Opers get a masked IP */
1045 <      sendto_realops_flags(UMODE_ALL, L_OPER,
1045 >      sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1046                             "Server %s closed the connection",
1047                             get_client_name(client_p, MASK_IP));
1048  
1049 <      ilog(L_NOTICE, "Server %s closed the connection",
1049 >      ilog(LOG_TYPE_IRCD, "Server %s closed the connection",
1050             get_client_name(client_p, SHOW_IP));
1051      }
1052      else
# Line 1143 | Line 1057 | dead_link_on_read(struct Client *client_
1057                     get_client_name(client_p, MASK_IP), current_error);
1058      }
1059  
1060 <    sendto_realops_flags(UMODE_ALL, L_ALL,
1060 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1061                           "%s had been connected for %d day%s, %2d:%02d:%02d",
1062                           client_p->name, connected/86400,
1063                           (connected/86400 == 1) ? "" : "s",
# Line 1155 | Line 1069 | dead_link_on_read(struct Client *client_
1069      strlcpy(errmsg, "Remote host closed the connection",
1070              sizeof(errmsg));
1071    else
1072 <    ircsprintf(errmsg, "Read error: %s",
1073 <               strerror(current_error));
1072 >    snprintf(errmsg, sizeof(errmsg), "Read error: %s",
1073 >             strerror(current_error));
1074  
1075    exit_client(client_p, &me, errmsg);
1076   }
# Line 1175 | Line 1089 | exit_aborted_clients(void)
1089  
1090      if (target_p == NULL)
1091      {
1092 <      sendto_realops_flags(UMODE_ALL, L_ALL,
1092 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1093                             "Warning: null client on abort_list!");
1094        dlinkDelete(ptr, &abort_list);
1095        free_dlink_node(ptr);
# Line 1196 | Line 1110 | exit_aborted_clients(void)
1110  
1111   /*
1112   * accept processing, this adds a form of "caller ID" to ircd
1113 < *
1113 > *
1114   * If a client puts themselves into "caller ID only" mode,
1115 < * only clients that match a client pointer they have put on
1115 > * only clients that match a client pointer they have put on
1116   * the accept list will be allowed to message them.
1117   *
1118 < * [ source.on_allow_list ] -> [ target1 ] -> [ target2 ]
1205 < *
1206 < * [target.allow_list] -> [ source1 ] -> [source2 ]
1207 < *
1208 < * i.e. a target will have a link list of source pointers it will allow
1209 < * each source client then has a back pointer pointing back
1210 < * to the client that has it on its accept list.
1211 < * This allows for exit_one_client to remove these now bogus entries
1212 < * from any client having an accept on them.
1118 > * Diane Bruce, "Dianora" db@db.net
1119   */
1120  
1121 < /* accept_message()
1122 < *
1217 < * inputs       - pointer to source client
1218 < *              - pointer to target client
1219 < * output       - 1 if accept this message 0 if not
1220 < * side effects - See if source is on target's allow list
1221 < */
1222 < int
1223 < accept_message(struct Client *source, struct Client *target)
1121 > void
1122 > del_accept(struct split_nuh_item *accept_p, struct Client *client_p)
1123   {
1124 <  dlink_node *ptr;
1226 <
1227 <  DLINK_FOREACH(ptr, target->allow_list.head)
1228 <  {
1229 <    struct Client *target_p = ptr->data;
1124 >  dlinkDelete(&accept_p->node, &client_p->localClient->acceptlist);
1125  
1126 <    if (source == target_p)
1127 <      return (1);
1128 <  }
1129 <
1235 <  if (IsSoftCallerId(target))
1236 <  {
1237 <    DLINK_FOREACH(ptr, target->channel.head)
1238 <      if (IsMember(source, ((struct Membership *)ptr->data)->chptr))
1239 <        return (1);
1240 <  }
1241 <
1242 <  return (0);
1126 >  MyFree(accept_p->nickptr);
1127 >  MyFree(accept_p->userptr);
1128 >  MyFree(accept_p->hostptr);
1129 >  MyFree(accept_p);
1130   }
1131  
1132 < /* del_from_accept()
1133 < *
1134 < * inputs       - pointer to source client
1248 < *              - pointer to target client
1249 < * output       - NONE
1250 < * side effects - Delete's source pointer to targets allow list
1251 < *
1252 < * Walk through the target's accept list, remove if source is found,
1253 < * Then walk through the source's on_accept_list remove target if found.
1254 < */
1255 < void
1256 < del_from_accept(struct Client *source, struct Client *target)
1132 > struct split_nuh_item *
1133 > find_accept(const char *nick, const char *user,
1134 >            const char *host, struct Client *client_p, int do_match)
1135   {
1136 <  dlink_node *ptr;
1137 <  dlink_node *ptr2;
1138 <  dlink_node *next_ptr;
1261 <  dlink_node *next_ptr2;
1262 <  struct Client *target_p;
1136 >  dlink_node *ptr = NULL;
1137 >  /* XXX We wouldn't need that if match() would return 0 on match */
1138 >  int (*cmpfunc)(const char *, const char *) = do_match ? match : irccmp;
1139  
1140 <  DLINK_FOREACH_SAFE(ptr, next_ptr, target->allow_list.head)
1140 >  DLINK_FOREACH(ptr, client_p->localClient->acceptlist.head)
1141    {
1142 <    target_p = ptr->data;
1267 <
1268 <    if (source == target_p)
1269 <    {
1270 <      dlinkDelete(ptr, &target->allow_list);
1271 <      free_dlink_node(ptr);
1142 >    struct split_nuh_item *accept_p = ptr->data;
1143  
1144 <      DLINK_FOREACH_SAFE(ptr2, next_ptr2, source->on_allow_list.head)
1145 <      {
1146 <        target_p = ptr2->data;
1147 <
1277 <        if (target == target_p)
1278 <        {
1279 <          dlinkDelete(ptr2, &source->on_allow_list);
1280 <          free_dlink_node(ptr2);
1281 <        }
1282 <      }
1283 <    }
1144 >    if (cmpfunc(accept_p->nickptr, nick) == do_match &&
1145 >        cmpfunc(accept_p->userptr, user) == do_match &&
1146 >        cmpfunc(accept_p->hostptr, host) == do_match)
1147 >      return accept_p;
1148    }
1285 }
1286
1287 /* del_all_accepts()
1288 *
1289 * inputs       - pointer to exiting client
1290 * output       - NONE
1291 * side effects - Walk through given clients allow_list and on_allow_list
1292 *                remove all references to this client
1293 */
1294 void
1295 del_all_accepts(struct Client *client_p)
1296 {
1297  dlink_node *ptr, *next_ptr;
1298
1299  DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->allow_list.head)
1300    del_from_accept(ptr->data, client_p);
1149  
1150 <  DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head)
1303 <    del_from_accept(client_p, ptr->data);
1150 >  return NULL;
1151   }
1152  
1153 < /* del_all_their_accepts()
1307 < *
1308 < * inputs       - pointer to exiting client
1309 < * output       - NONE
1310 < * side effects - Walk through given clients on_allow_list
1311 < *                remove all references to this client,
1312 < *                allow this client to keep their own allow_list
1313 < */
1314 < void
1315 < del_all_their_accepts(struct Client *client_p)
1316 < {
1317 <  dlink_node *ptr, *next_ptr;
1318 <
1319 <  DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head)
1320 <    del_from_accept(client_p, ptr->data);
1321 < }
1322 <
1323 < /* set_initial_nick()
1324 < *
1325 < * inputs
1326 < * output
1327 < * side effects -
1153 > /* accept_message()
1154   *
1155 < * This function is only called to set up an initially registering
1156 < * client.
1155 > * inputs       - pointer to source client
1156 > *              - pointer to target client
1157 > * output       - 1 if accept this message 0 if not
1158 > * side effects - See if source is on target's allow list
1159   */
1160 < void
1161 < set_initial_nick(struct Client *client_p, struct Client *source_p,
1162 <                 const char *nick)
1160 > int
1161 > accept_message(struct Client *source,
1162 >               struct Client *target)
1163   {
1164 < char buf[USERLEN + 1];
1337 <
1338 <  /* Client setting NICK the first time */
1339 <  
1340 <  /* This had to be copied here to avoid problems.. */
1341 <  source_p->tsinfo = CurrentTime;
1342 <  source_p->localClient->registration &= ~REG_NEED_NICK;
1164 >  dlink_node *ptr = NULL;
1165  
1166 <  if (source_p->name[0])
1167 <    hash_del_client(source_p);
1166 >  if (source == target || find_accept(source->name, source->username,
1167 >                                      source->host, target, 1))
1168 >    return 1;
1169  
1170 <  strlcpy(source_p->name, nick, sizeof(source_p->name));
1171 <  hash_add_client(source_p);
1172 <
1173 <  /* fd_desc is long enough */
1351 <  fd_note(&client_p->localClient->fd, "Nick: %s", nick);
1352 <  
1353 <  /* They have the nick they want now.. */
1354 <  client_p->llname[0] = '\0';
1355 <
1356 <  if (!source_p->localClient->registration)
1357 <  {
1358 <    strlcpy(buf, source_p->username, sizeof(buf));
1170 >  if (HasUMode(target, UMODE_SOFTCALLERID))
1171 >    DLINK_FOREACH(ptr, target->channel.head)
1172 >      if (IsMember(source, ((struct Membership *)ptr->data)->chptr))
1173 >        return 1;
1174  
1175 <    /*
1361 <     * USER already received, now we have NICK.
1362 <     * *NOTE* For servers "NICK" *must* precede the
1363 <     * user message (giving USER before NICK is possible
1364 <     * only for local client connection!). register_user
1365 <     * may reject the client and call exit_client for it
1366 <     * --must test this and exit m_nick too!!!
1367 <     */
1368 <    register_local_user(client_p, source_p, nick, buf);
1369 <  }
1175 >  return 0;
1176   }
1177  
1178 < /* change_local_nick()
1178 > /* del_all_accepts()
1179   *
1180 < * inputs       - pointer to server
1181 < *              - pointer to client
1182 < *              - nick
1377 < * output       -
1378 < * side effects - changes nick of a LOCAL user
1180 > * inputs       - pointer to exiting client
1181 > * output       - NONE
1182 > * side effects - Walk through given clients acceptlist and remove all entries
1183   */
1184   void
1185 < change_local_nick(struct Client *client_p, struct Client *source_p, const char *nick)
1185 > del_all_accepts(struct Client *client_p)
1186   {
1187 <  /*
1384 <  ** Client just changing his/her nick. If he/she is
1385 <  ** on a channel, send note of change to all clients
1386 <  ** on that channel. Propagate notice to other servers.
1387 <  */
1388 <  if ((source_p->localClient->last_nick_change +
1389 <       ConfigFileEntry.max_nick_time) < CurrentTime)
1390 <    source_p->localClient->number_of_nick_changes = 0;
1391 <  source_p->localClient->last_nick_change = CurrentTime;
1392 <  source_p->localClient->number_of_nick_changes++;
1393 <
1394 <  if ((ConfigFileEntry.anti_nick_flood &&
1395 <      (source_p->localClient->number_of_nick_changes
1396 <       <= ConfigFileEntry.max_nick_changes)) ||
1397 <     !ConfigFileEntry.anti_nick_flood ||
1398 <     (IsOper(source_p) && ConfigFileEntry.no_oper_flood))
1399 <  {
1400 <    if (irccmp(source_p->name, nick))
1401 <      source_p->tsinfo = CurrentTime;
1402 <
1403 <    /* XXX - the format of this notice should eventually be changed
1404 <     * to either %s[%s@%s], or even better would be get_client_name() -bill
1405 <     */
1406 <    sendto_realops_flags(UMODE_NCHANGE, L_ALL, "Nick change: From %s to %s [%s@%s]",
1407 <                         source_p->name, nick, source_p->username, source_p->host);
1408 <    sendto_common_channels_local(source_p, 1, ":%s!%s@%s NICK :%s",
1409 <                                 source_p->name, source_p->username,
1410 <                                 source_p->host, nick);
1411 <
1412 <    add_history(source_p, 1);
1413 <          
1414 <         /* Only hubs care about lazy link nicks not being sent on yet
1415 <           * lazylink leafs/leafs always send their nicks up to hub,
1416 <           * hence must always propagate nick changes.
1417 <           * hubs might not propagate a nick change, if the leaf
1418 <           * does not know about that client yet.
1419 <           */
1420 <    sendto_server(client_p, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS,
1421 <                  ":%s NICK %s :%lu",
1422 <                  ID(source_p), nick, (unsigned long)source_p->tsinfo);
1423 <    sendto_server(client_p, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS,
1424 <                  ":%s NICK %s :%lu",
1425 <                  source_p->name, nick, (unsigned long)source_p->tsinfo);
1426 <  }
1427 <  else
1428 <  {
1429 <    sendto_one(source_p, form_str(ERR_NICKTOOFAST),
1430 <               me.name, source_p->name, source_p->name,
1431 <               nick, ConfigFileEntry.max_nick_time);
1432 <    return;
1433 <  }
1434 <
1435 <  /* Finally, add to hash */
1436 <  if (source_p->name[0])
1437 <    hash_del_client(source_p);
1438 <
1439 <  strcpy(source_p->name, nick);
1440 <  hash_add_client(source_p);
1441 <
1442 <  /* Make sure everyone that has this client on its accept list
1443 <   * loses that reference.
1444 <   */
1445 <  del_all_their_accepts(source_p);
1187 >  dlink_node *ptr = NULL, *next_ptr = NULL;
1188  
1189 <  /* fd_desc is long enough */
1190 <  fd_note(&client_p->localClient->fd, "Nick: %s", nick);
1189 >  DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->acceptlist.head)
1190 >    del_accept(ptr->data, client_p);
1191   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)