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

Comparing ircd-hybrid/src/s_user.c (file contents):
Revision 54 by knight, Sun Oct 2 20:50:00 2005 UTC vs.
Revision 55 by michael, Mon Oct 3 11:15:26 2005 UTC

# Line 201 | Line 201 | show_lusers(struct Client *source_p)
201                 Count.invisi, dlink_list_length(&global_serv_list));
202    else
203      sendto_one(source_p, form_str(RPL_LUSERCLIENT), from, to,
204 <              (Count.total-Count.invisi), Count.invisi, 1);
204 >               (Count.total-Count.invisi), Count.invisi, 1);
205  
206    if (Count.oper > 0)
207      sendto_one(source_p, form_str(RPL_LUSEROP),
208 <               from, to, Count.oper);
208 >               from, to, Count.oper);
209  
210    if (dlink_list_length(&unknown_list) > 0)
211      sendto_one(source_p, form_str(RPL_LUSERUNKNOWN),
212 <               from, to, dlink_list_length(&unknown_list));
212 >               from, to, dlink_list_length(&unknown_list));
213  
214    if (dlink_list_length(&global_channel_list) > 0)
215      sendto_one(source_p, form_str(RPL_LUSERCHANNELS),
216 <               from, to,
217 <               dlink_list_length(&global_channel_list));
216 >               from, to, dlink_list_length(&global_channel_list));
217  
218    if (!ConfigServerHide.hide_servers || IsOper(source_p))
219    {
220      sendto_one(source_p, form_str(RPL_LUSERME),
221 <               from, to,
223 <               Count.local, Count.myserver);
221 >               from, to, Count.local, Count.myserver);
222      sendto_one(source_p, form_str(RPL_LOCALUSERS),
223 <               from, to, Count.local, Count.max_loc,
224 <               Count.local, Count.max_loc);
223 >               from, to, Count.local, Count.max_loc,
224 >               Count.local, Count.max_loc);
225    }
226    else
227    {
228      sendto_one(source_p, form_str(RPL_LUSERME),
229 <               from, to, Count.total, 0);
229 >               from, to, Count.total, 0);
230      sendto_one(source_p, form_str(RPL_LOCALUSERS),
231 <               from, to, Count.total, Count.max_tot,
231 >               from, to, Count.total, Count.max_tot,
232                 Count.total, Count.max_tot);
233    }
234  
# Line 240 | Line 238 | show_lusers(struct Client *source_p)
238  
239    if (!ConfigServerHide.hide_servers || IsOper(source_p))
240      sendto_one(source_p, form_str(RPL_STATSCONN), from, to,
241 <               MaxConnectionCount, MaxClientCount, Count.totalrestartcount);
241 >               MaxConnectionCount, MaxClientCount, Count.totalrestartcount);
242  
243    if (Count.local > MaxClientCount)
244      MaxClientCount = Count.local;
# Line 290 | Line 288 | register_local_user(struct Client *clien
288   {
289    const struct AccessItem *aconf = NULL;
290    char ipaddr[HOSTIPLEN];
291 <  dlink_node *ptr;
292 <  dlink_node *m;
291 >  dlink_node *ptr = NULL;
292 >  dlink_node *m = NULL;
293  
294    assert(source_p != NULL);
295    assert(MyConnect(source_p));
# Line 502 | Line 500 | register_local_user(struct Client *clien
500   */
501   void
502   register_remote_user(struct Client *client_p, struct Client *source_p,
503 <                     const char *username, const char *host, const char *server,
504 <                     const char *realname)
503 >                     const char *username, const char *host, const char *server,
504 >                     const char *realname)
505   {
506 <  struct Client *target_p;
506 >  struct Client *target_p = NULL;
507  
508    assert(source_p != NULL);
509    assert(source_p->username != username);
# Line 578 | Line 576 | register_remote_user(struct Client *clie
576   static void
577   introduce_client(struct Client *client_p, struct Client *source_p)
578   {
579 <  dlink_node *server_node;
579 >  dlink_node *server_node = NULL;
580    static char ubuf[12];
581  
582    if (MyClient(source_p))
# Line 677 | Line 675 | valid_hostname(const char *hostname)
675  
676    assert(p != NULL);
677  
678 <  if (('.' == *p) || (':' == *p))
679 <    return (0);
678 >  if ('.' == *p || ':' == *p)
679 >    return 0;
680  
681    while (*p)
682    {
683      if (!IsHostChar(*p))
684 <      return (0);
684 >      return 0;
685      p++;
686    }
687  
688 <  return (1);
688 >  return 1;
689   }
690  
691   /* valid_username()
# Line 717 | Line 715 | valid_username(const char *username)
715     * or "-hi-@somehost", "h-----@somehost" would still be accepted.
716     */
717    if (!IsAlNum(*p))
718 <    return (0);
718 >    return 0;
719  
720    while (*++p)
721    {
# Line 726 | Line 724 | valid_username(const char *username)
724        dots++;
725  
726        if (dots > ConfigFileEntry.dots_in_ident)
727 <        return (0);
727 >        return 0;
728        if (!IsUserChar(p[1]))
729 <        return (0);
729 >        return 0;
730      }
731      else if (!IsUserChar(*p))
732 <      return (0);
732 >      return 0;
733    }
734  
735 <  return (1);
735 >  return 1;
736   }
737  
738   /* report_and_set_user_flags()
# Line 897 | Line 895 | set_user_mode(struct Client *client_p, s
895    char **p, *m, buf[IRCD_BUFSIZE];
896    struct Client *target_p;
897    int what = MODE_ADD, badflag = 0, i;
898 < #if 0
899 <  /* already covered by m_mode */
900 <  if (parc < 2)
903 <  {
904 <    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
905 <               me.name, source_p->name, "MODE");
906 <    return;
907 <  }
908 < #endif
898 >
899 >  assert(!(parc < 2));
900 >
901    if ((target_p = find_person(client_p, parv[1])) == NULL)
902    {
903      if (MyConnect(source_p))
# Line 914 | Line 906 | set_user_mode(struct Client *client_p, s
906      return;
907    }
908  
917  /* Dont know why these were commented out..
918   * put them back using new sendto() funcs
919   */
909    if (IsServer(source_p))
910    {
911       sendto_realops_flags(UMODE_ALL, L_ADMIN, "*** Mode for User %s from %s",
# Line 1017 | Line 1006 | set_user_mode(struct Client *client_p, s
1006                badflag = 1;
1007              }
1008              else
1009 <              execute_callback(umode_cb, client_p, source_p, what, flag);
1009 >              execute_callback(umode_cb, client_p, source_p, what, flag);
1010            }
1011            else
1012            {
# Line 1054 | Line 1043 | set_user_mode(struct Client *client_p, s
1043    if ((setflags & UMODE_INVISIBLE) && !IsInvisible(source_p))
1044      --Count.invisi;
1045  
1046 <  /* compare new flags with old flags and send string which
1046 >  /*
1047 >   * compare new flags with old flags and send string which
1048     * will cause servers to update correctly.
1049     */
1050    send_umode_out(client_p, source_p, setflags);
# Line 1073 | Line 1063 | send_umode(struct Client *client_p, stru
1063    unsigned int flag;
1064    char *m = umode_buf;
1065  
1066 <  /* build a string in umode_buf to represent the change in the user's
1066 >  /*
1067 >   * build a string in umode_buf to represent the change in the user's
1068     * mode between the new (source_p->umodes) and 'old'.
1069     */
1070    for (i = 0; i < 128; i++)
# Line 1179 | Line 1170 | user_welcome(struct Client *source_p)
1170    sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name,
1171               ServerInfo.network_name, source_p->name);
1172    sendto_one(source_p, form_str(RPL_YOURHOST), me.name, source_p->name,
1173 <             get_listener_name(source_p->localClient->listener), ircd_version);
1173 >             get_listener_name(source_p->localClient->listener), ircd_version);
1174    sendto_one(source_p, form_str(RPL_CREATED),
1175 <             me.name, source_p->name, built_date);
1175 >             me.name, source_p->name, built_date);
1176    sendto_one(source_p, form_str(RPL_MYINFO),
1177               me.name, source_p->name, me.name, ircd_version, umode_buffer);
1178    show_isupport(source_p);
# Line 1236 | Line 1227 | check_xline(struct Client *source_p)
1227        reason = "No Reason";
1228  
1229      sendto_realops_flags(UMODE_REJ, L_ALL,
1230 <                         "X-line Rejecting [%s] [%s], user %s [%s]",
1231 <                         source_p->info, reason,
1232 <                         get_client_name(source_p, HIDE_IP),
1233 <                         source_p->sockhost);
1230 >                         "X-line Rejecting [%s] [%s], user %s [%s]",
1231 >                         source_p->info, reason,
1232 >                         get_client_name(source_p, HIDE_IP),
1233 >                         source_p->sockhost);
1234  
1235      ServerStats->is_ref++;      
1236 <    if(REJECT_HOLD_TIME > 0)
1236 >    if (REJECT_HOLD_TIME > 0)
1237      {
1238        sendto_one(source_p, ":%s NOTICE %s :Bad user info",
1239 <                 me.name, source_p->name);
1239 >                 me.name, source_p->name);
1240        source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME;
1241        SetCaptured(source_p);
1242      }
# Line 1301 | Line 1292 | oper_up(struct Client *source_p)
1292   {
1293    unsigned int old = source_p->umodes;
1294    const char *operprivs = "";
1295 <  struct AccessItem *oconf;
1295 >  const struct AccessItem *oconf = NULL;
1296  
1297 +  assert(source_p->localClient->confs.head);
1298 +  oconf = map_to_conf((source_p->localClient->confs.head)->data);
1299 +
1300 +  ++Count.oper;
1301    SetOper(source_p);
1302  
1303 <  if (ConfigFileEntry.oper_umodes)
1303 >  if (oconf->modes)
1304 >    source_p->umodes |= oconf->modes;
1305 >  else if (ConfigFileEntry.oper_umodes)
1306      source_p->umodes |= ConfigFileEntry.oper_umodes;
1307    else
1308      source_p->umodes |= (UMODE_SERVNOTICE|UMODE_OPERWALL|
1309 <                         UMODE_WALLOP|UMODE_LOCOPS);
1313 <
1314 <  Count.oper++;
1309 >                         UMODE_WALLOP|UMODE_LOCOPS);
1310  
1311    assert(dlinkFind(&oper_list, source_p) == NULL);
1312    dlinkAdd(source_p, make_dlink_node(), &oper_list);
1313  
1319  assert(source_p->localClient->confs.head);
1320  oconf = map_to_conf((source_p->localClient->confs.head)->data);
1314    operprivs = oper_privs_as_string(oconf->port);
1315  
1316    SetOFlag(source_p, oconf->port);
# Line 1363 | Line 1356 | init_uid(void)
1356    if (ServerInfo.sid != NULL)
1357    {
1358      memcpy(new_uid, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid),
1359 <                                             IRC_MAXSID));
1359 >                                             IRC_MAXSID));
1360      memcpy(&me.id, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid),
1361 <                                             IRC_MAXSID));
1361 >                                            IRC_MAXSID));
1362      hash_add_id(&me);
1363    }
1364  
# Line 1395 | Line 1388 | init_uid(void)
1388   static void *
1389   uid_get(va_list args)
1390   {
1391 <  add_one_to_uid(TOTALSIDUID-1);        /* index from 0 */
1391 >  add_one_to_uid(TOTALSIDUID-1);    /* index from 0 */
1392    return ((void *) new_uid);
1393   }
1394  
# Line 1410 | Line 1403 | uid_get(va_list args)
1403   static void
1404   add_one_to_uid(int i)
1405   {
1406 <  if (i != IRC_MAXSID)          /* Not reached server SID portion yet? */
1406 >  if (i != IRC_MAXSID)    /* Not reached server SID portion yet? */
1407    {
1408      if (new_uid[i] == 'Z')
1409        new_uid[i] = '0';
# Line 1573 | Line 1566 | rebuild_isupport_message_line(void)
1566      if (++tokens == (MAXPARA-2) || len >= (sizeof(isupportbuffer)-reserve))
1567      { /* arbritrary for now */
1568        if (*--p == ' ')
1569 <        *p = '\0';
1569 >        *p = '\0';
1570  
1571        addto_MessageLine(isupportFile, isupportbuffer);
1572        p = isupportbuffer;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines