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-7.2/src/s_user.c (file contents):
Revision 889 by michael, Thu Nov 1 12:59:05 2007 UTC vs.
Revision 983 by michael, Thu Aug 13 22:32:54 2009 UTC

# Line 35 | Line 35
35   #include "irc_string.h"
36   #include "sprintf_irc.h"
37   #include "s_bsd.h"
38 #include "irc_getnameinfo.h"
38   #include "ircd.h"
39   #include "list.h"
40   #include "listener.h"
# Line 44 | Line 43
43   #include "s_conf.h"
44   #include "s_log.h"
45   #include "s_serv.h"
47 #include "s_stats.h"
46   #include "send.h"
47   #include "supported.h"
48   #include "whowas.h"
49   #include "memory.h"
50   #include "packet.h"
51 + #include "rng_mt.h"
52   #include "userhost.h"
53   #include "hook.h"
54   #include "s_misc.h"
# Line 287 | Line 286 | register_local_user(struct Client *clien
286                      const char *nick, const char *username)
287   {
288    const struct AccessItem *aconf = NULL;
290  char ipaddr[HOSTIPLEN];
289    dlink_node *ptr = NULL;
290    dlink_node *m = NULL;
291  
# Line 303 | Line 301 | register_local_user(struct Client *clien
301      if (!IsPingSent(source_p) &&
302         source_p->localClient->random_ping == 0)
303      {
304 <      source_p->localClient->random_ping = (unsigned long)rand();
305 <      sendto_one(source_p, "PING :%lu",
304 >      do
305 >        source_p->localClient->random_ping = genrand_int32();
306 >      while (!source_p->localClient->random_ping);
307 >
308 >      sendto_one(source_p, "PING :%u",
309                   source_p->localClient->random_ping);
310        SetPingSent(source_p);
311        return;
# Line 339 | Line 340 | register_local_user(struct Client *clien
340  
341      if (IsNeedIdentd(aconf))
342      {
343 <      ServerStats->is_ref++;
343 >      ++ServerStats.is_ref;
344        sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You need to install "
345                   "identd to use this server", me.name, source_p->name);
346        exit_client(source_p, &me, "Install identd");
# Line 368 | Line 369 | register_local_user(struct Client *clien
369  
370      if (!match_conf_password(pass, aconf))
371      {
372 <      ServerStats->is_ref++;
372 >      ++ServerStats.is_ref;
373        sendto_one(source_p, form_str(ERR_PASSWDMISMATCH),
374                   me.name, source_p->name);
375        exit_client(source_p, &me, "Bad Password");
# Line 384 | Line 385 | register_local_user(struct Client *clien
385    /* report if user has &^>= etc. and set flags as needed in source_p */
386    report_and_set_user_flags(source_p, aconf);
387  
388 +  if (IsDead(client_p))
389 +    return;
390 +
391    /* Limit clients -
392     * We want to be able to have servers and F-line clients
393     * connect, so save room for "buffer" connections.
# Line 398 | Line 402 | register_local_user(struct Client *clien
402      sendto_realops_flags(UMODE_FULL, L_ALL,
403                           "Too many clients, rejecting %s[%s].",
404                           nick, source_p->host);
405 <    ServerStats->is_ref++;
405 >    ++ServerStats.is_ref;
406      exit_client(source_p, &me, "Sorry, server is full - try later");
407      return;
408    }
# Line 410 | Line 414 | register_local_user(struct Client *clien
414  
415      sendto_realops_flags(UMODE_REJ, L_ALL, "Invalid username: %s (%s@%s)",
416                           nick, source_p->username, source_p->host);
417 <    ServerStats->is_ref++;
417 >    ++ServerStats.is_ref;
418      ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username);
419      exit_client(source_p, &me, tmpstr2);
420      return;
# Line 421 | Line 425 | register_local_user(struct Client *clien
425    if (check_xline(source_p))
426      return;
427  
424  if (IsDead(client_p))
425    return;
426
428    if (me.id[0])
429    {
430      const char *id = execute_callback(uid_get_cb, source_p);
# Line 435 | Line 436 | register_local_user(struct Client *clien
436      hash_add_id(source_p);
437    }
438  
438  irc_getnameinfo((struct sockaddr *)&source_p->localClient->ip,
439                  source_p->localClient->ip.ss_len, ipaddr,
440                  HOSTIPLEN, NULL, 0, NI_NUMERICHOST);
441
439    sendto_realops_flags(UMODE_CCONN, L_ALL,
440                         "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
441                         nick, source_p->username, source_p->host,
442                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
443 <                       "255.255.255.255" : ipaddr, get_client_class(source_p),
443 >                       "255.255.255.255" : source_p->sockhost,
444 >                       get_client_class(source_p),
445                         source_p->info);
446  
447    sendto_realops_flags(UMODE_CCONN_FULL, L_ALL,
448                         "CLICONN %s %s %s %s %s %s %s 0 %s",
449                         nick, source_p->username, source_p->host,
450                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
451 <                       "255.255.255.255" : ipaddr,
451 >                       "255.255.255.255" : source_p->sockhost,
452                         get_client_class(source_p),
453                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
454                             "<hidden>" : source_p->client_host,
# Line 459 | Line 457 | register_local_user(struct Client *clien
457                         source_p->info);
458  
459  
462  /* If they have died in send_* don't do anything. */
463  if (IsDead(source_p))
464    return;
465
460    if (ConfigFileEntry.invisible_on_connect)
461    {
462      source_p->umodes |= UMODE_INVISIBLE;
463 <    Count.invisi++;
463 >    ++Count.invisi;
464    }
465  
466    if ((++Count.local) > Count.max_loc)
# Line 486 | Line 480 | register_local_user(struct Client *clien
480    /* Increment our total user count here */
481    if (++Count.total > Count.max_tot)
482      Count.max_tot = Count.total;
483 <  Count.totalrestartcount++;
483 >  ++Count.totalrestartcount;
484  
485    source_p->localClient->allow_read = MAX_FLOOD_BURST;
486  
# Line 527 | Line 521 | register_remote_user(struct Client *clie
521    assert(source_p->username != username);
522  
523    strlcpy(source_p->host, host, sizeof(source_p->host));
530  strlcpy(source_p->info, realname, sizeof(source_p->info));
524    strlcpy(source_p->username, username, sizeof(source_p->username));
525  
526    /*
# Line 1210 | Line 1203 | check_xline(struct Client *source_p)
1203                           get_client_name(source_p, HIDE_IP),
1204                           source_p->sockhost);
1205  
1206 <    ServerStats->is_ref++;
1206 >    ++ServerStats.is_ref;
1207      if (REJECT_HOLD_TIME > 0)
1208      {
1209        sendto_one(source_p, ":%s NOTICE %s :Bad user info",

Diff Legend

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