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 2159 by michael, Sun Jun 2 18:22:01 2013 UTC vs.
Revision 2352 by michael, Wed Jul 3 21:42:19 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 85 | Line 85 | const 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    UMODE_FARCONNECT,   /* F */
# Line 101 | Line 101 | const 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 */
# Line 109 | Line 109 | const unsigned int user_modes[256] =
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 424 | Line 424 | register_local_user(struct Client *sourc
424                         get_client_class(&source_p->localClient->confs),
425                         source_p->info, source_p->id);
426  
427  sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, SEND_NOTICE,
428                       "CLICONN %s %s %s %s %s %s %s 0 %s",
429                       source_p->name, source_p->username, source_p->host,
430                       ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
431                       "255.255.255.255" : source_p->sockhost,
432                       get_client_class(&source_p->localClient->confs),
433                       ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
434                           "<hidden>" : source_p->localClient->client_host,
435                       ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
436                           "<hidden>" : source_p->localClient->client_server,
437                       source_p->info);
438
439
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 497 | 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 636 | 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 655 | 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 771 | 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 844 | 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 858 | 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 881 | Line 872 | set_user_mode(struct Client *client_p, s
872            }
873            else
874            {
884            /* Only decrement the oper counts if an oper to begin with
885             * found by Pat Szuta, Perly , perly@xnet.com
886             */
875              if (!HasUMode(source_p, UMODE_OPER))
876                break;
877  
# Line 892 | 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 905 | Line 893 | set_user_mode(struct Client *client_p, s
893  
894            break;
895  
896 +        case 'S':  /* Only servers may set +S in a burst */
897          case 'r':  /* Only services may set +r */
898          case 'x':  /* Only services may set +x */
899            break;
# Line 923 | Line 912 | set_user_mode(struct Client *client_p, s
912                  DelUMode(source_p, flag);
913              }
914            }
915 <          else
916 <          {
928 <            if (MyConnect(source_p))
929 <              badflag = 1;
930 <          }
915 >          else if (MyConnect(source_p))
916 >            badflag = 1;
917  
918            break;
919        }
# Line 982 | Line 968 | send_umode(struct Client *client_p, stru
968     * build a string in umode_buf to represent the change in the user's
969     * mode between the new (source_p->umodes) and 'old'.
970     */
971 <  for (i = 0; i < 128; i++)
971 >  for (i = 0; i < 128; ++i)
972    {
973      flag = user_modes[i];
974      if (!flag)
# Line 1078 | Line 1064 | user_set_hostmask(struct Client *target_
1064      default: return;
1065    }
1066  
1067 <  sendto_common_channels_local(target_p, 0, 0, ":%s!%s@%s QUIT :Changing hostname",
1068 <                               target_p->name, target_p->username, target_p->host);
1067 >  if (ConfigFileEntry.cycle_on_host_change)
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);
1070  
1071    if (IsUserHostIp(target_p))
1072      delete_user_host(target_p->username, target_p->host, !MyConnect(target_p));
# Line 1096 | Line 1083 | user_set_hostmask(struct Client *target_
1083      clear_ban_cache_client(target_p);
1084    }
1085  
1086 +  if (!ConfigFileEntry.cycle_on_host_change)
1087 +    return;
1088 +
1089    DLINK_FOREACH(ptr, target_p->channel.head)
1090    {
1091      char modebuf[4], nickbuf[NICKLEN * 3 + 3] = { '\0' };
# Line 1103 | Line 1093 | user_set_hostmask(struct Client *target_
1093      int len = 0;
1094      const struct Membership *ms = ptr->data;
1095  
1096 <    if (has_member_flags(ms, CHFL_CHANOP)) {
1096 >    if (has_member_flags(ms, CHFL_CHANOP))
1097 >    {
1098        *p++ = 'o';
1099        len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name);
1100      }
1101  
1102 <    if (has_member_flags(ms, CHFL_HALFOP)) {
1102 >    if (has_member_flags(ms, CHFL_HALFOP))
1103 >    {
1104        *p++ = 'h';
1105        len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name);
1106      }
1107  
1108 <    if (has_member_flags(ms, CHFL_VOICE)) {
1108 >    if (has_member_flags(ms, CHFL_VOICE))
1109 >    {
1110        *p++ = 'v';
1111        len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name);
1112      }
# Line 1153 | Line 1146 | user_welcome(struct Client *source_p)
1146   #endif
1147  
1148   #ifdef HAVE_LIBCRYPTO
1149 <  if (source_p->localClient->fd.ssl != NULL)
1149 >  if (HasFlag(source_p, FLAGS_SSL))
1150 >  {
1151 >    AddUMode(source_p, UMODE_SSL);
1152      sendto_one(source_p, ":%s NOTICE %s :*** Connected securely via %s",
1153                 me.name, source_p->name,
1154                 ssl_get_cipher(source_p->localClient->fd.ssl));
1155 +  }
1156   #endif
1157  
1158 <  sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name,
1158 >  sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name,
1159               ServerInfo.network_name, source_p->name);
1160    sendto_one(source_p, form_str(RPL_YOURHOST), me.name, source_p->name,
1161               get_listener_name(source_p->localClient->listener), ircd_version);
# Line 1218 | Line 1214 | check_xline(struct Client *source_p)
1214   * output       - NONE
1215   * side effects - Blindly opers up given source_p, using conf info
1216   *                all checks on passwords have already been done.
1217 < *                This could also be used by rsa oper routines.
1217 > *                This could also be used by rsa oper routines.
1218   */
1219   void
1220   oper_up(struct Client *source_p)
# Line 1270 | Line 1266 | valid_sid(const char *sid)
1266  
1267   /*
1268   * init_uid()
1269 < *
1269 > *
1270   * inputs       - NONE
1271   * output       - NONE
1272   * side effects - new_uid is filled in with server id portion (sid)
# Line 1288 | Line 1284 | init_uid(void)
1284      strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid));
1285  
1286    for (i = 0; i < IRC_MAXSID; ++i)
1287 <    if (new_uid[i] == '\0')
1287 >    if (new_uid[i] == '\0')
1288        new_uid[i] = 'A';
1289  
1290    /* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */
1295  /* Yes nenolod, I have known it was off by one ever since I wrote it
1296   * But *JUST* for you, though, it really doesn't look as *pretty*
1297   * -Dianora
1298   */
1291    memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID);
1292   }
1293  
# Line 1368 | Line 1360 | init_isupport(void)
1360    add_isupport("PREFIX", "(ov)@+", -1);
1361    add_isupport("STATUSMSG", "@+", -1);
1362   #endif
1363 +  add_isupport("EXCEPTS", "e", -1);
1364 +  add_isupport("INVEX", "I", -1);
1365   }
1366  
1367   /*

Diff Legend

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