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

Comparing ircd-hybrid/trunk/src/conf.c (file contents):
Revision 3215 by michael, Tue Mar 25 19:23:15 2014 UTC vs.
Revision 4565 by michael, Sun Aug 24 10:27:40 2014 UTC

# Line 15 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# Line 28 | Line 28
28   #include "list.h"
29   #include "ircd_defs.h"
30   #include "conf.h"
31 < #include "s_serv.h"
31 > #include "conf_pseudo.h"
32 > #include "server.h"
33   #include "resv.h"
34   #include "channel.h"
35   #include "client.h"
36   #include "event.h"
36 #include "hook.h"
37   #include "irc_string.h"
38   #include "s_bsd.h"
39   #include "ircd.h"
# Line 44 | Line 44
44   #include "fdlist.h"
45   #include "log.h"
46   #include "send.h"
47 #include "s_gline.h"
47   #include "memory.h"
48 < #include "mempool.h"
50 < #include "irc_res.h"
48 > #include "res.h"
49   #include "userhost.h"
50 < #include "s_user.h"
50 > #include "user.h"
51   #include "channel_mode.h"
52   #include "parse.h"
53 < #include "s_misc.h"
53 > #include "misc.h"
54   #include "conf_db.h"
55   #include "conf_class.h"
56   #include "motd.h"
57 + #include "ipcache.h"
58  
59  
61 struct config_channel_entry ConfigChannel;
62 struct config_server_hide ConfigServerHide;
63 struct config_file_entry ConfigFileEntry;
64 struct logging_entry ConfigLoggingEntry = { .use_logging = 1 };
65 struct server_info ServerInfo;
66 struct admin_info AdminInfo;
67
60   /* general conf items link list root, other than k lines etc. */
61   dlink_list service_items = { NULL, NULL, 0 };
62   dlink_list server_items  = { NULL, NULL, 0 };
# Line 73 | Line 65 | dlink_list oconf_items   = { NULL, NULL,
65   dlink_list uconf_items   = { NULL, NULL, 0 };
66   dlink_list xconf_items   = { NULL, NULL, 0 };
67   dlink_list nresv_items   = { NULL, NULL, 0 };
68 < dlink_list cresv_items = { NULL, NULL, 0 };
68 > dlink_list cresv_items   = { NULL, NULL, 0 };
69  
70   extern unsigned int lineno;
71   extern char linebuf[];
72   extern char conffilebuf[IRCD_BUFSIZE];
73   extern int yyparse(); /* defined in y.tab.c */
74  
83 struct conf_parser_context conf_parser_ctx = { 0, 0, NULL };
84
75   /* internally defined functions */
76   static void read_conf(FILE *);
77   static void clear_out_old_conf(void);
78   static void expire_tklines(dlink_list *);
89 static void garbage_collect_ip_entries(void);
90 static int hash_ip(struct irc_ssaddr *);
79   static int verify_access(struct Client *);
80   static int attach_iline(struct Client *, struct MaskItem *);
93 static struct ip_entry *find_or_add_ip(struct irc_ssaddr *);
81   static dlink_list *map_to_list(enum maskitem_type);
82   static int find_user_host(struct Client *, char *, char *, char *, unsigned int);
83  
84  
98 /* usually, with hash tables, you use a prime number...
99 * but in this case I am dealing with ip addresses,
100 * not ascii strings.
101 */
102 #define IP_HASH_SIZE 0x1000
103
104 struct ip_entry
105 {
106  struct irc_ssaddr ip;
107  unsigned int count;
108  time_t last_attempt;
109  struct ip_entry *next;
110 };
111
112 static struct ip_entry *ip_hash_table[IP_HASH_SIZE];
113 static mp_pool_t *ip_entry_pool = NULL;
114 static int ip_entries_count = 0;
115
116
85   /* conf_dns_callback()
86   *
87   * inputs       - pointer to struct MaskItem
# Line 125 | Line 93 | static int ip_entries_count = 0;
93   * if successful save hp in the conf item it was called with
94   */
95   static void
96 < conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name)
96 > conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name, size_t namelength)
97   {
98    struct MaskItem *conf = vptr;
99  
100    conf->dns_pending = 0;
101  
102 <  if (addr != NULL)
102 >  if (addr)
103      memcpy(&conf->addr, addr, sizeof(conf->addr));
104    else
105      conf->dns_failed = 1;
# Line 149 | Line 117 | conf_dns_lookup(struct MaskItem *conf)
117    if (!conf->dns_pending)
118    {
119      conf->dns_pending = 1;
120 <    gethost_byname(conf_dns_callback, conf, conf->host);
120 >
121 >    if (conf->aftype == AF_INET)
122 >      gethost_byname_type(conf_dns_callback, conf, conf->host, T_A);
123 >    else
124 >      gethost_byname_type(conf_dns_callback, conf, conf->host, T_AAAA);
125    }
126   }
127  
128   struct MaskItem *
129   conf_make(enum maskitem_type type)
130   {
131 <  struct MaskItem *conf = MyMalloc(sizeof(*conf));
131 >  struct MaskItem *conf = MyCalloc(sizeof(*conf));
132    dlink_list *list = NULL;
133  
134    conf->type   = type;
# Line 174 | Line 146 | conf_free(struct MaskItem *conf)
146    dlink_node *ptr = NULL, *ptr_next = NULL;
147    dlink_list *list = NULL;
148  
149 <  if (conf->node.next)
150 <    if ((list = map_to_list(conf->type)))
179 <      dlinkDelete(&conf->node, list);
149 >  if ((list = map_to_list(conf->type)))
150 >    dlinkFindDelete(list, conf);
151  
152    MyFree(conf->name);
153  
154    if (conf->dns_pending)
155      delete_resolver_queries(conf);
156 <  if (conf->passwd != NULL)
156 >  if (conf->passwd)
157      memset(conf->passwd, 0, strlen(conf->passwd));
158 <  if (conf->spasswd != NULL)
158 >  if (conf->spasswd)
159      memset(conf->spasswd, 0, strlen(conf->spasswd));
160  
161    conf->class = NULL;
# Line 324 | Line 295 | verify_access(struct Client *client_p)
295      conf = find_address_conf(client_p->host, client_p->username,
296                               &client_p->localClient->ip,
297                               client_p->localClient->aftype,
298 <                             client_p->localClient->passwd);
298 >                             client_p->localClient->password);
299    }
300    else
301    {
# Line 332 | Line 303 | verify_access(struct Client *client_p)
303      conf = find_address_conf(client_p->host,non_ident,
304                               &client_p->localClient->ip,
305                               client_p->localClient->aftype,
306 <                             client_p->localClient->passwd);
306 >                             client_p->localClient->password);
307    }
308  
309    if (conf)
# Line 353 | Line 324 | verify_access(struct Client *client_p)
324        /* Thanks for spoof idea amm */
325        if (IsConfDoSpoofIp(conf))
326        {
327 <        if (!ConfigFileEntry.hide_spoof_ips && IsConfSpoofNotice(conf))
327 >        if (!ConfigGeneral.hide_spoof_ips && IsConfSpoofNotice(conf))
328            sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
329                                 "%s spoofing: %s as %s",
330                                 client_p->name, client_p->host, conf->name);
# Line 363 | Line 334 | verify_access(struct Client *client_p)
334  
335        return attach_iline(client_p, conf);
336      }
337 <    else if (IsConfKill(conf) || (ConfigFileEntry.glines && IsConfGline(conf)))
337 >    else if (IsConfKill(conf) || (ConfigGeneral.glines && IsConfGline(conf)))
338      {
339        if (IsConfGline(conf))
340          sendto_one_notice(client_p, &me, ":*** G-lined");
# Line 385 | Line 356 | verify_access(struct Client *client_p)
356   static int
357   attach_iline(struct Client *client_p, struct MaskItem *conf)
358   {
359 <  struct ClassItem *class = NULL;
359 >  const struct ClassItem *class = conf->class;
360    struct ip_entry *ip_found;
361    int a_limit_reached = 0;
362    unsigned int local = 0, global = 0, ident = 0;
363  
364 <  assert(conf->class);
394 <
395 <  ip_found = find_or_add_ip(&client_p->localClient->ip);
364 >  ip_found = ipcache_find_or_add_address(&client_p->localClient->ip);
365    ip_found->count++;
366 <  SetIpHash(client_p);
398 <
399 <  class = conf->class;
366 >  AddFlag(client_p, FLAGS_IPHASH);
367  
368    count_user_host(client_p->username, client_p->host,
369                    &global, &local, &ident);
# Line 405 | Line 372 | attach_iline(struct Client *client_p, st
372     * setting a_limit_reached if any limit is reached.
373     * - Dianora
374     */
375 <  if (class->max_total != 0 && class->ref_count >= class->max_total)
375 >  if (class->max_total && class->ref_count >= class->max_total)
376      a_limit_reached = 1;
377 <  else if (class->max_perip != 0 && ip_found->count > class->max_perip)
377 >  else if (class->max_perip && ip_found->count > class->max_perip)
378      a_limit_reached = 1;
379 <  else if (class->max_local != 0 && local >= class->max_local)
379 >  else if (class->max_local && local >= class->max_local)
380      a_limit_reached = 1;
381 <  else if (class->max_global != 0 && global >= class->max_global)
381 >  else if (class->max_global && global >= class->max_global)
382      a_limit_reached = 1;
383 <  else if (class->max_ident != 0 && ident >= class->max_ident &&
383 >  else if (class->max_ident && ident >= class->max_ident &&
384             client_p->username[0] != '~')
385      a_limit_reached = 1;
386  
# Line 429 | Line 396 | attach_iline(struct Client *client_p, st
396    return attach_conf(client_p, conf);
397   }
398  
432 /* init_ip_hash_table()
433 *
434 * inputs               - NONE
435 * output               - NONE
436 * side effects         - allocate memory for ip_entry(s)
437 *                      - clear the ip hash table
438 */
439 void
440 init_ip_hash_table(void)
441 {
442  ip_entry_pool = mp_pool_new(sizeof(struct ip_entry), MP_CHUNK_SIZE_IP_ENTRY);
443  memset(ip_hash_table, 0, sizeof(ip_hash_table));
444 }
445
446 /* find_or_add_ip()
447 *
448 * inputs       - pointer to struct irc_ssaddr
449 * output       - pointer to a struct ip_entry
450 * side effects -
451 *
452 * If the ip # was not found, a new struct ip_entry is created, and the ip
453 * count set to 0.
454 */
455 static struct ip_entry *
456 find_or_add_ip(struct irc_ssaddr *ip_in)
457 {
458  struct ip_entry *ptr, *newptr;
459  int hash_index = hash_ip(ip_in), res;
460  struct sockaddr_in *v4 = (struct sockaddr_in *)ip_in, *ptr_v4;
461 #ifdef IPV6
462  struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)ip_in, *ptr_v6;
463 #endif
464
465  for (ptr = ip_hash_table[hash_index]; ptr; ptr = ptr->next)
466  {
467 #ifdef IPV6
468    if (ptr->ip.ss.ss_family != ip_in->ss.ss_family)
469      continue;
470    if (ip_in->ss.ss_family == AF_INET6)
471    {
472      ptr_v6 = (struct sockaddr_in6 *)&ptr->ip;
473      res = memcmp(&v6->sin6_addr, &ptr_v6->sin6_addr, sizeof(struct in6_addr));
474    }
475    else
476 #endif
477    {
478      ptr_v4 = (struct sockaddr_in *)&ptr->ip;
479      res = memcmp(&v4->sin_addr, &ptr_v4->sin_addr, sizeof(struct in_addr));
480    }
481    if (res == 0)
482    {
483      /* Found entry already in hash, return it. */
484      return ptr;
485    }
486  }
487
488  if (ip_entries_count >= 2 * hard_fdlimit)
489    garbage_collect_ip_entries();
490
491  newptr = mp_pool_get(ip_entry_pool);
492  memset(newptr, 0, sizeof(*newptr));
493  ip_entries_count++;
494  memcpy(&newptr->ip, ip_in, sizeof(struct irc_ssaddr));
495
496  newptr->next = ip_hash_table[hash_index];
497  ip_hash_table[hash_index] = newptr;
498
499  return newptr;
500 }
501
502 /* remove_one_ip()
503 *
504 * inputs        - unsigned long IP address value
505 * output        - NONE
506 * side effects  - The ip address given, is looked up in ip hash table
507 *                 and number of ip#'s for that ip decremented.
508 *                 If ip # count reaches 0 and has expired,
509 *                 the struct ip_entry is returned to the ip_entry_heap
510 */
511 void
512 remove_one_ip(struct irc_ssaddr *ip_in)
513 {
514  struct ip_entry *ptr;
515  struct ip_entry *last_ptr = NULL;
516  int hash_index = hash_ip(ip_in), res;
517  struct sockaddr_in *v4 = (struct sockaddr_in *)ip_in, *ptr_v4;
518 #ifdef IPV6
519  struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)ip_in, *ptr_v6;
520 #endif
521
522  for (ptr = ip_hash_table[hash_index]; ptr; ptr = ptr->next)
523  {
524 #ifdef IPV6
525    if (ptr->ip.ss.ss_family != ip_in->ss.ss_family)
526      continue;
527    if (ip_in->ss.ss_family == AF_INET6)
528    {
529      ptr_v6 = (struct sockaddr_in6 *)&ptr->ip;
530      res = memcmp(&v6->sin6_addr, &ptr_v6->sin6_addr, sizeof(struct in6_addr));
531    }
532    else
533 #endif
534    {
535      ptr_v4 = (struct sockaddr_in *)&ptr->ip;
536      res = memcmp(&v4->sin_addr, &ptr_v4->sin_addr, sizeof(struct in_addr));
537    }
538    if (res)
539      continue;
540    if (ptr->count > 0)
541      ptr->count--;
542    if (ptr->count == 0 &&
543        (CurrentTime-ptr->last_attempt) >= ConfigFileEntry.throttle_time)
544    {
545      if (last_ptr != NULL)
546        last_ptr->next = ptr->next;
547      else
548        ip_hash_table[hash_index] = ptr->next;
549
550      mp_pool_release(ptr);
551      ip_entries_count--;
552      return;
553    }
554    last_ptr = ptr;
555  }
556 }
557
558 /* hash_ip()
559 *
560 * input        - pointer to an irc_inaddr
561 * output       - integer value used as index into hash table
562 * side effects - hopefully, none
563 */
564 static int
565 hash_ip(struct irc_ssaddr *addr)
566 {
567  if (addr->ss.ss_family == AF_INET)
568  {
569    struct sockaddr_in *v4 = (struct sockaddr_in *)addr;
570    int hash;
571    uint32_t ip;
572
573    ip   = ntohl(v4->sin_addr.s_addr);
574    hash = ((ip >> 12) + ip) & (IP_HASH_SIZE-1);
575    return hash;
576  }
577 #ifdef IPV6
578  else
579  {
580    int hash;
581    struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)addr;
582    uint32_t *ip = (uint32_t *)&v6->sin6_addr.s6_addr;
583
584    hash  = ip[0] ^ ip[3];
585    hash ^= hash >> 16;
586    hash ^= hash >> 8;
587    hash  = hash & (IP_HASH_SIZE - 1);
588    return hash;
589  }
590 #else
591  return 0;
592 #endif
593 }
594
595 /* count_ip_hash()
596 *
597 * inputs        - pointer to counter of number of ips hashed
598 *               - pointer to memory used for ip hash
599 * output        - returned via pointers input
600 * side effects  - NONE
601 *
602 * number of hashed ip #'s is counted up, plus the amount of memory
603 * used in the hash.
604 */
605 void
606 count_ip_hash(unsigned int *number_ips_stored, uint64_t *mem_ips_stored)
607 {
608  struct ip_entry *ptr;
609  int i;
610
611  *number_ips_stored = 0;
612  *mem_ips_stored    = 0;
613
614  for (i = 0; i < IP_HASH_SIZE; i++)
615  {
616    for (ptr = ip_hash_table[i]; ptr; ptr = ptr->next)
617    {
618      *number_ips_stored += 1;
619      *mem_ips_stored += sizeof(struct ip_entry);
620    }
621  }
622 }
623
624 /* garbage_collect_ip_entries()
625 *
626 * input        - NONE
627 * output       - NONE
628 * side effects - free up all ip entries with no connections
629 */
630 static void
631 garbage_collect_ip_entries(void)
632 {
633  struct ip_entry *ptr;
634  struct ip_entry *last_ptr;
635  struct ip_entry *next_ptr;
636  int i;
637
638  for (i = 0; i < IP_HASH_SIZE; i++)
639  {
640    last_ptr = NULL;
641
642    for (ptr = ip_hash_table[i]; ptr; ptr = next_ptr)
643    {
644      next_ptr = ptr->next;
645
646      if (ptr->count == 0 &&
647          (CurrentTime - ptr->last_attempt) >= ConfigFileEntry.throttle_time)
648      {
649        if (last_ptr != NULL)
650          last_ptr->next = ptr->next;
651        else
652          ip_hash_table[i] = ptr->next;
653        mp_pool_release(ptr);
654        ip_entries_count--;
655      }
656      else
657        last_ptr = ptr;
658    }
659  }
660 }
661
399   /* detach_conf()
400   *
401   * inputs       - pointer to client to detach
# Line 670 | Line 407 | garbage_collect_ip_entries(void)
407   void
408   detach_conf(struct Client *client_p, enum maskitem_type type)
409   {
410 <  dlink_node *ptr = NULL, *next_ptr = NULL;
410 >  dlink_node *ptr = NULL, *ptr_next = NULL;
411  
412 <  DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->confs.head)
412 >  DLINK_FOREACH_SAFE(ptr, ptr_next, client_p->localClient->confs.head)
413    {
414      struct MaskItem *conf = ptr->data;
415  
# Line 713 | Line 450 | detach_conf(struct Client *client_p, enu
450   int
451   attach_conf(struct Client *client_p, struct MaskItem *conf)
452   {
453 <  if (dlinkFind(&client_p->localClient->confs, conf) != NULL)
453 >  if (dlinkFind(&client_p->localClient->confs, conf))
454      return 1;
455  
456    if (conf->type == CONF_CLIENT)
# Line 785 | Line 522 | find_conf_name(dlink_list *list, const c
522  
523      if (conf->type == type)
524      {
525 <      if (conf->name && (irccmp(conf->name, name) == 0 ||
525 >      if (conf->name && (!irccmp(conf->name, name) ||
526                           !match(conf->name, name)))
527        return conf;
528      }
# Line 979 | Line 716 | find_exact_name_conf(enum maskitem_type
716                    if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
717                      return conf;
718                break;
982 #ifdef IPV6
719              case HM_IPV6:
720                if (who->localClient->aftype == AF_INET6)
721                  if (match_ipv6(&who->localClient->ip, &conf->addr, conf->bits))
722                    if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
723                      return conf;
724                break;
989 #endif
725              default:
726                assert(0);
727            }
# Line 1033 | Line 768 | find_exact_name_conf(enum maskitem_type
768   int
769   rehash(int sig)
770   {
771 <  if (sig != 0)
771 >  if (sig)
772      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
773                           "Got signal SIGHUP, reloading configuration file(s)");
774  
# Line 1041 | Line 776 | rehash(int sig)
776  
777    /* don't close listeners until we know we can go ahead with the rehash */
778  
1044  /* Check to see if we magically got(or lost) IPv6 support */
1045  check_can_use_v6();
1046
779    read_conf_files(0);
780  
1049  if (ServerInfo.description != NULL)
1050    strlcpy(me.info, ServerInfo.description, sizeof(me.info));
1051
781    load_conf_modules();
782 <
1054 <  rehashed_klines = 1;
782 >  check_conf_klines();
783  
784    return 0;
785   }
# Line 1074 | Line 802 | set_default_conf(void)
802    assert(class_default == class_get_list()->tail->data);
803  
804   #ifdef HAVE_LIBCRYPTO
805 <  ServerInfo.rsa_private_key = NULL;
806 <  ServerInfo.rsa_private_key_file = NULL;
805 > #if OPENSSL_VERSION_NUMBER >= 0x1000005FL && !defined(OPENSSL_NO_ECDH)
806 >  {
807 >    EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
808 >
809 >    if (key)
810 >    {
811 >      SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key);
812 >      EC_KEY_free(key);
813 >    }
814 >  }
815 >
816 >  SSL_CTX_set_options(ConfigServerInfo.server_ctx, SSL_OP_SINGLE_ECDH_USE);
817 > #endif
818 >
819 >  ConfigServerInfo.message_digest_algorithm = EVP_sha256();
820 >  ConfigServerInfo.rsa_private_key = NULL;
821 >  ConfigServerInfo.rsa_private_key_file = NULL;
822   #endif
823  
824 <  /* ServerInfo.name is not rehashable */
825 <  /* ServerInfo.name = ServerInfo.name; */
826 <  ServerInfo.description = NULL;
827 <  ServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
828 <  ServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
829 <
830 <  memset(&ServerInfo.ip, 0, sizeof(ServerInfo.ip));
831 <  ServerInfo.specific_ipv4_vhost = 0;
832 <  memset(&ServerInfo.ip6, 0, sizeof(ServerInfo.ip6));
833 <  ServerInfo.specific_ipv6_vhost = 0;
834 <
835 <  ServerInfo.max_clients = MAXCLIENTS_MAX;
836 <  ServerInfo.max_nick_length = 9;
837 <  ServerInfo.max_topic_length = 80;
838 <
839 <  ServerInfo.hub = 0;
840 <  ServerInfo.dns_host.sin_addr.s_addr = 0;
841 <  ServerInfo.dns_host.sin_port = 0;
842 <  AdminInfo.name = NULL;
1100 <  AdminInfo.email = NULL;
1101 <  AdminInfo.description = NULL;
824 >  /* ConfigServerInfo.name is not rehashable */
825 >  /* ConfigServerInfo.name = ConfigServerInfo.name; */
826 >  ConfigServerInfo.description = NULL;
827 >  ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
828 >  ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
829 >
830 >  memset(&ConfigServerInfo.ip, 0, sizeof(ConfigServerInfo.ip));
831 >  ConfigServerInfo.specific_ipv4_vhost = 0;
832 >  memset(&ConfigServerInfo.ip6, 0, sizeof(ConfigServerInfo.ip6));
833 >  ConfigServerInfo.specific_ipv6_vhost = 0;
834 >
835 >  ConfigServerInfo.max_clients = MAXCLIENTS_MAX;
836 >  ConfigServerInfo.max_nick_length = 9;
837 >  ConfigServerInfo.max_topic_length = 80;
838 >  ConfigServerInfo.hub = 0;
839 >
840 >  ConfigAdminInfo.name = NULL;
841 >  ConfigAdminInfo.email = NULL;
842 >  ConfigAdminInfo.description = NULL;
843  
844    log_del_all();
845  
846 <  ConfigLoggingEntry.use_logging = 1;
846 >  ConfigLog.use_logging = 1;
847  
848    ConfigChannel.disable_fake_channels = 0;
849 <  ConfigChannel.knock_delay = 300;
849 >  ConfigChannel.invite_client_count = 10;
850 >  ConfigChannel.invite_client_time = 300;
851 >  ConfigChannel.knock_client_count = 1;
852 >  ConfigChannel.knock_client_time = 300;
853    ConfigChannel.knock_delay_channel = 60;
854 <  ConfigChannel.max_chans_per_user = 25;
1111 <  ConfigChannel.max_chans_per_oper = 50;
854 >  ConfigChannel.max_channels = 25;
855    ConfigChannel.max_bans = 25;
856    ConfigChannel.default_split_user_count = 0;
857    ConfigChannel.default_split_server_count = 0;
# Line 1124 | Line 867 | set_default_conf(void)
867    ConfigServerHide.hide_server_ips = 0;
868    ConfigServerHide.disable_remote_commands = 0;
869  
870 <  ConfigFileEntry.service_name = xstrdup(SERVICE_NAME_DEFAULT);
871 <  ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
872 <  ConfigFileEntry.cycle_on_host_change = 1;
873 <  ConfigFileEntry.glines = 0;
874 <  ConfigFileEntry.gline_time = 12 * 3600;
875 <  ConfigFileEntry.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
876 <  ConfigFileEntry.gline_min_cidr = 16;
877 <  ConfigFileEntry.gline_min_cidr6 = 48;
878 <  ConfigFileEntry.invisible_on_connect = 1;
879 <  ConfigFileEntry.tkline_expire_notices = 1;
880 <  ConfigFileEntry.hide_spoof_ips = 1;
881 <  ConfigFileEntry.ignore_bogus_ts = 0;
882 <  ConfigFileEntry.disable_auth = 0;
883 <  ConfigFileEntry.kill_chase_time_limit = 90;
884 <  ConfigFileEntry.default_floodcount = 8;
885 <  ConfigFileEntry.failed_oper_notice = 1;
886 <  ConfigFileEntry.dots_in_ident = 0;
887 <  ConfigFileEntry.min_nonwildcard = 4;
888 <  ConfigFileEntry.min_nonwildcard_simple = 3;
889 <  ConfigFileEntry.max_accept = 20;
890 <  ConfigFileEntry.anti_nick_flood = 0;
891 <  ConfigFileEntry.max_nick_time = 20;
892 <  ConfigFileEntry.max_nick_changes = 5;
893 <  ConfigFileEntry.anti_spam_exit_message_time = 0;
894 <  ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
895 <  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
896 <  ConfigFileEntry.warn_no_nline = 1;
897 <  ConfigFileEntry.stats_o_oper_only = 0;
898 <  ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
899 <  ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
900 <  ConfigFileEntry.stats_P_oper_only = 0;
901 <  ConfigFileEntry.stats_u_oper_only = 0;
902 <  ConfigFileEntry.caller_id_wait = 60;
903 <  ConfigFileEntry.opers_bypass_callerid = 0;
904 <  ConfigFileEntry.pace_wait = 10;
905 <  ConfigFileEntry.pace_wait_simple = 1;
906 <  ConfigFileEntry.short_motd = 0;
907 <  ConfigFileEntry.ping_cookie = 0;
908 <  ConfigFileEntry.no_oper_flood = 0;
909 <  ConfigFileEntry.true_no_oper_flood = 0;
910 <  ConfigFileEntry.oper_pass_resv = 1;
911 <  ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
912 <  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;
913 <  ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE |
914 <    UMODE_OPERWALL | UMODE_WALLOP;
915 <  ConfigFileEntry.use_egd = 0;
916 <  ConfigFileEntry.egdpool_path = NULL;
917 <  ConfigFileEntry.throttle_time = 10;
870 >  ConfigGeneral.away_count = 2;
871 >  ConfigGeneral.away_time = 10;
872 >  ConfigGeneral.max_watch = WATCHSIZE_DEFAULT;
873 >  ConfigGeneral.cycle_on_host_change = 1;
874 >  ConfigGeneral.glines = 0;
875 >  ConfigGeneral.gline_time = 12 * 3600;
876 >  ConfigGeneral.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
877 >  ConfigGeneral.gline_min_cidr = 16;
878 >  ConfigGeneral.gline_min_cidr6 = 48;
879 >  ConfigGeneral.invisible_on_connect = 1;
880 >  ConfigGeneral.tkline_expire_notices = 1;
881 >  ConfigGeneral.hide_spoof_ips = 1;
882 >  ConfigGeneral.ignore_bogus_ts = 0;
883 >  ConfigGeneral.disable_auth = 0;
884 >  ConfigGeneral.kill_chase_time_limit = 90;
885 >  ConfigGeneral.default_floodcount = 8;
886 >  ConfigGeneral.failed_oper_notice = 1;
887 >  ConfigGeneral.dots_in_ident = 0;
888 >  ConfigGeneral.min_nonwildcard = 4;
889 >  ConfigGeneral.min_nonwildcard_simple = 3;
890 >  ConfigGeneral.max_accept = 20;
891 >  ConfigGeneral.anti_nick_flood = 0;
892 >  ConfigGeneral.max_nick_time = 20;
893 >  ConfigGeneral.max_nick_changes = 5;
894 >  ConfigGeneral.anti_spam_exit_message_time = 0;
895 >  ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
896 >  ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
897 >  ConfigGeneral.warn_no_connect_block = 1;
898 >  ConfigGeneral.stats_e_disabled = 0;
899 >  ConfigGeneral.stats_o_oper_only = 0;
900 >  ConfigGeneral.stats_k_oper_only = 1;  /* 1 = masked */
901 >  ConfigGeneral.stats_i_oper_only = 1;  /* 1 = masked */
902 >  ConfigGeneral.stats_P_oper_only = 0;
903 >  ConfigGeneral.stats_u_oper_only = 0;
904 >  ConfigGeneral.caller_id_wait = 60;
905 >  ConfigGeneral.opers_bypass_callerid = 0;
906 >  ConfigGeneral.pace_wait = 10;
907 >  ConfigGeneral.pace_wait_simple = 1;
908 >  ConfigGeneral.short_motd = 0;
909 >  ConfigGeneral.ping_cookie = 0;
910 >  ConfigGeneral.no_oper_flood = 0;
911 >  ConfigGeneral.true_no_oper_flood = 0;
912 >  ConfigGeneral.oper_pass_resv = 1;
913 >  ConfigGeneral.max_targets = MAX_TARGETS_DEFAULT;
914 >  ConfigGeneral.oper_only_umodes = UMODE_DEBUG;
915 >  ConfigGeneral.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | UMODE_WALLOP;
916 >  ConfigGeneral.throttle_count = 1;
917 >  ConfigGeneral.throttle_time = 1;
918   }
919  
920   static void
921   validate_conf(void)
922   {
923 <  if (ConfigFileEntry.ts_warn_delta < TS_WARN_DELTA_MIN)
924 <    ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
1182 <
1183 <  if (ConfigFileEntry.ts_max_delta < TS_MAX_DELTA_MIN)
1184 <    ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
923 >  if (ConfigGeneral.ts_warn_delta < TS_WARN_DELTA_MIN)
924 >    ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
925  
926 <  if (ServerInfo.network_name == NULL)
927 <    ServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
926 >  if (ConfigGeneral.ts_max_delta < TS_MAX_DELTA_MIN)
927 >    ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
928  
929 <  if (ServerInfo.network_desc == NULL)
930 <    ServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
929 >  if (ConfigServerInfo.network_name == NULL)
930 >    ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
931  
932 <  if (ConfigFileEntry.service_name == NULL)
933 <    ConfigFileEntry.service_name = xstrdup(SERVICE_NAME_DEFAULT);
932 >  if (ConfigServerInfo.network_desc == NULL)
933 >    ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
934  
935 <  ConfigFileEntry.max_watch = IRCD_MAX(ConfigFileEntry.max_watch, WATCHSIZE_MIN);
935 >  ConfigGeneral.max_watch = IRCD_MAX(ConfigGeneral.max_watch, WATCHSIZE_MIN);
936   }
937  
938   /* read_conf()
# Line 1206 | Line 946 | read_conf(FILE *file)
946   {
947    lineno = 0;
948  
949 <  set_default_conf(); /* Set default values prior to conf parsing */
949 >  set_default_conf();  /* Set default values prior to conf parsing */
950    conf_parser_ctx.pass = 1;
951 <  yyparse();          /* pick up the classes first */
951 >  yyparse();  /* Pick up the classes first */
952  
953    rewind(file);
954  
955    conf_parser_ctx.pass = 2;
956 <  yyparse();          /* Load the values from the conf */
957 <  validate_conf();    /* Check to make sure some values are still okay. */
958 <                      /* Some global values are also loaded here. */
959 <  class_delete_marked();      /* Make sure classes are valid */
956 >  yyparse();  /* Load the values from the conf */
957 >  validate_conf();  /* Check to make sure some values are still okay. */
958 >                    /* Some global values are also loaded here. */
959 >  class_delete_marked();  /* Delete unused classes that are marked for deletion */
960   }
961  
962   /* lookup_confhost()
# Line 1229 | Line 969 | lookup_confhost(struct MaskItem *conf)
969   {
970    struct addrinfo hints, *res;
971  
972 <  /* Do name lookup now on hostnames given and store the
972 >  /*
973 >   * Do name lookup now on hostnames given and store the
974     * ip numbers in conf structure.
975     */
976    memset(&hints, 0, sizeof(hints));
# Line 1246 | Line 987 | lookup_confhost(struct MaskItem *conf)
987      return;
988    }
989  
990 <  assert(res != NULL);
990 >  assert(res);
991  
992    memcpy(&conf->addr, res->ai_addr, res->ai_addrlen);
993    conf->addr.ss_len = res->ai_addrlen;
# Line 1265 | Line 1006 | lookup_confhost(struct MaskItem *conf)
1006   int
1007   conf_connect_allowed(struct irc_ssaddr *addr, int aftype)
1008   {
1009 <  struct ip_entry *ip_found;
1009 >  struct ip_entry *ip_found = NULL;
1010    struct MaskItem *conf = find_dline_conf(addr, aftype);
1011  
1012    /* DLINE exempt also gets you out of static limits/pacing... */
1013    if (conf && (conf->type == CONF_EXEMPT))
1014      return 0;
1015  
1016 <  if (conf != NULL)
1016 >  if (conf)
1017      return BANNED_CLIENT;
1018  
1019 <  ip_found = find_or_add_ip(addr);
1019 >  ip_found = ipcache_find_or_add_address(addr);
1020  
1021 <  if ((CurrentTime - ip_found->last_attempt) <
1281 <      ConfigFileEntry.throttle_time)
1021 >  if ((CurrentTime - ip_found->last_attempt) < ConfigGeneral.throttle_time)
1022    {
1023 <    ip_found->last_attempt = CurrentTime;
1024 <    return TOO_FAST;
1023 >    if (ip_found->connection_count >= ConfigGeneral.throttle_count)
1024 >      return TOO_FAST;
1025 >
1026 >    ++ip_found->connection_count;
1027    }
1028 +  else
1029 +    ip_found->connection_count = 1;
1030  
1031    ip_found->last_attempt = CurrentTime;
1032    return 0;
# Line 1296 | Line 1040 | conf_connect_allowed(struct irc_ssaddr *
1040   *                This is an event started off in ircd.c
1041   */
1042   void
1043 < cleanup_tklines(void *notused)
1043 > cleanup_tklines(void *unused)
1044   {
1045    hostmask_expire_temporary();
1046    expire_tklines(&xconf_items);
# Line 1313 | Line 1057 | cleanup_tklines(void *notused)
1057   static void
1058   expire_tklines(dlink_list *tklist)
1059   {
1060 <  dlink_node *ptr;
1061 <  dlink_node *next_ptr;
1318 <  struct MaskItem *conf;
1060 >  dlink_node *ptr = NULL, *ptr_next = NULL;
1061 >  struct MaskItem *conf = NULL;
1062  
1063 <  DLINK_FOREACH_SAFE(ptr, next_ptr, tklist->head)
1063 >  DLINK_FOREACH_SAFE(ptr, ptr_next, tklist->head)
1064    {
1065      conf = ptr->data;
1066  
# Line 1326 | Line 1069 | expire_tklines(dlink_list *tklist)
1069  
1070      if (conf->type == CONF_XLINE)
1071      {
1072 <      if (ConfigFileEntry.tkline_expire_notices)
1072 >      if (ConfigGeneral.tkline_expire_notices)
1073          sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1074                                 "Temporary X-line for [%s] expired", conf->name);
1075        conf_free(conf);
1076      }
1077      else if (conf->type == CONF_NRESV || conf->type == CONF_CRESV)
1078      {
1079 <      if (ConfigFileEntry.tkline_expire_notices)
1079 >      if (ConfigGeneral.tkline_expire_notices)
1080          sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1081                                 "Temporary RESV for [%s] expired", conf->name);
1082        conf_free(conf);
# Line 1357 | Line 1100 | static const struct oper_privs
1100    { OPER_FLAG_DIE,            'D' },
1101    { OPER_FLAG_GLINE,          'G' },
1102    { OPER_FLAG_REHASH,         'H' },
1103 <  { OPER_FLAG_K,              'K' },
1361 <  { OPER_FLAG_OPERWALL,       'L' },
1103 >  { OPER_FLAG_KLINE,          'K' },
1104    { OPER_FLAG_KILL,           'N' },
1105    { OPER_FLAG_KILL_REMOTE,    'O' },
1106    { OPER_FLAG_CONNECT,        'P' },
# Line 1375 | Line 1117 | oper_privs_as_string(const unsigned int
1117   {
1118    static char privs_out[IRCD_BUFSIZE];
1119    char *privs_ptr = privs_out;
1378  const struct oper_privs *opriv = flag_list;
1120  
1121 <  for (; opriv->flag; ++opriv)
1121 >  for (const struct oper_privs *opriv = flag_list; opriv->flag; ++opriv)
1122    {
1123      if (port & opriv->flag)
1124        *privs_ptr++ = opriv->c;
# Line 1391 | Line 1132 | oper_privs_as_string(const unsigned int
1132   }
1133  
1134   /*
1135 < * Input: A client to find the active oper{} name for.
1135 > * Input: A client to find the active operator {} name for.
1136   * Output: The nick!user@host{oper} of the oper.
1137   *         "oper" is server name for remote opers
1138   * Side effects: None.
# Line 1417 | Line 1158 | get_oper_name(const struct Client *clien
1158        }
1159      }
1160  
1161 <    /* Probably should assert here for now. If there is an oper out there
1162 <     * with no oper{} conf attached, it would be good for us to know...
1161 >    /*
1162 >     * Probably should assert here for now. If there is an oper out there
1163 >     * with no operator {} conf attached, it would be good for us to know...
1164       */
1165 <    assert(0); /* Oper without oper conf! */
1165 >    assert(0);  /* Oper without oper conf! */
1166    }
1167  
1168    snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
# Line 1437 | Line 1179 | get_oper_name(const struct Client *clien
1179   void
1180   read_conf_files(int cold)
1181   {
1182 <  const char *filename;
1183 <  char chanmodes[IRCD_BUFSIZE];
1184 <  char chanlimit[IRCD_BUFSIZE];
1182 >  const char *filename = NULL;
1183 >  char chanmodes[IRCD_BUFSIZE] = "";
1184 >  char chanlimit[IRCD_BUFSIZE] = "";
1185  
1186    conf_parser_ctx.boot = cold;
1187 <  filename = ConfigFileEntry.configfile;
1187 >  filename = ConfigGeneral.configfile;
1188  
1189    /* We need to know the initial filename for the yyerror() to report
1190       FIXME: The full path is in conffilenamebuf first time since we
1191 <             dont know anything else
1191 >             don't know anything else
1192  
1193       - Gozem 2002-07-21
1194    */
# Line 1477 | Line 1219 | read_conf_files(int cold)
1219  
1220    log_reopen_all();
1221  
1222 <  add_isupport("NICKLEN", NULL, ServerInfo.max_nick_length);
1223 <  add_isupport("NETWORK", ServerInfo.network_name, -1);
1222 >  add_isupport("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1223 >  add_isupport("NETWORK", ConfigServerInfo.network_name, -1);
1224  
1225    snprintf(chanmodes, sizeof(chanmodes), "beI:%d", ConfigChannel.max_bans);
1226    add_isupport("MAXLIST", chanmodes, -1);
1227 <  add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets);
1227 >  add_isupport("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1228    add_isupport("CHANTYPES", "#", -1);
1229  
1230    snprintf(chanlimit, sizeof(chanlimit), "#:%d",
1231 <           ConfigChannel.max_chans_per_user);
1231 >           ConfigChannel.max_channels);
1232    add_isupport("CHANLIMIT", chanlimit, -1);
1233 <  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,imnprstORS");
1234 <  add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN);
1235 <  add_isupport("TOPICLEN", NULL, ServerInfo.max_topic_length);
1233 >  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstMORS");
1234 >  add_isupport("CHANNELLEN", NULL, CHANNELLEN);
1235 >  add_isupport("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1236    add_isupport("CHANMODES", chanmodes, -1);
1237  
1238    /*
# Line 1510 | Line 1252 | static void
1252   clear_out_old_conf(void)
1253   {
1254    dlink_node *ptr = NULL, *next_ptr = NULL;
1513  struct MaskItem *conf;
1255    dlink_list *free_items [] = {
1256      &server_items,   &oconf_items,
1257       &uconf_items,   &xconf_items,
# Line 1527 | Line 1268 | clear_out_old_conf(void)
1268    {
1269      DLINK_FOREACH_SAFE(ptr, next_ptr, (*iterator)->head)
1270      {
1271 <      conf = ptr->data;
1271 >      struct MaskItem *conf = ptr->data;
1272  
1273 <      dlinkDelete(&conf->node, map_to_list(conf->type));
1273 >      conf->active = 0;
1274 >      dlinkDelete(&conf->node, *iterator);
1275  
1276        /* XXX This is less than pretty */
1277        if (conf->type == CONF_SERVER || conf->type == CONF_OPER)
# Line 1560 | Line 1302 | clear_out_old_conf(void)
1302    /* clean out module paths */
1303    mod_clear_paths();
1304  
1305 <  /* clean out ServerInfo */
1306 <  MyFree(ServerInfo.description);
1307 <  ServerInfo.description = NULL;
1308 <  MyFree(ServerInfo.network_name);
1309 <  ServerInfo.network_name = NULL;
1310 <  MyFree(ServerInfo.network_desc);
1311 <  ServerInfo.network_desc = NULL;
1312 <  MyFree(ConfigFileEntry.egdpool_path);
1313 <  ConfigFileEntry.egdpool_path = NULL;
1305 >  pseudo_clear();
1306 >
1307 >  /* clean out ConfigServerInfo */
1308 >  MyFree(ConfigServerInfo.description);
1309 >  ConfigServerInfo.description = NULL;
1310 >  MyFree(ConfigServerInfo.network_name);
1311 >  ConfigServerInfo.network_name = NULL;
1312 >  MyFree(ConfigServerInfo.network_desc);
1313 >  ConfigServerInfo.network_desc = NULL;
1314   #ifdef HAVE_LIBCRYPTO
1315 <  if (ServerInfo.rsa_private_key != NULL)
1315 >  if (ConfigServerInfo.rsa_private_key)
1316    {
1317 <    RSA_free(ServerInfo.rsa_private_key);
1318 <    ServerInfo.rsa_private_key = NULL;
1317 >    RSA_free(ConfigServerInfo.rsa_private_key);
1318 >    ConfigServerInfo.rsa_private_key = NULL;
1319    }
1320  
1321 <  MyFree(ServerInfo.rsa_private_key_file);
1322 <  ServerInfo.rsa_private_key_file = NULL;
1581 <
1582 <  if (ServerInfo.server_ctx)
1583 <    SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|
1584 <                                               SSL_OP_NO_SSLv3|
1585 <                                               SSL_OP_NO_TLSv1);
1586 <  if (ServerInfo.client_ctx)
1587 <    SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|
1588 <                                               SSL_OP_NO_SSLv3|
1589 <                                               SSL_OP_NO_TLSv1);
1321 >  MyFree(ConfigServerInfo.rsa_private_key_file);
1322 >  ConfigServerInfo.rsa_private_key_file = NULL;
1323   #endif
1324  
1325 <  /* clean out AdminInfo */
1326 <  MyFree(AdminInfo.name);
1327 <  AdminInfo.name = NULL;
1328 <  MyFree(AdminInfo.email);
1329 <  AdminInfo.email = NULL;
1330 <  MyFree(AdminInfo.description);
1331 <  AdminInfo.description = NULL;
1325 >  /* clean out ConfigAdminInfo */
1326 >  MyFree(ConfigAdminInfo.name);
1327 >  ConfigAdminInfo.name = NULL;
1328 >  MyFree(ConfigAdminInfo.email);
1329 >  ConfigAdminInfo.email = NULL;
1330 >  MyFree(ConfigAdminInfo.description);
1331 >  ConfigAdminInfo.description = NULL;
1332  
1333    /* clean out listeners */
1334    close_listeners();
1602
1603  /* clean out general */
1604  MyFree(ConfigFileEntry.service_name);
1605  ConfigFileEntry.service_name = NULL;
1335   }
1336  
1337   /* conf_add_class_to_conf()
# Line 1739 | Line 1468 | valid_wild_card_simple(const char *data)
1468   {
1469    const unsigned char *p = (const unsigned char *)data;
1470    unsigned char tmpch = '\0';
1471 <  int nonwild = 0;
1471 >  unsigned int nonwild = 0;
1472  
1473    while ((tmpch = *p++))
1474    {
1475 <    if (tmpch == '\\')
1475 >    if (tmpch == '\\' && *p)
1476      {
1477        ++p;
1478 <      if (++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
1478 >      if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1479          return 1;
1480      }
1481      else if (!IsMWildChar(tmpch))
1482      {
1483 <      if (++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
1483 >      if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1484          return 1;
1485      }
1486    }
# Line 1770 | Line 1499 | valid_wild_card_simple(const char *data)
1499   int
1500   valid_wild_card(struct Client *source_p, int warn, int count, ...)
1501   {
1502 <  char tmpch;
1503 <  int nonwild = 0;
1502 >  unsigned char tmpch = '\0';
1503 >  unsigned int nonwild = 0;
1504    va_list args;
1505  
1506    /*
# Line 1790 | Line 1519 | valid_wild_card(struct Client *source_p,
1519  
1520    while (count--)
1521    {
1522 <    const char *p = va_arg(args, const char *);
1522 >    const unsigned char *p = va_arg(args, const unsigned char *);
1523      if (p == NULL)
1524        continue;
1525  
# Line 1802 | Line 1531 | valid_wild_card(struct Client *source_p,
1531           * If we find enough non-wild characters, we can
1532           * break - no point in searching further.
1533           */
1534 <        if (++nonwild >= ConfigFileEntry.min_nonwildcard)
1534 >        if (++nonwild >= ConfigGeneral.min_nonwildcard)
1535          {
1536            va_end(args);
1537            return 1;
# Line 1813 | Line 1542 | valid_wild_card(struct Client *source_p,
1542  
1543    if (warn)
1544      sendto_one_notice(source_p, &me,
1545 <                      ":Please include at least %d non-wildcard characters with the mask",
1546 <                      ConfigFileEntry.min_nonwildcard);
1545 >                      ":Please include at least %u non-wildcard characters with the mask",
1546 >                      ConfigGeneral.min_nonwildcard);
1547    va_end(args);
1548    return 0;
1549   }
# Line 1856 | Line 1585 | parse_aline(const char *cmd, struct Clie
1585              char **target_server, char **reason)
1586   {
1587    int found_tkline_time=0;
1588 <  static char def_reason[] = "No Reason";
1588 >  static char def_reason[] = CONF_NOREASON;
1589    static char user[USERLEN*4+1];
1590    static char host[HOSTLEN*4+1];
1591  
# Line 2022 | Line 1751 | find_user_host(struct Client *source_p,
1751      /* Okay to use source_p as the first param, because source_p == client_p */
1752      if ((target_p =
1753          find_chasing(source_p, user_host_or_nick)) == NULL)
1754 <      return 0;
1754 >      return 0;  /* find_chasing sends ERR_NOSUCHNICK */
1755  
1756      if (IsExemptKline(target_p))
1757      {
# Line 2088 | Line 1817 | match_conf_password(const char *password
1817    else
1818      encr = password;
1819  
1820 <  return !strcmp(encr, conf->passwd);
1820 >  return encr && !strcmp(encr, conf->passwd);
1821   }
1822  
1823   /*
# Line 2096 | Line 1825 | match_conf_password(const char *password
1825   *
1826   * inputs       - client sending the cluster
1827   *              - command name "KLINE" "XLINE" etc.
1828 < *              - capab -- CAP_KLN etc. from s_serv.h
1828 > *              - capab -- CAP_KLN etc. from server.h
1829   *              - cluster type -- CLUSTER_KLINE etc. from conf.h
1830   *              - pattern and args to send along
1831   * output       - none
# Line 2108 | Line 1837 | cluster_a_line(struct Client *source_p,
1837                 int capab, int cluster_type, const char *pattern, ...)
1838   {
1839    va_list args;
1840 <  char buffer[IRCD_BUFSIZE];
1840 >  char buffer[IRCD_BUFSIZE] = "";
1841    const dlink_node *ptr = NULL;
1842  
1843    va_start(args, pattern);
# Line 2169 | Line 1898 | split_nuh(struct split_nuh_item *const i
1898    {
1899      *p = '\0';
1900  
1901 <    if (iptr->nickptr && *iptr->nuhmask != '\0')
1901 >    if (iptr->nickptr && *iptr->nuhmask)
1902        strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize);
1903  
1904      if ((q = strchr(++p, '@')))
1905      {
1906        *q++ = '\0';
1907  
1908 <      if (*p != '\0')
1908 >      if (*p)
1909          strlcpy(iptr->userptr, p, iptr->usersize);
1910  
1911 <      if (*q != '\0')
1911 >      if (*q)
1912          strlcpy(iptr->hostptr, q, iptr->hostsize);
1913      }
1914      else
1915      {
1916 <      if (*p != '\0')
1916 >      if (*p)
1917          strlcpy(iptr->userptr, p, iptr->usersize);
1918      }
1919    }
# Line 2196 | Line 1925 | split_nuh(struct split_nuh_item *const i
1925        /* if found a @ */
1926        *p++ = '\0';
1927  
1928 <      if (*iptr->nuhmask != '\0')
1928 >      if (*iptr->nuhmask)
1929          strlcpy(iptr->userptr, iptr->nuhmask, iptr->usersize);
1930  
1931 <      if (*p != '\0')
1931 >      if (*p)
1932          strlcpy(iptr->hostptr, p, iptr->hostsize);
1933      }
1934      else

Diff Legend

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