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/s_user.c (file contents):
Revision 1751 by michael, Wed Jan 16 18:30:52 2013 UTC vs.
Revision 2691 by michael, Tue Dec 17 18:55:59 2013 UTC

# Line 32 | Line 32
32   #include "fdlist.h"
33   #include "hash.h"
34   #include "irc_string.h"
35 #include "sprintf_irc.h"
35   #include "s_bsd.h"
36   #include "ircd.h"
37   #include "listener.h"
# Line 53 | Line 52
52   #include "parse.h"
53   #include "watch.h"
54  
56
57 struct Callback *entering_umode_cb = NULL;
58 struct Callback *umode_cb = NULL;
59
55   static char umode_buffer[IRCD_BUFSIZE];
56  
57   static void user_welcome(struct Client *);
# Line 69 | Line 64 | static const char *uid_get(void);
64   * used with init_isupport, add_isupport, delete_isupport
65   */
66  
67 < struct Isupport
67 > struct Isupport
68   {
69    dlink_node node;
70    char *name;
# Line 77 | Line 72 | struct Isupport
72    int number;
73   };
74  
75 < static dlink_list support_list = { NULL, NULL, 0 };
76 < MessageFile *isupportFile;
75 > static dlink_list support_list;
76 > static dlink_list support_list_lines;
77  
78   /* memory is cheap. map 0-255 to equivalent mode */
79 < unsigned int user_modes[256] =
79 > const unsigned int user_modes[256] =
80   {
81    /* 0x00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x0F */
82    /* 0x10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x1F */
# Line 90 | Line 85 | unsigned int user_modes[256] =
85    0,                  /* @ */
86    0,                  /* A */
87    0,                  /* B */
88 <  UMODE_CCONN_FULL,   /* C */
88 >  0,                  /* C */
89    UMODE_DEAF,         /* D */
90    0,                  /* E */
91 <  0,                  /* F */
91 >  UMODE_FARCONNECT,   /* F */
92    UMODE_SOFTCALLERID, /* G */
93    UMODE_HIDDEN,       /* H */
94    0,                  /* I */
# Line 106 | Line 101 | unsigned int user_modes[256] =
101    0,                  /* P */
102    0,                  /* Q */
103    UMODE_REGONLY,      /* R */
104 <  0,                  /* S */
104 >  UMODE_SSL,          /* S */
105    0,                  /* T */
106    0,                  /* U */
107    0,                  /* V */
108 <  0,                  /* W */
108 >  UMODE_WEBIRC,       /* W */
109    0,                  /* X */
110    0,                  /* Y */
111    0,                  /* Z 0x5A */
112 <  0, 0, 0, 0, 0,      /* 0x5F   */
112 >  0, 0, 0, 0, 0,      /* 0x5F   */
113    0,                  /* 0x60   */
114    UMODE_ADMIN,        /* a */
115    UMODE_BOTS,         /* b */
116    UMODE_CCONN,        /* c */
117    UMODE_DEBUG,        /* d */
118 <  0,                  /* e */
118 >  UMODE_EXTERNAL,     /* e */
119    UMODE_FULL,         /* f */
120    UMODE_CALLERID,     /* g */
121    0,                  /* h */
# Line 139 | Line 134 | unsigned int user_modes[256] =
134    UMODE_UNAUTH,       /* u */
135    0,                  /* v */
136    UMODE_WALLOP,       /* w */
137 <  UMODE_EXTERNAL,     /* x */
137 >  UMODE_HIDDENHOST,   /* x */
138    UMODE_SPY,          /* y */
139    UMODE_OPERWALL,     /* z      0x7A */
140    0,0,0,0,0,          /* 0x7B - 0x7F */
# Line 174 | Line 169 | assemble_umode_buffer(void)
169   * side effects - display to client user counts etc.
170   */
171   void
172 < show_lusers(struct Client *source_p)
172 > show_lusers(struct Client *source_p)
173   {
174    const char *from, *to;
175  
# Line 214 | Line 209 | show_lusers(struct Client *source_p)
209      sendto_one(source_p, form_str(RPL_LUSERME),
210                 from, to, Count.local, Count.myserver);
211      sendto_one(source_p, form_str(RPL_LOCALUSERS),
212 <               from, to, Count.local, Count.max_loc,
218 <               Count.local, Count.max_loc);
212 >               from, to, Count.local, Count.max_loc);
213    }
214    else
215    {
216      sendto_one(source_p, form_str(RPL_LUSERME),
217                 from, to, Count.total, 0);
218 <    sendto_one(source_p, form_str(RPL_LOCALUSERS),
219 <               from, to, Count.total, Count.max_tot,
226 <               Count.total, Count.max_tot);
218 >    sendto_one(source_p, form_str(RPL_LOCALUSERS),
219 >               from, to, Count.total, Count.max_tot);
220    }
221  
222    sendto_one(source_p, form_str(RPL_GLOBALUSERS),
223 <             from, to, Count.total, Count.max_tot,
231 <             Count.total, Count.max_tot);
223 >             from, to, Count.total, Count.max_tot);
224  
225    if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER))
226      sendto_one(source_p, form_str(RPL_STATSCONN), from, to,
# Line 238 | Line 230 | show_lusers(struct Client *source_p)
230      Count.max_loc_cli = Count.local;
231  
232    if ((Count.local + Count.myserver) > Count.max_loc_con)
233 <    Count.max_loc_con = Count.local + Count.myserver;
233 >    Count.max_loc_con = Count.local + Count.myserver;
234   }
235  
236   /* show_isupport()
# Line 248 | Line 240 | show_lusers(struct Client *source_p)
240   * side effects - display to client what we support (for them)
241   */
242   void
243 < show_isupport(struct Client *source_p)
243 > show_isupport(struct Client *source_p)
244   {
245 <  send_message_file(source_p, isupportFile);
245 >  const dlink_node *ptr = NULL;
246 >
247 >  DLINK_FOREACH(ptr, support_list_lines.head)
248 >    sendto_one(source_p, form_str(RPL_ISUPPORT), me.name,
249 >               source_p->name, ptr->data);
250   }
251  
252   /*
# Line 291 | Line 287 | register_local_user(struct Client *sourc
287  
288    if (ConfigFileEntry.ping_cookie)
289    {
290 <    if (!IsPingSent(source_p) && source_p->localClient->random_ping == 0)
290 >    if (!IsPingSent(source_p) && !source_p->localClient->random_ping)
291      {
292        do
293          source_p->localClient->random_ping = genrand_int32();
# Line 314 | Line 310 | register_local_user(struct Client *sourc
310    if (!check_client(source_p))
311      return;
312  
313 <  if (valid_hostname(source_p->host) == 0)
313 >  if (!valid_hostname(source_p->host))
314    {
315      sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You have an illegal "
316                 "character in your hostname", me.name, source_p->name);
# Line 397 | Line 393 | register_local_user(struct Client *sourc
393    }
394  
395    /* valid user name check */
396 <  if (valid_username(source_p->username) == 0)
396 >  if (!valid_username(source_p->username, 1))
397    {
398      char tmpstr2[IRCD_BUFSIZE];
399  
# Line 428 | Line 424 | register_local_user(struct Client *sourc
424                         get_client_class(&source_p->localClient->confs),
425                         source_p->info, source_p->id);
426  
431  sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, SEND_NOTICE,
432                       "CLICONN %s %s %s %s %s %s %s 0 %s",
433                       source_p->name, source_p->username, source_p->host,
434                       ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
435                       "255.255.255.255" : source_p->sockhost,
436                       get_client_class(&source_p->localClient->confs),
437                       ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
438                           "<hidden>" : source_p->localClient->client_host,
439                       ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
440                           "<hidden>" : source_p->localClient->client_server,
441                       source_p->info);
442
443
427    if (ConfigFileEntry.invisible_on_connect)
428    {
429      AddUMode(source_p, UMODE_INVISIBLE);
430      ++Count.invisi;
431    }
432  
433 <  if ((++Count.local) > Count.max_loc)
433 >  if (++Count.local > Count.max_loc)
434    {
435      Count.max_loc = Count.local;
436  
# Line 501 | Line 484 | register_remote_user(struct Client *sour
484    assert(source_p != NULL);
485    assert(source_p->username != username);
486  
487 <  strlcpy(source_p->host, host, sizeof(source_p->host));
487 >  strlcpy(source_p->host, host, sizeof(source_p->host));
488    strlcpy(source_p->username, username, sizeof(source_p->username));
489  
490    /*
# Line 558 | Line 541 | register_remote_user(struct Client *sour
541    add_user_host(source_p->username, source_p->host, 1);
542    SetUserHost(source_p);
543  
544 +  if (HasFlag(source_p->servptr, FLAGS_EOB))
545 +    sendto_realops_flags(UMODE_FARCONNECT, L_ALL, SEND_NOTICE,
546 +                         "Client connecting at %s: %s (%s@%s) [%s] <%s>",
547 +                         source_p->servptr->name,
548 +                         source_p->name, source_p->username, source_p->host,
549 +                         source_p->info, source_p->id);
550 +
551    introduce_client(source_p);
552   }
553  
# Line 573 | Line 563 | static void
563   introduce_client(struct Client *source_p)
564   {
565    dlink_node *server_node = NULL;
566 <  static char ubuf[12];
566 >  char ubuf[IRCD_BUFSIZE];
567  
568    if (MyClient(source_p))
569      send_umode(source_p, source_p, 0, SEND_UMODES, ubuf);
# Line 582 | Line 572 | introduce_client(struct Client *source_p
572  
573    watch_check_hash(source_p, RPL_LOGON);
574  
575 <  if (*ubuf == '\0')
575 >  if (ubuf[0] == '\0')
576    {
577      ubuf[0] = '+';
578      ubuf[1] = '\0';
# Line 633 | Line 623 | introduce_client(struct Client *source_p
623                     ubuf, source_p->username, source_p->host,
624                     source_p->servptr->name, source_p->info);
625      }
626 +
627 +    if (!EmptyString(source_p->certfp))
628 +      sendto_one(server, ":%s CERTFP %s", ID(source_p), source_p->certfp);
629    }
630   }
631  
# Line 652 | Line 645 | valid_hostname(const char *hostname)
645  
646    assert(p != NULL);
647  
648 <  if (*p == '.' || *p == ':')
648 >  if (EmptyString(p) || *p == '.' || *p == ':')
649      return 0;
650  
651    for (; *p; ++p)
652      if (!IsHostChar(*p))
653        return 0;
654  
655 <  return 1;
655 >  return p - hostname <= HOSTLEN;
656   }
657  
658   /* valid_username()
# Line 674 | Line 667 | valid_hostname(const char *hostname)
667   * style of username
668   */
669   int
670 < valid_username(const char *username)
670 > valid_username(const char *username, const int local)
671   {
672    int dots      = 0;
673    const char *p = username;
# Line 684 | Line 677 | valid_username(const char *username)
677    if (*p == '~')
678      ++p;
679  
680 <  /* reject usernames that don't start with an alphanum
680 >  /*
681 >   * Reject usernames that don't start with an alphanum
682     * i.e. reject jokers who have '-@somehost' or '.@somehost'
683     * or "-hi-@somehost", "h-----@somehost" would still be accepted.
684     */
685    if (!IsAlNum(*p))
686      return 0;
687  
688 <  while (*++p)
688 >  if (local)
689    {
690 <    if ((*p == '.') && ConfigFileEntry.dots_in_ident)
690 >    while (*++p)
691      {
692 <      if (++dots > ConfigFileEntry.dots_in_ident)
693 <        return 0;
694 <      if (!IsUserChar(*(p + 1)))
692 >      if ((*p == '.') && ConfigFileEntry.dots_in_ident)
693 >      {
694 >        if (++dots > ConfigFileEntry.dots_in_ident)
695 >          return 0;
696 >        if (!IsUserChar(*(p + 1)))
697 >          return 0;
698 >      }
699 >      else if (!IsUserChar(*p))
700          return 0;
701      }
702 <    else if (!IsUserChar(*p))
703 <      return 0;
702 >  }
703 >  else
704 >  {
705 >    while (*++p)
706 >      if (!IsUserChar(*p))
707 >        return 0;
708    }
709  
710 <  return 1;
710 >  return  p - username <= USERLEN;;
711   }
712  
713   /* clean_nick_name()
# Line 745 | Line 748 | report_and_set_user_flags(struct Client
748   {
749    /* If this user is being spoofed, tell them so */
750    if (IsConfDoSpoofIp(conf))
748  {
751      sendto_one(source_p,
752 <               ":%s NOTICE %s :*** Spoofing your IP. congrats.",
752 >               ":%s NOTICE %s :*** Spoofing your IP. Congrats.",
753                 me.name, source_p->name);
752  }
754  
755    /* If this user is in the exception class, Set it "E lined" */
756    if (IsConfExemptKline(conf))
757    {
758      SetExemptKline(source_p);
759      sendto_one(source_p,
760 <               ":%s NOTICE %s :*** You are exempt from K/D/G lines. congrats.",
760 >               ":%s NOTICE %s :*** You are exempt from K/D/G lines. Congrats.",
761                 me.name, source_p->name);
762    }
763  
764 <  /* The else here is to make sure that G line exempt users
764 >  /*
765 >   * The else here is to make sure that G line exempt users
766     * do not get noticed twice.
767     */
768    else if (IsConfExemptGline(conf))
769    {
770      SetExemptGline(source_p);
771 <    sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from G lines.",
771 >    sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from G lines. Congrats.",
772                 me.name, source_p->name);
773    }
774  
775    if (IsConfExemptResv(conf))
776    {
777      SetExemptResv(source_p);
778 <    sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from resvs.",
778 >    sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from resvs. Congrats.",
779                 me.name, source_p->name);
780    }
781  
# Line 782 | Line 784 | report_and_set_user_flags(struct Client
784    {
785      SetExemptLimits(source_p);
786      sendto_one(source_p,
787 <               ":%s NOTICE %s :*** You are exempt from user limits. congrats.",
787 >               ":%s NOTICE %s :*** You are exempt from user limits. Congrats.",
788                 me.name,source_p->name);
789    }
790  
# Line 795 | Line 797 | report_and_set_user_flags(struct Client
797    }
798   }
799  
798 /* change_simple_umode()
799 *
800 * this callback can be hooked to allow special handling of
801 * certain usermodes
802 */
803 static void *
804 change_simple_umode(va_list args)
805 {
806  struct Client *client_p;
807  struct Client *source_p;
808  int what;
809  unsigned int flag;
810
811  client_p = va_arg(args, struct Client *);
812  source_p = va_arg(args, struct Client *);
813  what = va_arg(args, int);
814  flag = va_arg(args, unsigned int);
815
816  if (what == MODE_ADD)
817    AddUMode(source_p, flag);
818  else
819    DelUMode(source_p, flag);
820
821  return NULL;
822 }
823
800   /* set_user_mode()
801   *
802   * added 15/10/91 By Darren Reed.
# Line 830 | Line 806 | change_simple_umode(va_list args)
806   */
807   void
808   set_user_mode(struct Client *client_p, struct Client *source_p,
809 <              int parc, char *parv[])
809 >              const int parc, char *parv[])
810   {
811    unsigned int flag, setflags;
812    char **p, *m, buf[IRCD_BUFSIZE];
# Line 847 | Line 823 | set_user_mode(struct Client *client_p, s
823      return;
824    }
825  
850  if (IsServer(source_p))
851  {
852     sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
853                          "*** Mode for User %s from %s",
854                          parv[1], source_p->name);
855     return;
856  }
857
826    if (source_p != target_p)
827    {
828       sendto_one(source_p, form_str(ERR_USERSDONTMATCH),
# Line 867 | Line 835 | set_user_mode(struct Client *client_p, s
835      m = buf;
836      *m++ = '+';
837  
838 <    for (i = 0; i < 128; i++)
838 >    for (i = 0; i < 128; ++i)
839        if (HasUMode(source_p, user_modes[i]))
840          *m++ = (char)i;
841      *m = '\0';
# Line 877 | Line 845 | set_user_mode(struct Client *client_p, s
845      return;
846    }
847  
880  execute_callback(entering_umode_cb, client_p, source_p);
881
848    /* find flags already set for user */
849    setflags = source_p->umodes;
850  
851    /* parse mode change string(s) */
852 <  for (p = &parv[2]; p && *p; p++)
852 >  for (p = &parv[2]; p && *p; ++p)
853    {
854 <    for (m = *p; *m; m++)
854 >    for (m = *p; *m; ++m)
855      {
856        switch (*m)
857        {
# Line 906 | Line 872 | set_user_mode(struct Client *client_p, s
872            }
873            else
874            {
909            /* Only decrement the oper counts if an oper to begin with
910             * found by Pat Szuta, Perly , perly@xnet.com
911             */
875              if (!HasUMode(source_p, UMODE_OPER))
876                break;
877  
# Line 917 | Line 880 | set_user_mode(struct Client *client_p, s
880  
881              if (MyConnect(source_p))
882              {
883 <              dlink_node *dm;
883 >              dlink_node *dm = NULL;
884  
885                detach_conf(source_p, CONF_OPER);
886                ClrOFlag(source_p);
# Line 930 | Line 893 | set_user_mode(struct Client *client_p, s
893  
894            break;
895  
896 <        /* we may not get these,
897 <         * but they shouldnt be in default
898 <         */
899 <        case 'r':
937 <        case ' ' :
938 <        case '\n':
939 <        case '\r':
940 <        case '\t':
896 >        case 'S':  /* Only servers may set +S in a burst */
897 >        case 'W':  /* Only servers may set +W in a burst */
898 >        case 'r':  /* Only services may set +r */
899 >        case 'x':  /* Only services may set +x */
900            break;
901  
902          default:
# Line 945 | Line 904 | set_user_mode(struct Client *client_p, s
904            {
905              if (MyConnect(source_p) && !HasUMode(source_p, UMODE_OPER) &&
906                  (ConfigFileEntry.oper_only_umodes & flag))
948            {
907                badflag = 1;
950            }
908              else
909 <              execute_callback(umode_cb, client_p, source_p, what, flag);
910 <          }
911 <          else
912 <          {
913 <            if (MyConnect(source_p))
914 <              badflag = 1;
909 >            {
910 >              if (what == MODE_ADD)
911 >                AddUMode(source_p, flag);
912 >              else
913 >                DelUMode(source_p, flag);
914 >            }
915            }
916 +          else if (MyConnect(source_p))
917 +            badflag = 1;
918  
919            break;
920        }
# Line 966 | Line 925 | set_user_mode(struct Client *client_p, s
925      sendto_one(source_p, form_str(ERR_UMODEUNKNOWNFLAG),
926                 me.name, source_p->name);
927  
969  if (HasUMode(source_p, UMODE_NCHANGE) && !HasOFlag(source_p, OPER_FLAG_N))
970  {
971    sendto_one(source_p, ":%s NOTICE %s :*** You have no nchange flag;",
972               me.name, source_p->name);
973    DelUMode(source_p, UMODE_NCHANGE);
974  }
975
928    if (MyConnect(source_p) && HasUMode(source_p, UMODE_ADMIN) &&
929        !HasOFlag(source_p, OPER_FLAG_ADMIN))
930    {
# Line 1017 | Line 969 | send_umode(struct Client *client_p, stru
969     * build a string in umode_buf to represent the change in the user's
970     * mode between the new (source_p->umodes) and 'old'.
971     */
972 <  for (i = 0; i < 128; i++)
972 >  for (i = 0; i < 128; ++i)
973    {
974      flag = user_modes[i];
975      if (!flag)
# Line 1090 | Line 1042 | send_umode_out(struct Client *client_p,
1042      send_umode(client_p, source_p, old, 0xffffffff, buf);
1043   }
1044  
1045 + void
1046 + user_set_hostmask(struct Client *target_p, const char *hostname, const int what)
1047 + {
1048 +  dlink_node *ptr = NULL;
1049 +
1050 +  if (!strcmp(target_p->host, hostname))
1051 +    return;
1052 +
1053 +  switch (what)
1054 +  {
1055 +    case MODE_ADD:
1056 +      AddUMode(target_p, UMODE_HIDDENHOST);
1057 +      AddFlag(target_p, FLAGS_IP_SPOOFING);
1058 +      break;
1059 +    case MODE_DEL:
1060 +      DelUMode(target_p, UMODE_HIDDENHOST);
1061 +
1062 +      if (!HasFlag(target_p, FLAGS_AUTH_SPOOF))
1063 +        DelFlag(target_p, FLAGS_IP_SPOOFING);
1064 +      break;
1065 +    default: return;
1066 +  }
1067 +
1068 +  if (ConfigFileEntry.cycle_on_host_change)
1069 +    sendto_common_channels_local(target_p, 0, 0, ":%s!%s@%s QUIT :Changing hostname",
1070 +                                 target_p->name, target_p->username, target_p->host);
1071 +
1072 +  if (IsUserHostIp(target_p))
1073 +    delete_user_host(target_p->username, target_p->host, !MyConnect(target_p));
1074 +
1075 +  strlcpy(target_p->host, hostname, sizeof(target_p->host));
1076 +
1077 +  add_user_host(target_p->username, target_p->host, !MyConnect(target_p));
1078 +  SetUserHost(target_p);
1079 +
1080 +  if (MyClient(target_p))
1081 +  {
1082 +    sendto_one(target_p, form_str(RPL_NEWHOSTIS), me.name,
1083 +               target_p->name, target_p->host);
1084 +    clear_ban_cache_client(target_p);
1085 +  }
1086 +
1087 +  if (!ConfigFileEntry.cycle_on_host_change)
1088 +    return;
1089 +
1090 +  DLINK_FOREACH(ptr, target_p->channel.head)
1091 +  {
1092 +    char modebuf[4], nickbuf[NICKLEN * 3 + 3] = { '\0' };
1093 +    char *p = modebuf;
1094 +    int len = 0;
1095 +    const struct Membership *ms = ptr->data;
1096 +
1097 +    if (has_member_flags(ms, CHFL_CHANOP))
1098 +    {
1099 +      *p++ = 'o';
1100 +      len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name);
1101 +    }
1102 +
1103 +    if (has_member_flags(ms, CHFL_HALFOP))
1104 +    {
1105 +      *p++ = 'h';
1106 +      len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name);
1107 +    }
1108 +
1109 +    if (has_member_flags(ms, CHFL_VOICE))
1110 +    {
1111 +      *p++ = 'v';
1112 +      len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name);
1113 +    }
1114 +
1115 +    *p = '\0';
1116 +
1117 +    sendto_channel_local_butone(target_p, 0, 0, ms->chptr, ":%s!%s@%s JOIN :%s",
1118 +                                target_p->name, target_p->username, target_p->host,
1119 +                                ms->chptr->chname);
1120 +    if (nickbuf[0])
1121 +      sendto_channel_local_butone(target_p, 0, 0, ms->chptr, ":%s MODE %s +%s %s",
1122 +                                  target_p->servptr->name, ms->chptr->chname,
1123 +                                  modebuf, nickbuf);
1124 +
1125 +  }
1126 +
1127 +  if (target_p->away[0])
1128 +    sendto_common_channels_local(target_p, 0, CAP_AWAY_NOTIFY,
1129 +                                 ":%s!%s@%s AWAY :%s",
1130 +                                 target_p->name, target_p->username,
1131 +                                 target_p->host, target_p->away);
1132 + }
1133 +
1134   /* user_welcome()
1135   *
1136   * inputs       - client pointer to client to welcome
# Line 1106 | Line 1147 | user_welcome(struct Client *source_p)
1147   #endif
1148  
1149   #ifdef HAVE_LIBCRYPTO
1150 <  if (source_p->localClient->fd.ssl != NULL)
1150 >  if (HasFlag(source_p, FLAGS_SSL))
1151 >  {
1152 >    AddUMode(source_p, UMODE_SSL);
1153      sendto_one(source_p, ":%s NOTICE %s :*** Connected securely via %s",
1154                 me.name, source_p->name,
1155                 ssl_get_cipher(source_p->localClient->fd.ssl));
1156 +  }
1157   #endif
1158  
1159 <  sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name,
1159 >  sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name,
1160               ServerInfo.network_name, source_p->name);
1161    sendto_one(source_p, form_str(RPL_YOURHOST), me.name, source_p->name,
1162               get_listener_name(source_p->localClient->listener), ircd_version);
# Line 1127 | Line 1171 | user_welcome(struct Client *source_p)
1171                 source_p->name, source_p->id);
1172  
1173    show_lusers(source_p);
1174 <
1131 <  if (ConfigFileEntry.short_motd)
1132 <  {
1133 <    sendto_one(source_p, ":%s NOTICE %s :*** Notice -- motd was last changed at %s",
1134 <               me.name, source_p->name, ConfigFileEntry.motd.lastChangedDate);
1135 <    sendto_one(source_p,
1136 <               ":%s NOTICE %s :*** Notice -- Please read the motd if you haven't "
1137 <               "read it", me.name, source_p->name);
1138 <    sendto_one(source_p, form_str(RPL_MOTDSTART),
1139 <               me.name, source_p->name, me.name);
1140 <    sendto_one(source_p, form_str(RPL_MOTD),
1141 <               me.name, source_p->name,
1142 <               "*** This is the short motd ***");
1143 <    sendto_one(source_p, form_str(RPL_ENDOFMOTD),
1144 <               me.name, source_p->name);
1145 <  }
1146 <  else  
1147 <    send_message_file(source_p, &ConfigFileEntry.motd);
1174 >  motd_signon(source_p);
1175   }
1176  
1177   /* check_xline()
# Line 1159 | Line 1186 | check_xline(struct Client *source_p)
1186    struct MaskItem *conf = NULL;
1187    const char *reason = NULL;
1188  
1189 <  if ((conf = find_matching_name_conf(CONF_XLINE, source_p->info, NULL, NULL, 0)) ||
1163 <      (conf = find_matching_name_conf(CONF_RXLINE, source_p->info, NULL, NULL, 0)))
1189 >  if ((conf = find_matching_name_conf(CONF_XLINE, source_p->info, NULL, NULL, 0)))
1190    {
1191      ++conf->count;
1192  
# Line 1189 | Line 1215 | check_xline(struct Client *source_p)
1215   * output       - NONE
1216   * side effects - Blindly opers up given source_p, using conf info
1217   *                all checks on passwords have already been done.
1218 < *                This could also be used by rsa oper routines.
1218 > *                This could also be used by rsa oper routines.
1219   */
1220   void
1221   oper_up(struct Client *source_p)
# Line 1219 | Line 1245 | oper_up(struct Client *source_p)
1245  
1246    if (HasOFlag(source_p, OPER_FLAG_ADMIN))
1247      AddUMode(source_p, UMODE_ADMIN);
1222  if (!HasOFlag(source_p, OPER_FLAG_N))
1223    DelUMode(source_p, UMODE_NCHANGE);
1248  
1249    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s is now an operator",
1250                         get_oper_name(source_p));
# Line 1243 | Line 1267 | valid_sid(const char *sid)
1267  
1268   /*
1269   * init_uid()
1270 < *
1270 > *
1271   * inputs       - NONE
1272   * output       - NONE
1273   * side effects - new_uid is filled in with server id portion (sid)
# Line 1253 | Line 1277 | valid_sid(const char *sid)
1277   void
1278   init_uid(void)
1279   {
1280 <  int i;
1280 >  unsigned int i;
1281  
1282    memset(new_uid, 0, sizeof(new_uid));
1283  
# Line 1261 | Line 1285 | init_uid(void)
1285      strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid));
1286  
1287    for (i = 0; i < IRC_MAXSID; ++i)
1288 <    if (new_uid[i] == '\0')
1288 >    if (new_uid[i] == '\0')
1289        new_uid[i] = 'A';
1290  
1291    /* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */
1268  /* Yes nenolod, I have known it was off by one ever since I wrote it
1269   * But *JUST* for you, though, it really doesn't look as *pretty*
1270   * -Dianora
1271   */
1292    memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID);
1273
1274  entering_umode_cb = register_callback("entering_umode", NULL);
1275  umode_cb = register_callback("changing_umode", change_simple_umode);
1293   }
1294  
1295   /*
# Line 1332 | Line 1349 | uid_get(void)
1349   void
1350   init_isupport(void)
1351   {
1335  isupportFile = init_MessageLine();
1336
1352    add_isupport("CALLERID", NULL, -1);
1353    add_isupport("CASEMAPPING", CASEMAP, -1);
1354    add_isupport("DEAF", "D", -1);
# Line 1346 | Line 1361 | init_isupport(void)
1361    add_isupport("PREFIX", "(ov)@+", -1);
1362    add_isupport("STATUSMSG", "@+", -1);
1363   #endif
1364 +  add_isupport("EXCEPTS", "e", -1);
1365 +  add_isupport("INVEX", "I", -1);
1366   }
1367  
1368   /*
# Line 1429 | Line 1446 | rebuild_isupport_message_line(void)
1446   {
1447    char isupportbuffer[IRCD_BUFSIZE];
1448    char *p = isupportbuffer;
1449 <  dlink_node *ptr = NULL;
1449 >  dlink_node *ptr = NULL, *ptr_next = NULL;
1450    int n = 0;
1451    int tokens = 0;
1452    size_t len = 0;
1453    size_t reserve = strlen(me.name) + HOSTLEN + strlen(form_str(RPL_ISUPPORT));
1454  
1455 <  destroy_MessageLine(isupportFile);
1455 >  DLINK_FOREACH_SAFE(ptr, ptr_next, support_list_lines.head)
1456 >  {
1457 >    dlinkDelete(ptr, &support_list_lines);
1458 >    MyFree(ptr->data);
1459 >    free_dlink_node(ptr);
1460 >  }
1461  
1462    DLINK_FOREACH(ptr, support_list.head)
1463    {
1464      struct Isupport *support = ptr->data;
1465  
1466 <    p += (n = ircsprintf(p, "%s", support->name));
1466 >    p += (n = sprintf(p, "%s", support->name));
1467      len += n;
1468  
1469      if (support->options != NULL)
1470      {
1471 <      p += (n = ircsprintf(p, "=%s", support->options));
1471 >      p += (n = sprintf(p, "=%s", support->options));
1472        len += n;
1473      }
1474  
1475      if (support->number > 0)
1476      {
1477 <      p += (n = ircsprintf(p, "=%d", support->number));
1477 >      p += (n = sprintf(p, "=%d", support->number));
1478        len += n;
1479      }
1480  
# Line 1465 | Line 1487 | rebuild_isupport_message_line(void)
1487        if (*--p == ' ')
1488          *p = '\0';
1489  
1490 <      addto_MessageLine(isupportFile, isupportbuffer);
1490 >      dlinkAddTail(xstrdup(isupportbuffer), make_dlink_node(), &support_list_lines);
1491        p = isupportbuffer;
1492        len = 0;
1493        n = tokens = 0;
# Line 1476 | Line 1498 | rebuild_isupport_message_line(void)
1498    {
1499      if (*--p == ' ')
1500        *p = '\0';
1501 <    addto_MessageLine(isupportFile, isupportbuffer);
1501 >    dlinkAddTail(xstrdup(isupportbuffer), make_dlink_node(), &support_list_lines);
1502    }
1503   }

Diff Legend

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