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

Comparing ircd-hybrid-7.2/src/s_user.c (file contents):
Revision 882 by michael, Sun Oct 28 11:58:39 2007 UTC vs.
Revision 980 by michael, Sun Aug 9 12:51:45 2009 UTC

# Line 35 | Line 35
35   #include "irc_string.h"
36   #include "sprintf_irc.h"
37   #include "s_bsd.h"
38 – #include "irc_getnameinfo.h"
38   #include "ircd.h"
39   #include "list.h"
40   #include "listener.h"
# Line 44 | Line 43
43   #include "s_conf.h"
44   #include "s_log.h"
45   #include "s_serv.h"
47 – #include "s_stats.h"
46   #include "send.h"
47   #include "supported.h"
48   #include "whowas.h"
# Line 287 | Line 285 | register_local_user(struct Client *clien
285                      const char *nick, const char *username)
286   {
287    const struct AccessItem *aconf = NULL;
290 –  char ipaddr[HOSTIPLEN];
288    dlink_node *ptr = NULL;
289    dlink_node *m = NULL;
290  
# Line 339 | Line 336 | register_local_user(struct Client *clien
336  
337      if (IsNeedIdentd(aconf))
338      {
339 <      ServerStats->is_ref++;
339 >      ++ServerStats.is_ref;
340        sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You need to install "
341                   "identd to use this server", me.name, source_p->name);
342        exit_client(source_p, &me, "Install identd");
# Line 368 | Line 365 | register_local_user(struct Client *clien
365  
366      if (!match_conf_password(pass, aconf))
367      {
368 <      ServerStats->is_ref++;
368 >      ++ServerStats.is_ref;
369        sendto_one(source_p, form_str(ERR_PASSWDMISMATCH),
370                   me.name, source_p->name);
371        exit_client(source_p, &me, "Bad Password");
# Line 384 | Line 381 | register_local_user(struct Client *clien
381    /* report if user has &^>= etc. and set flags as needed in source_p */
382    report_and_set_user_flags(source_p, aconf);
383  
384 +  if (IsDead(client_p))
385 +    return;
386 +
387    /* Limit clients -
388     * We want to be able to have servers and F-line clients
389     * connect, so save room for "buffer" connections.
# Line 398 | Line 398 | register_local_user(struct Client *clien
398      sendto_realops_flags(UMODE_FULL, L_ALL,
399                           "Too many clients, rejecting %s[%s].",
400                           nick, source_p->host);
401 <    ServerStats->is_ref++;
401 >    ++ServerStats.is_ref;
402      exit_client(source_p, &me, "Sorry, server is full - try later");
403      return;
404    }
# Line 410 | Line 410 | register_local_user(struct Client *clien
410  
411      sendto_realops_flags(UMODE_REJ, L_ALL, "Invalid username: %s (%s@%s)",
412                           nick, source_p->username, source_p->host);
413 <    ServerStats->is_ref++;
413 >    ++ServerStats.is_ref;
414      ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username);
415      exit_client(source_p, &me, tmpstr2);
416      return;
# Line 421 | Line 421 | register_local_user(struct Client *clien
421    if (check_xline(source_p))
422      return;
423  
424 –  if (IsDead(client_p))
425 –    return;
426 –
424    if (me.id[0])
425    {
426      const char *id = execute_callback(uid_get_cb, source_p);
# Line 435 | Line 432 | register_local_user(struct Client *clien
432      hash_add_id(source_p);
433    }
434  
438 –  irc_getnameinfo((struct sockaddr *)&source_p->localClient->ip,
439 –                  source_p->localClient->ip.ss_len, ipaddr,
440 –                  HOSTIPLEN, NULL, 0, NI_NUMERICHOST);
441 –
435    sendto_realops_flags(UMODE_CCONN, L_ALL,
436                         "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
437                         nick, source_p->username, source_p->host,
438                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
439 <                       "255.255.255.255" : ipaddr, get_client_class(source_p),
439 >                       "255.255.255.255" : source_p->sockhost,
440 >                       get_client_class(source_p),
441                         source_p->info);
442  
443    sendto_realops_flags(UMODE_CCONN_FULL, L_ALL,
444                         "CLICONN %s %s %s %s %s %s %s 0 %s",
445                         nick, source_p->username, source_p->host,
446                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
447 <                       "255.255.255.255" : ipaddr,
447 >                       "255.255.255.255" : source_p->sockhost,
448                         get_client_class(source_p),
449                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
450                             "<hidden>" : source_p->client_host,
# Line 459 | Line 453 | register_local_user(struct Client *clien
453                         source_p->info);
454  
455  
462 –  /* If they have died in send_* don't do anything. */
463 –  if (IsDead(source_p))
464 –    return;
465 –
456    if (ConfigFileEntry.invisible_on_connect)
457    {
458      source_p->umodes |= UMODE_INVISIBLE;
459 <    Count.invisi++;
459 >    ++Count.invisi;
460    }
461  
462    if ((++Count.local) > Count.max_loc)
# Line 481 | Line 471 | register_local_user(struct Client *clien
471    SetClient(source_p);
472  
473    source_p->servptr = &me;
474 <  dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users);
474 >  dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list);
475  
476    /* Increment our total user count here */
477    if (++Count.total > Count.max_tot)
478      Count.max_tot = Count.total;
479 <  Count.totalrestartcount++;
479 >  ++Count.totalrestartcount;
480  
481    source_p->localClient->allow_read = MAX_FLOOD_BURST;
482  
# Line 571 | Line 561 | register_remote_user(struct Client *clie
561    if (++Count.total > Count.max_tot)
562      Count.max_tot = Count.total;
563  
574 –  ++source_p->from->serv->dep_users;
575 –
564    SetClient(source_p);
565 <  dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users);
565 >  dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list);
566    add_user_host(source_p->username, source_p->host, 1);
567    SetUserHost(source_p);
568  
# Line 609 | Line 597 | introduce_client(struct Client *client_p
597      ubuf[1] = '\0';
598    }
599  
600 <  /* arghhh one could try not introducing new nicks to ll leafs
613 <   * but then you have to introduce them "on the fly" in SJOIN
614 <   * not fun.
615 <   * Its not going to cost much more bandwidth to simply let new
616 <   * nicks just ride on through.
617 <   */
618 <
619 <  /* We now introduce nicks "on the fly" in SJOIN anyway --
620 <   * you _need_ to if you aren't going to burst everyone initially.
621 <   *
622 <   * Only send to non CAP_LL servers, unless we're a lazylink leaf,
623 <   * in that case just send it to the uplink.
624 <   * -davidt
625 <   * rewritten to cope with SIDs .. eww eww eww --is
626 <   */
627 <  if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL) &&
628 <      client_p != uplink)
600 >  DLINK_FOREACH(server_node, serv_list.head)
601    {
602 <    if (IsCapable(uplink, CAP_TS6) && HasID(source_p))
603 <    {
604 <      sendto_one(uplink, ":%s UID %s %d %lu %s %s %s %s %s :%s",
602 >    struct Client *server = server_node->data;
603 >
604 >    if (server == client_p)
605 >        continue;
606 >
607 >    if (IsCapable(server, CAP_TS6) && HasID(source_p))
608 >      sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s",
609                   source_p->servptr->id,
610                   source_p->name, source_p->hopcount+1,
611                   (unsigned long)source_p->tsinfo,
612                   ubuf, source_p->username, source_p->host,
613                   (MyClient(source_p) && IsIPSpoof(source_p)) ?
614                   "0" : source_p->sockhost, source_p->id, source_p->info);
639 –    }
615      else
616 <    {
642 <      sendto_one(uplink, "NICK %s %d %lu %s %s %s %s :%s",
616 >      sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s",
617                   source_p->name, source_p->hopcount+1,
618                   (unsigned long)source_p->tsinfo,
619                   ubuf, source_p->username, source_p->host,
620                   source_p->servptr->name, source_p->info);
647 –    }
648 –  }
649 –  else
650 –  {
651 –    DLINK_FOREACH(server_node, serv_list.head)
652 –    {
653 –      struct Client *server = server_node->data;
654 –
655 –      if (IsCapable(server, CAP_LL) || server == client_p)
656 –        continue;
657 –
658 –      if (IsCapable(server, CAP_TS6) && HasID(source_p))
659 –        sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s",
660 –                   source_p->servptr->id,
661 –                   source_p->name, source_p->hopcount+1,
662 –                   (unsigned long)source_p->tsinfo,
663 –                   ubuf, source_p->username, source_p->host,
664 –                   (MyClient(source_p) && IsIPSpoof(source_p)) ?
665 –                   "0" : source_p->sockhost, source_p->id, source_p->info);
666 –      else
667 –        sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s",
668 –                   source_p->name, source_p->hopcount+1,
669 –                   (unsigned long)source_p->tsinfo,
670 –                   ubuf, source_p->username, source_p->host,
671 –                   source_p->servptr->name, source_p->info);
672 –    }
621    }
622   }
623  
# Line 1155 | Line 1103 | send_umode_out(struct Client *client_p,
1103        struct Client *target_p = ptr->data;
1104  
1105        if ((target_p != client_p) && (target_p != source_p))
1106 <      {
1107 <        if ((!(ServerInfo.hub && IsCapable(target_p, CAP_LL))) ||
1108 <            (target_p->localClient->serverMask &
1161 <             source_p->lazyLinkClientExists))
1162 <          sendto_one(target_p, ":%s MODE %s :%s",
1163 <                     ID_or_name(source_p, target_p),
1164 <                     ID_or_name(source_p, target_p), buf);
1165 <      }
1106 >        sendto_one(target_p, ":%s MODE %s :%s",
1107 >                   ID_or_name(source_p, target_p),
1108 >                   ID_or_name(source_p, target_p), buf);
1109      }
1110    }
1111  
# Line 1257 | Line 1200 | check_xline(struct Client *source_p)
1200                           get_client_name(source_p, HIDE_IP),
1201                           source_p->sockhost);
1202  
1203 <    ServerStats->is_ref++;
1203 >    ++ServerStats.is_ref;
1204      if (REJECT_HOLD_TIME > 0)
1205      {
1206        sendto_one(source_p, ":%s NOTICE %s :Bad user info",

Diff Legend

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