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 2246 by michael, Sun Jun 16 10:48:39 2013 UTC vs.
Revision 2691 by michael, Tue Dec 17 18:55:59 2013 UTC

# Line 64 | 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 105 | Line 105 | const unsigned int user_modes[256] =
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 */
# Line 169 | 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 215 | Line 215 | show_lusers(struct Client *source_p)
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),
218 >    sendto_one(source_p, form_str(RPL_LOCALUSERS),
219                 from, to, Count.total, Count.max_tot);
220    }
221  
# Line 230 | 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 240 | 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    const dlink_node *ptr = NULL;
246  
# Line 287 | 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 310 | 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 393 | Line 393 | register_local_user(struct Client *sourc
393    }
394  
395    /* valid user name check */
396 <  if (valid_username(source_p->username, 1) == 0)
396 >  if (!valid_username(source_p->username, 1))
397    {
398      char tmpstr2[IRCD_BUFSIZE];
399  
# Line 430 | Line 430 | register_local_user(struct Client *sourc
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 484 | 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 563 | 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 572 | 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 645 | 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)
# Line 761 | Line 761 | report_and_set_user_flags(struct Client
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))
# Line 834 | 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 848 | Line 849 | set_user_mode(struct Client *client_p, s
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 871 | Line 872 | set_user_mode(struct Client *client_p, s
872            }
873            else
874            {
874            /* Only decrement the oper counts if an oper to begin with
875             * found by Pat Szuta, Perly , perly@xnet.com
876             */
875              if (!HasUMode(source_p, UMODE_OPER))
876                break;
877  
# Line 882 | 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 896 | Line 894 | set_user_mode(struct Client *client_p, s
894            break;
895  
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;
# Line 914 | Line 913 | set_user_mode(struct Client *client_p, s
913                  DelUMode(source_p, flag);
914              }
915            }
916 <          else
917 <          {
919 <            if (MyConnect(source_p))
920 <              badflag = 1;
921 <          }
916 >          else if (MyConnect(source_p))
917 >            badflag = 1;
918  
919            break;
920        }
# Line 973 | 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 1069 | Line 1065 | user_set_hostmask(struct Client *target_
1065      default: return;
1066    }
1067  
1068 <  sendto_common_channels_local(target_p, 0, 0, ":%s!%s@%s QUIT :Changing hostname",
1069 <                               target_p->name, target_p->username, target_p->host);
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));
# Line 1087 | Line 1084 | user_set_hostmask(struct Client *target_
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' };
# Line 1094 | Line 1094 | user_set_hostmask(struct Client *target_
1094      int len = 0;
1095      const struct Membership *ms = ptr->data;
1096  
1097 <    if (has_member_flags(ms, CHFL_CHANOP)) {
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)) {
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)) {
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      }
# Line 1153 | Line 1156 | user_welcome(struct Client *source_p)
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 1212 | 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 1264 | 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 1282 | 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 */
1289  /* Yes nenolod, I have known it was off by one ever since I wrote it
1290   * But *JUST* for you, though, it really doesn't look as *pretty*
1291   * -Dianora
1292   */
1292    memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID);
1293   }
1294  

Diff Legend

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