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/trunk/src/user.c (file contents):
Revision 4108 by michael, Mon Jun 30 21:02:06 2014 UTC vs.
Revision 4709 by michael, Mon Oct 6 16:52:29 2014 UTC

# Line 15 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# Line 163 | Line 163 | show_lusers(struct Client *source_p)
163   {
164    if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER))
165      sendto_one_numeric(source_p, &me, RPL_LUSERCLIENT, (Count.total-Count.invisi),
166 <                       Count.invisi, dlink_list_length(&global_serv_list));
166 >                       Count.invisi, dlink_list_length(&global_server_list));
167    else
168      sendto_one_numeric(source_p, &me, RPL_LUSERCLIENT,
169                         (Count.total - Count.invisi), Count.invisi, 1);
# Line 297 | Line 297 | introduce_client(struct Client *source_p
297      ubuf[1] = '\0';
298    }
299  
300 <  DLINK_FOREACH(ptr, serv_list.head)
300 >  DLINK_FOREACH(ptr, local_server_list.head)
301    {
302      struct Client *server = ptr->data;
303  
# Line 348 | Line 348 | user_welcome(struct Client *source_p)
348    {
349      AddUMode(source_p, UMODE_SSL);
350      sendto_one_notice(source_p, &me, ":*** Connected securely via %s",
351 <                      ssl_get_cipher(source_p->localClient->fd.ssl));
351 >                      ssl_get_cipher(source_p->connection->fd.ssl));
352    }
353   #endif
354  
355 <  sendto_one_numeric(source_p, &me, RPL_WELCOME, ServerInfo.network_name,
355 >  sendto_one_numeric(source_p, &me, RPL_WELCOME, ConfigServerInfo.network_name,
356                       source_p->name);
357    sendto_one_numeric(source_p, &me, RPL_YOURHOST,
358 <                     get_listener_name(source_p->localClient->listener), ircd_version);
358 >                     get_listener_name(source_p->connection->listener), ircd_version);
359    sendto_one_numeric(source_p, &me, RPL_CREATED, built_date);
360    sendto_one_numeric(source_p, &me, RPL_MYINFO, me.name, ircd_version, umode_buffer);
361    show_isupport(source_p);
362 <
363 <  if (source_p->id[0])
364 <    sendto_one_numeric(source_p, &me, RPL_YOURID, source_p->id);
362 >  sendto_one_numeric(source_p, &me, RPL_YOURID, source_p->id);
363  
364    show_lusers(source_p);
365    motd_signon(source_p);
# Line 415 | Line 413 | register_local_user(struct Client *sourc
413  
414    assert(source_p == source_p->from);
415    assert(MyConnect(source_p));
416 <  assert(!source_p->localClient->registration);
416 >  assert(!source_p->connection->registration);
417  
418    ClearCap(source_p, CAP_TS6);
419  
420 <  if (ConfigFileEntry.ping_cookie)
420 >  if (ConfigGeneral.ping_cookie)
421    {
422 <    if (!IsPingSent(source_p) && !source_p->localClient->random_ping)
422 >    if (!IsPingSent(source_p) && !source_p->connection->random_ping)
423      {
424        do
425 <        source_p->localClient->random_ping = genrand_int32();
426 <      while (!source_p->localClient->random_ping);
425 >        source_p->connection->random_ping = genrand_int32();
426 >      while (!source_p->connection->random_ping);
427  
428        sendto_one(source_p, "PING :%u",
429 <                 source_p->localClient->random_ping);
429 >                 source_p->connection->random_ping);
430        SetPingSent(source_p);
431        return;
432      }
# Line 437 | Line 435 | register_local_user(struct Client *sourc
435        return;
436    }
437  
438 <  source_p->localClient->last_privmsg = CurrentTime;
438 >  source_p->connection->last_privmsg = CurrentTime;
439    /* Straight up the maximum rate of flooding... */
440 <  source_p->localClient->allow_read = MAX_FLOOD_BURST;
440 >  source_p->connection->allow_read = MAX_FLOOD_BURST;
441  
442    if (!check_client(source_p))
443      return;
# Line 452 | Line 450 | register_local_user(struct Client *sourc
450              sizeof(source_p->host));
451    }
452  
453 <  conf = source_p->localClient->confs.head->data;
453 >  conf = source_p->connection->confs.head->data;
454  
455    if (!IsGotId(source_p))
456    {
# Line 483 | Line 481 | register_local_user(struct Client *sourc
481    /* Password check */
482    if (!EmptyString(conf->passwd))
483    {
484 <    if (!match_conf_password(source_p->localClient->passwd, conf))
484 >    if (!match_conf_password(source_p->connection->password, conf))
485      {
486        ++ServerStats.is_ref;
487  
# Line 494 | Line 492 | register_local_user(struct Client *sourc
492    }
493  
494    /*
495 <   * Don't free source_p->localClient->passwd here - it can be required
495 >   * Don't free source_p->connection->password here - it can be required
496     * by masked /stats I if there are auth{} blocks with need_password = no;
497     * --adx
498     */
# Line 515 | Line 513 | register_local_user(struct Client *sourc
513     * probably be just a percentage of the MAXCLIENTS...
514     *   -Taner
515     */
516 <  if ((Count.local >= ServerInfo.max_clients + MAX_BUFFER) ||
517 <      (Count.local >= ServerInfo.max_clients && !IsExemptLimits(source_p)))
516 >  if ((Count.local >= ConfigServerInfo.max_clients + MAX_BUFFER) ||
517 >      (Count.local >= ConfigServerInfo.max_clients && !IsExemptLimits(source_p)))
518    {
519      sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
520                           "Too many clients, rejecting %s[%s].",
# Line 551 | Line 549 | register_local_user(struct Client *sourc
549    sendto_realops_flags(UMODE_CCONN, L_ALL, SEND_NOTICE,
550                         "Client connecting: %s (%s@%s) [%s] {%s} [%s] <%s>",
551                         source_p->name, source_p->username, source_p->host,
552 <                       ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
552 >                       ConfigGeneral.hide_spoof_ips && IsIPSpoof(source_p) ?
553                         "255.255.255.255" : source_p->sockhost,
554 <                       get_client_class(&source_p->localClient->confs),
554 >                       get_client_class(&source_p->connection->confs),
555                         source_p->info, source_p->id);
556  
557 <  if (ConfigFileEntry.invisible_on_connect)
557 >  if (ConfigGeneral.invisible_on_connect)
558    {
559      AddUMode(source_p, UMODE_INVISIBLE);
560      ++Count.invisi;
# Line 568 | Line 566 | register_local_user(struct Client *sourc
566  
567      if (!(Count.max_loc % 10))
568        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
569 <                           "New Max Local Clients: %d",
569 >                           "New maximum local client connections: %u",
570                             Count.max_loc);
571    }
572  
# Line 579 | Line 577 | register_local_user(struct Client *sourc
577    assert(source_p->servptr == &me);
578    SetClient(source_p);
579    dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list);
580 +  dlinkAdd(source_p, &source_p->node, &global_client_list);
581  
582    assert(dlinkFind(&unknown_list, source_p));
583  
584 <  dlink_move_node(&source_p->localClient->lclient_node,
584 >  dlink_move_node(&source_p->connection->lclient_node,
585                    &unknown_list, &local_client_list);
586  
587    user_welcome(source_p);
# Line 605 | Line 604 | register_local_user(struct Client *sourc
604   void
605   register_remote_user(struct Client *source_p)
606   {
607 <  struct Client *target_p = NULL;
607 >  const struct Client *target_p = NULL;
608  
609    if ((target_p = source_p->servptr) && target_p->from != source_p->from)
610    {
# Line 636 | Line 635 | register_remote_user(struct Client *sour
635  
636    SetClient(source_p);
637    dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list);
638 +  dlinkAdd(source_p, &source_p->node, &global_client_list);
639    add_user_host(source_p->username, source_p->host, 1);
640    SetUserHost(source_p);
641  
# Line 709 | Line 709 | valid_username(const char *username, con
709    {
710      while (*++p)
711      {
712 <      if (*p == '.' && ConfigFileEntry.dots_in_ident)
712 >      if (*p == '.' && ConfigGeneral.dots_in_ident)
713        {
714 <        if (++dots > ConfigFileEntry.dots_in_ident)
714 >        if (++dots > ConfigGeneral.dots_in_ident)
715            return 0;
716          if (!IsUserChar(*(p + 1)))
717            return 0;
# Line 747 | Line 747 | valid_nickname(const char *nickname, con
747    /*
748     * Nicks can't start with a digit or - or be 0 length.
749     */
750 <  if (*p == '-' || (IsDigit(*p) && local) || *p == '\0')
750 >  if (EmptyString(p) || *p == '-' || (IsDigit(*p) && local))
751      return 0;
752  
753    for (; *p; ++p)
# Line 814 | Line 814 | send_umode(struct Client *client_p, stru
814  
815    if (*umode_buf && client_p)
816      sendto_one(client_p, ":%s!%s@%s MODE %s :%s",
817 <               source_p->name, source_p->username,
818 <               source_p->host, source_p->name, umode_buf);
817 >               client_p->name, client_p->username,
818 >               client_p->host, client_p->name, umode_buf);
819   }
820  
821   /* send_umode_out()
# Line 825 | Line 825 | send_umode(struct Client *client_p, stru
825   * side effects - Only send ubuf out to servers that know about this client
826   */
827   void
828 < send_umode_out(struct Client *client_p, struct Client *source_p,
829 <               unsigned int old)
828 > send_umode_out(struct Client *source_p, unsigned int old)
829   {
830    char buf[IRCD_BUFSIZE] = "";
831  
832 <  send_umode(NULL, source_p, old, buf);
832 >  send_umode(MyClient(source_p) ? source_p : NULL, source_p, old, buf);
833  
834    if (buf[0])
835      sendto_server(source_p, NOCAPS, NOCAPS, ":%s MODE %s :%s",
836                    source_p->id, source_p->id, buf);
838
839  if (client_p && MyClient(client_p))
840    send_umode(client_p, source_p, old, buf);
837   }
838  
839   void
# Line 863 | Line 859 | user_set_hostmask(struct Client *target_
859      default: return;
860    }
861  
862 <  if (ConfigFileEntry.cycle_on_host_change)
862 >  if (ConfigGeneral.cycle_on_host_change)
863      sendto_common_channels_local(target_p, 0, 0, ":%s!%s@%s QUIT :Changing hostname",
864                                   target_p->name, target_p->username, target_p->host);
865  
# Line 877 | Line 873 | user_set_hostmask(struct Client *target_
873  
874    if (MyClient(target_p))
875    {
876 <    sendto_one_numeric(target_p, &me, RPL_NEWHOSTIS, target_p->host);
876 >    sendto_one_numeric(target_p, &me, RPL_VISIBLEHOST, target_p->host);
877      clear_ban_cache_client(target_p);
878    }
879  
880 <  if (!ConfigFileEntry.cycle_on_host_change)
880 >  if (!ConfigGeneral.cycle_on_host_change)
881      return;
882  
883    DLINK_FOREACH(ptr, target_p->channel.head)
# Line 913 | Line 909 | user_set_hostmask(struct Client *target_
909  
910      sendto_channel_local_butone(target_p, 0, 0, ms->chptr, ":%s!%s@%s JOIN :%s",
911                                  target_p->name, target_p->username, target_p->host,
912 <                                ms->chptr->chname);
912 >                                ms->chptr->name);
913      if (nickbuf[0])
914        sendto_channel_local_butone(target_p, 0, 0, ms->chptr, ":%s MODE %s +%s %s",
915 <                                  target_p->servptr->name, ms->chptr->chname,
915 >                                  target_p->servptr->name, ms->chptr->name,
916                                    modebuf, nickbuf);
917  
918    }
# Line 936 | Line 932 | void
932   oper_up(struct Client *source_p)
933   {
934    const unsigned int old = source_p->umodes;
935 <  const struct MaskItem *conf = source_p->localClient->confs.head->data;
935 >  const struct MaskItem *conf = source_p->connection->confs.head->data;
936  
937 <  assert(source_p->localClient->confs.head);
937 >  assert(source_p->connection->confs.head);
938  
939    ++Count.oper;
940    SetOper(source_p);
941  
942    if (conf->modes)
943      AddUMode(source_p, conf->modes);
944 <  else if (ConfigFileEntry.oper_umodes)
945 <    AddUMode(source_p, ConfigFileEntry.oper_umodes);
944 >  else if (ConfigGeneral.oper_umodes)
945 >    AddUMode(source_p, ConfigGeneral.oper_umodes);
946  
947    if (!(old & UMODE_INVISIBLE) && HasUMode(source_p, UMODE_INVISIBLE))
948      ++Count.invisi;
# Line 963 | Line 959 | oper_up(struct Client *source_p)
959  
960    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s is now an operator",
961                         get_oper_name(source_p));
962 <  send_umode_out(source_p, source_p, old);
962 >  sendto_server(NULL, NOCAPS, NOCAPS, ":%s GLOBOPS :%s is now an operator",
963 >                me.id, get_oper_name(source_p));
964 >  send_umode_out(source_p, old);
965    sendto_one_numeric(source_p, &me, RPL_YOUREOPER);
966   }
967  
# Line 994 | Line 992 | init_uid(void)
992   {
993    memset(new_uid, 0, sizeof(new_uid));
994  
995 <  if (!EmptyString(ServerInfo.sid))
996 <    strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid));
995 >  if (!EmptyString(ConfigServerInfo.sid))
996 >    strlcpy(new_uid, ConfigServerInfo.sid, sizeof(new_uid));
997  
998    for (unsigned int i = 0; i < IRC_MAXSID; ++i)
999      if (new_uid[i] == '\0')

Diff Legend

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