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 4162 by michael, Thu Jul 3 19:39:31 2014 UTC vs.
Revision 4977 by michael, Thu Dec 4 15:12:24 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 "conf_pseudo.h"
32   #include "server.h"
33   #include "resv.h"
34   #include "channel.h"
# Line 44 | Line 45
45   #include "log.h"
46   #include "send.h"
47   #include "memory.h"
47 #include "mempool.h"
48   #include "res.h"
49   #include "userhost.h"
50   #include "user.h"
# Line 54 | Line 54
54   #include "conf_db.h"
55   #include "conf_class.h"
56   #include "motd.h"
57 + #include "ipcache.h"
58  
59  
60   /* general conf items link list root, other than k lines etc. */
# Line 75 | Line 76 | extern int yyparse(); /* defined in y.ta
76   static void read_conf(FILE *);
77   static void clear_out_old_conf(void);
78   static void expire_tklines(dlink_list *);
78 static void garbage_collect_ip_entries(void);
79 static int hash_ip(struct irc_ssaddr *);
79   static int verify_access(struct Client *);
80   static int attach_iline(struct Client *, struct MaskItem *);
82 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  
87 /* usually, with hash tables, you use a prime number...
88 * but in this case I am dealing with ip addresses,
89 * not ascii strings.
90 */
91 #define IP_HASH_SIZE 0x1000
92
93 struct ip_entry
94 {
95  struct irc_ssaddr ip;
96  unsigned int count;  /**< Number of registered users using this IP */
97  unsigned int connection_count;  /**< Number of connections from this IP in the last throttle_time duration */
98  time_t last_attempt;  /**< The last time someone connected from this IP */
99  struct ip_entry *next;
100 };
101
102 static struct ip_entry *ip_hash_table[IP_HASH_SIZE];
103 static mp_pool_t *ip_entry_pool = NULL;
104 static int ip_entries_count = 0;
105
106
85   /* conf_dns_callback()
86   *
87   * inputs       - pointer to struct MaskItem
# Line 115 | 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;
98 >  struct MaskItem *const conf = vptr;
99  
100    conf->dns_pending = 0;
101  
# Line 139 | 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 = MyCalloc(sizeof(*conf));
131 >  struct MaskItem *const conf = MyCalloc(sizeof(*conf));
132    dlink_list *list = NULL;
133  
134    conf->type   = type;
# Line 161 | Line 143 | conf_make(enum maskitem_type type)
143   void
144   conf_free(struct MaskItem *conf)
145   {
146 <  dlink_node *ptr = NULL, *ptr_next = NULL;
146 >  dlink_node *node = NULL, *node_next = NULL;
147    dlink_list *list = NULL;
148  
149 <  if (conf->node.next)
150 <    if ((list = map_to_list(conf->type)))
169 <      dlinkDelete(&conf->node, list);
149 >  if ((list = map_to_list(conf->type)))
150 >    dlinkFindDelete(list, conf);
151  
152    MyFree(conf->name);
153  
# Line 191 | Line 172 | conf_free(struct MaskItem *conf)
172    if (conf->rsa_public_key)
173      RSA_free(conf->rsa_public_key);
174   #endif
175 <  DLINK_FOREACH_SAFE(ptr, ptr_next, conf->hub_list.head)
175 >  DLINK_FOREACH_SAFE(node, node_next, conf->hub_list.head)
176    {
177 <    MyFree(ptr->data);
178 <    dlinkDelete(ptr, &conf->hub_list);
179 <    free_dlink_node(ptr);
177 >    MyFree(node->data);
178 >    dlinkDelete(node, &conf->hub_list);
179 >    free_dlink_node(node);
180    }
181  
182 <  DLINK_FOREACH_SAFE(ptr, ptr_next, conf->leaf_list.head)
182 >  DLINK_FOREACH_SAFE(node, node_next, conf->leaf_list.head)
183    {
184 <    MyFree(ptr->data);
185 <    dlinkDelete(ptr, &conf->leaf_list);
186 <    free_dlink_node(ptr);
184 >    MyFree(node->data);
185 >    dlinkDelete(node, &conf->leaf_list);
186 >    free_dlink_node(node);
187    }
188  
189 <  DLINK_FOREACH_SAFE(ptr, ptr_next, conf->exempt_list.head)
189 >  DLINK_FOREACH_SAFE(node, node_next, conf->exempt_list.head)
190    {
191 <    struct exempt *exptr = ptr->data;
191 >    struct exempt *exptr = node->data;
192  
193 <    dlinkDelete(ptr, &conf->exempt_list);
193 >    dlinkDelete(node, &conf->exempt_list);
194      MyFree(exptr->name);
195      MyFree(exptr->user);
196      MyFree(exptr->host);
# Line 273 | Line 254 | check_client(struct Client *source_p)
254                             "Unauthorized client connection from %s [%s] on [%s/%u].",
255                             get_client_name(source_p, SHOW_IP),
256                             source_p->sockhost,
257 <                           source_p->localClient->listener->name,
258 <                           source_p->localClient->listener->port);
257 >                           source_p->connection->listener->name,
258 >                           source_p->connection->listener->port);
259        ilog(LOG_TYPE_IRCD,
260             "Unauthorized client connection from %s on [%s/%u].",
261             get_client_name(source_p, SHOW_IP),
262 <           source_p->localClient->listener->name,
263 <           source_p->localClient->listener->port);
262 >           source_p->connection->listener->name,
263 >           source_p->connection->listener->port);
264  
265        exit_client(source_p, "You are not authorized to use this server");
266        break;
# Line 312 | Line 293 | verify_access(struct Client *client_p)
293    if (IsGotId(client_p))
294    {
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);
296 >                             &client_p->connection->ip,
297 >                             client_p->connection->aftype,
298 >                             client_p->connection->password);
299    }
300    else
301    {
302      strlcpy(non_ident + 1, client_p->username, sizeof(non_ident) - 1);
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);
304 >                             &client_p->connection->ip,
305 >                             client_p->connection->aftype,
306 >                             client_p->connection->password);
307    }
308  
309    if (conf)
# Line 337 | Line 318 | verify_access(struct Client *client_p)
318          return NOT_AUTHORIZED;
319        }
320  
340      if (IsConfDoIdentd(conf))
341        SetNeedId(client_p);
342
321        /* Thanks for spoof idea amm */
322        if (IsConfDoSpoofIp(conf))
323        {
324 <        if (!ConfigFileEntry.hide_spoof_ips && IsConfSpoofNotice(conf))
324 >        if (IsConfSpoofNotice(conf))
325            sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
326                                 "%s spoofing: %s as %s",
327                                 client_p->name, client_p->host, conf->name);
328          strlcpy(client_p->host, conf->name, sizeof(client_p->host));
351        AddFlag(client_p, FLAGS_IP_SPOOFING | FLAGS_AUTH_SPOOF);
329        }
330  
331        return attach_iline(client_p, conf);
332      }
333 <    else if (IsConfKill(conf) || (ConfigFileEntry.glines && IsConfGline(conf)))
333 >    else if (IsConfKill(conf) || (ConfigGeneral.glines && IsConfGline(conf)))
334      {
335        if (IsConfGline(conf))
336          sendto_one_notice(client_p, &me, ":*** G-lined");
# Line 375 | Line 352 | verify_access(struct Client *client_p)
352   static int
353   attach_iline(struct Client *client_p, struct MaskItem *conf)
354   {
355 <  struct ClassItem *class = NULL;
355 >  const struct ClassItem *const class = conf->class;
356    struct ip_entry *ip_found;
357    int a_limit_reached = 0;
358    unsigned int local = 0, global = 0, ident = 0;
359  
360 <  assert(conf->class);
384 <
385 <  ip_found = find_or_add_ip(&client_p->localClient->ip);
360 >  ip_found = ipcache_find_or_add_address(&client_p->connection->ip);
361    ip_found->count++;
362 <  SetIpHash(client_p);
388 <
389 <  class = conf->class;
362 >  AddFlag(client_p, FLAGS_IPHASH);
363  
364    count_user_host(client_p->username, client_p->host,
365                    &global, &local, &ident);
# Line 419 | Line 392 | attach_iline(struct Client *client_p, st
392    return attach_conf(client_p, conf);
393   }
394  
422 /* init_ip_hash_table()
423 *
424 * inputs               - NONE
425 * output               - NONE
426 * side effects         - allocate memory for ip_entry(s)
427 *                      - clear the ip hash table
428 */
429 void
430 init_ip_hash_table(void)
431 {
432  ip_entry_pool = mp_pool_new(sizeof(struct ip_entry), MP_CHUNK_SIZE_IP_ENTRY);
433  memset(ip_hash_table, 0, sizeof(ip_hash_table));
434 }
435
436 /* find_or_add_ip()
437 *
438 * inputs       - pointer to struct irc_ssaddr
439 * output       - pointer to a struct ip_entry
440 * side effects -
441 *
442 * If the ip # was not found, a new struct ip_entry is created, and the ip
443 * count set to 0.
444 */
445 static struct ip_entry *
446 find_or_add_ip(struct irc_ssaddr *ip_in)
447 {
448  struct ip_entry *ptr, *newptr;
449  int hash_index = hash_ip(ip_in), res;
450  struct sockaddr_in *v4 = (struct sockaddr_in *)ip_in, *ptr_v4;
451 #ifdef IPV6
452  struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)ip_in, *ptr_v6;
453 #endif
454
455  for (ptr = ip_hash_table[hash_index]; ptr; ptr = ptr->next)
456  {
457 #ifdef IPV6
458    if (ptr->ip.ss.ss_family != ip_in->ss.ss_family)
459      continue;
460    if (ip_in->ss.ss_family == AF_INET6)
461    {
462      ptr_v6 = (struct sockaddr_in6 *)&ptr->ip;
463      res = memcmp(&v6->sin6_addr, &ptr_v6->sin6_addr, sizeof(struct in6_addr));
464    }
465    else
466 #endif
467    {
468      ptr_v4 = (struct sockaddr_in *)&ptr->ip;
469      res = memcmp(&v4->sin_addr, &ptr_v4->sin_addr, sizeof(struct in_addr));
470    }
471    if (res == 0)
472    {
473      /* Found entry already in hash, return it. */
474      return ptr;
475    }
476  }
477
478  if (ip_entries_count >= 2 * hard_fdlimit)
479    garbage_collect_ip_entries();
480
481  newptr = mp_pool_get(ip_entry_pool);
482
483  ip_entries_count++;
484  memcpy(&newptr->ip, ip_in, sizeof(struct irc_ssaddr));
485
486  newptr->next = ip_hash_table[hash_index];
487  ip_hash_table[hash_index] = newptr;
488
489  return newptr;
490 }
491
492 /* remove_one_ip()
493 *
494 * inputs        - unsigned long IP address value
495 * output        - NONE
496 * side effects  - The ip address given, is looked up in ip hash table
497 *                 and number of ip#'s for that ip decremented.
498 *                 If ip # count reaches 0 and has expired,
499 *                 the struct ip_entry is returned to the ip_entry_heap
500 */
501 void
502 remove_one_ip(struct irc_ssaddr *ip_in)
503 {
504  struct ip_entry *ptr;
505  struct ip_entry *last_ptr = NULL;
506  int hash_index = hash_ip(ip_in), res;
507  struct sockaddr_in *v4 = (struct sockaddr_in *)ip_in, *ptr_v4;
508 #ifdef IPV6
509  struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)ip_in, *ptr_v6;
510 #endif
511
512  for (ptr = ip_hash_table[hash_index]; ptr; ptr = ptr->next)
513  {
514 #ifdef IPV6
515    if (ptr->ip.ss.ss_family != ip_in->ss.ss_family)
516      continue;
517    if (ip_in->ss.ss_family == AF_INET6)
518    {
519      ptr_v6 = (struct sockaddr_in6 *)&ptr->ip;
520      res = memcmp(&v6->sin6_addr, &ptr_v6->sin6_addr, sizeof(struct in6_addr));
521    }
522    else
523 #endif
524    {
525      ptr_v4 = (struct sockaddr_in *)&ptr->ip;
526      res = memcmp(&v4->sin_addr, &ptr_v4->sin_addr, sizeof(struct in_addr));
527    }
528    if (res)
529      continue;
530    if (ptr->count > 0)
531      ptr->count--;
532    if (ptr->count == 0 &&
533        (CurrentTime-ptr->last_attempt) >= ConfigFileEntry.throttle_time)
534    {
535      if (last_ptr != NULL)
536        last_ptr->next = ptr->next;
537      else
538        ip_hash_table[hash_index] = ptr->next;
539
540      mp_pool_release(ptr);
541      ip_entries_count--;
542      return;
543    }
544    last_ptr = ptr;
545  }
546 }
547
548 /* hash_ip()
549 *
550 * input        - pointer to an irc_inaddr
551 * output       - integer value used as index into hash table
552 * side effects - hopefully, none
553 */
554 static int
555 hash_ip(struct irc_ssaddr *addr)
556 {
557  if (addr->ss.ss_family == AF_INET)
558  {
559    struct sockaddr_in *v4 = (struct sockaddr_in *)addr;
560    int hash;
561    uint32_t ip;
562
563    ip   = ntohl(v4->sin_addr.s_addr);
564    hash = ((ip >> 12) + ip) & (IP_HASH_SIZE-1);
565    return hash;
566  }
567 #ifdef IPV6
568  else
569  {
570    int hash;
571    struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)addr;
572    uint32_t *ip = (uint32_t *)&v6->sin6_addr.s6_addr;
573
574    hash  = ip[0] ^ ip[3];
575    hash ^= hash >> 16;
576    hash ^= hash >> 8;
577    hash  = hash & (IP_HASH_SIZE - 1);
578    return hash;
579  }
580 #else
581  return 0;
582 #endif
583 }
584
585 /* count_ip_hash()
586 *
587 * inputs        - pointer to counter of number of ips hashed
588 *               - pointer to memory used for ip hash
589 * output        - returned via pointers input
590 * side effects  - NONE
591 *
592 * number of hashed ip #'s is counted up, plus the amount of memory
593 * used in the hash.
594 */
595 void
596 count_ip_hash(unsigned int *number_ips_stored, uint64_t *mem_ips_stored)
597 {
598  struct ip_entry *ptr;
599
600  *number_ips_stored = 0;
601  *mem_ips_stored    = 0;
602
603  for (unsigned int i = 0; i < IP_HASH_SIZE; ++i)
604  {
605    for (ptr = ip_hash_table[i]; ptr; ptr = ptr->next)
606    {
607      *number_ips_stored += 1;
608      *mem_ips_stored += sizeof(struct ip_entry);
609    }
610  }
611 }
612
613 /* garbage_collect_ip_entries()
614 *
615 * input        - NONE
616 * output       - NONE
617 * side effects - free up all ip entries with no connections
618 */
619 static void
620 garbage_collect_ip_entries(void)
621 {
622  struct ip_entry *ptr;
623  struct ip_entry *last_ptr;
624  struct ip_entry *next_ptr;
625
626  for (unsigned int i = 0; i < IP_HASH_SIZE; ++i)
627  {
628    last_ptr = NULL;
629
630    for (ptr = ip_hash_table[i]; ptr; ptr = next_ptr)
631    {
632      next_ptr = ptr->next;
633
634      if (ptr->count == 0 &&
635          (CurrentTime - ptr->last_attempt) >= ConfigFileEntry.throttle_time)
636      {
637        if (last_ptr != NULL)
638          last_ptr->next = ptr->next;
639        else
640          ip_hash_table[i] = ptr->next;
641        mp_pool_release(ptr);
642        ip_entries_count--;
643      }
644      else
645        last_ptr = ptr;
646    }
647  }
648 }
649
395   /* detach_conf()
396   *
397   * inputs       - pointer to client to detach
# Line 658 | Line 403 | garbage_collect_ip_entries(void)
403   void
404   detach_conf(struct Client *client_p, enum maskitem_type type)
405   {
406 <  dlink_node *ptr = NULL, *ptr_next = NULL;
406 >  dlink_node *node = NULL, *node_next = NULL;
407  
408 <  DLINK_FOREACH_SAFE(ptr, ptr_next, client_p->localClient->confs.head)
408 >  DLINK_FOREACH_SAFE(node, node_next, client_p->connection->confs.head)
409    {
410 <    struct MaskItem *conf = ptr->data;
410 >    struct MaskItem *conf = node->data;
411  
412      assert(conf->type & (CONF_CLIENT | CONF_OPER | CONF_SERVER));
413      assert(conf->ref_count > 0);
# Line 671 | Line 416 | detach_conf(struct Client *client_p, enu
416      if (!(conf->type & type))
417        continue;
418  
419 <    dlinkDelete(ptr, &client_p->localClient->confs);
420 <    free_dlink_node(ptr);
419 >    dlinkDelete(node, &client_p->connection->confs);
420 >    free_dlink_node(node);
421  
422      if (conf->type == CONF_CLIENT)
423 <      remove_from_cidr_check(&client_p->localClient->ip, conf->class);
423 >      remove_from_cidr_check(&client_p->connection->ip, conf->class);
424  
425      if (--conf->class->ref_count == 0 && conf->class->active == 0)
426      {
# Line 701 | Line 446 | detach_conf(struct Client *client_p, enu
446   int
447   attach_conf(struct Client *client_p, struct MaskItem *conf)
448   {
449 <  if (dlinkFind(&client_p->localClient->confs, conf))
449 >  if (dlinkFind(&client_p->connection->confs, conf))
450      return 1;
451  
452    if (conf->type == CONF_CLIENT)
453      if (cidr_limit_reached(IsConfExemptLimits(conf),
454 <                           &client_p->localClient->ip, conf->class))
454 >                           &client_p->connection->ip, conf->class))
455        return TOO_MANY;    /* Already at maximum allowed */
456  
457    conf->class->ref_count++;
458    conf->ref_count++;
459  
460 <  dlinkAdd(conf, make_dlink_node(), &client_p->localClient->confs);
460 >  dlinkAdd(conf, make_dlink_node(), &client_p->connection->confs);
461  
462    return 0;
463   }
# Line 729 | Line 474 | int
474   attach_connect_block(struct Client *client_p, const char *name,
475                       const char *host)
476   {
477 <  dlink_node *ptr;
733 <  struct MaskItem *conf = NULL;
477 >  dlink_node *node = NULL;
478  
479    assert(client_p != NULL);
480    assert(host != NULL);
# Line 738 | Line 482 | attach_connect_block(struct Client *clie
482    if (client_p == NULL || host == NULL)
483      return 0;
484  
485 <  DLINK_FOREACH(ptr, server_items.head)
485 >  DLINK_FOREACH(node, server_items.head)
486    {
487 <    conf = ptr->data;
487 >    struct MaskItem *conf = node->data;
488  
489      if (match(conf->name, name) || match(conf->host, host))
490        continue;
# Line 764 | Line 508 | attach_connect_block(struct Client *clie
508   struct MaskItem *
509   find_conf_name(dlink_list *list, const char *name, enum maskitem_type type)
510   {
511 <  dlink_node *ptr;
768 <  struct MaskItem* conf;
511 >  dlink_node *node = NULL;
512  
513 <  DLINK_FOREACH(ptr, list->head)
513 >  DLINK_FOREACH(node, list->head)
514    {
515 <    conf = ptr->data;
515 >    struct MaskItem *conf = node->data;
516  
517      if (conf->type == type)
518      {
519 <      if (conf->name && (!irccmp(conf->name, name) ||
520 <                         !match(conf->name, name)))
778 <      return conf;
519 >      if (conf->name && !irccmp(conf->name, name))
520 >        return conf;
521      }
522    }
523  
# Line 835 | Line 577 | struct MaskItem *
577   find_matching_name_conf(enum maskitem_type type, const char *name, const char *user,
578                          const char *host, unsigned int flags)
579   {
580 <  dlink_node *ptr=NULL;
581 <  struct MaskItem *conf=NULL;
582 <  dlink_list *list_p = map_to_list(type);
580 >  dlink_node *node = NULL;
581 >  dlink_list *list = map_to_list(type);
582 >  struct MaskItem *conf = NULL;
583  
584    switch (type)
585    {
586    case CONF_SERVICE:
587 <    DLINK_FOREACH(ptr, list_p->head)
587 >    DLINK_FOREACH(node, list->head)
588      {
589 <      conf = ptr->data;
589 >      conf = node->data;
590  
591        if (EmptyString(conf->name))
592          continue;
# Line 857 | Line 599 | find_matching_name_conf(enum maskitem_ty
599    case CONF_ULINE:
600    case CONF_NRESV:
601    case CONF_CRESV:
602 <    DLINK_FOREACH(ptr, list_p->head)
602 >    DLINK_FOREACH(node, list->head)
603      {
604 <      conf = ptr->data;
604 >      conf = node->data;
605  
606        if (EmptyString(conf->name))
607          continue;
# Line 878 | Line 620 | find_matching_name_conf(enum maskitem_ty
620        break;
621  
622    case CONF_SERVER:
623 <    DLINK_FOREACH(ptr, list_p->head)
623 >    DLINK_FOREACH(node, list->head)
624      {
625 <      conf = ptr->data;
625 >      conf = node->data;
626  
627        if ((name != NULL) && !match(name, conf->name))
628          return conf;
# Line 908 | Line 650 | struct MaskItem *
650   find_exact_name_conf(enum maskitem_type type, const struct Client *who, const char *name,
651                       const char *user, const char *host)
652   {
653 <  dlink_node *ptr = NULL;
654 <  struct MaskItem *conf;
655 <  dlink_list *list_p = map_to_list(type);
653 >  dlink_node *node = NULL;
654 >  dlink_list *list = map_to_list(type);
655 >  struct MaskItem *conf = NULL;
656  
657    switch(type)
658    {
# Line 919 | Line 661 | find_exact_name_conf(enum maskitem_type
661    case CONF_NRESV:
662    case CONF_CRESV:
663  
664 <    DLINK_FOREACH(ptr, list_p->head)
664 >    DLINK_FOREACH(node, list->head)
665      {
666 <      conf = ptr->data;
666 >      conf = node->data;
667  
668        if (EmptyString(conf->name))
669          continue;
# Line 939 | Line 681 | find_exact_name_conf(enum maskitem_type
681      break;
682  
683    case CONF_OPER:
684 <    DLINK_FOREACH(ptr, list_p->head)
684 >    DLINK_FOREACH(node, list->head)
685      {
686 <      conf = ptr->data;
686 >      conf = node->data;
687  
688        if (EmptyString(conf->name))
689          continue;
# Line 962 | Line 704 | find_exact_name_conf(enum maskitem_type
704                    return conf;
705                break;
706              case HM_IPV4:
707 <              if (who->localClient->aftype == AF_INET)
708 <                if (match_ipv4(&who->localClient->ip, &conf->addr, conf->bits))
707 >              if (who->connection->aftype == AF_INET)
708 >                if (match_ipv4(&who->connection->ip, &conf->addr, conf->bits))
709                    if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
710                      return conf;
711                break;
970 #ifdef IPV6
712              case HM_IPV6:
713 <              if (who->localClient->aftype == AF_INET6)
714 <                if (match_ipv6(&who->localClient->ip, &conf->addr, conf->bits))
713 >              if (who->connection->aftype == AF_INET6)
714 >                if (match_ipv6(&who->connection->ip, &conf->addr, conf->bits))
715                    if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
716                      return conf;
717                break;
977 #endif
718              default:
719                assert(0);
720            }
# Line 985 | Line 725 | find_exact_name_conf(enum maskitem_type
725      break;
726  
727    case CONF_SERVER:
728 <    DLINK_FOREACH(ptr, list_p->head)
728 >    DLINK_FOREACH(node, list->head)
729      {
730 <      conf = ptr->data;
730 >      conf = node->data;
731  
732        if (EmptyString(conf->name))
733          continue;
# Line 1029 | Line 769 | rehash(int sig)
769  
770    /* don't close listeners until we know we can go ahead with the rehash */
771  
1032  /* Check to see if we magically got(or lost) IPv6 support */
1033  check_can_use_v6();
1034
772    read_conf_files(0);
773  
1037  if (ServerInfo.description)
1038    strlcpy(me.info, ServerInfo.description, sizeof(me.info));
1039
774    load_conf_modules();
775    check_conf_klines();
776  
# Line 1061 | Line 795 | set_default_conf(void)
795    assert(class_default == class_get_list()->tail->data);
796  
797   #ifdef HAVE_LIBCRYPTO
798 <  ServerInfo.message_digest_algorithm = EVP_sha256();
799 <  ServerInfo.rsa_private_key = NULL;
800 <  ServerInfo.rsa_private_key_file = NULL;
798 > #if OPENSSL_VERSION_NUMBER >= 0x009080FFL && !defined(OPENSSL_NO_ECDH)
799 >  {
800 >    EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
801 >
802 >    if (key)
803 >    {
804 >      SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key);
805 >      EC_KEY_free(key);
806 >    }
807 >  }
808 >
809 >  SSL_CTX_set_options(ConfigServerInfo.server_ctx, SSL_OP_SINGLE_ECDH_USE);
810 > #endif
811 >
812 >  SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, "EECDH+HIGH:EDH+HIGH:HIGH:!aNULL");
813 >  ConfigServerInfo.message_digest_algorithm = EVP_sha256();
814 >  ConfigServerInfo.rsa_private_key = NULL;
815 >  ConfigServerInfo.rsa_private_key_file = NULL;
816   #endif
817  
818 <  /* ServerInfo.name is not rehashable */
819 <  /* ServerInfo.name = ServerInfo.name; */
820 <  ServerInfo.description = NULL;
821 <  ServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
822 <  ServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
823 <
824 <  memset(&ServerInfo.ip, 0, sizeof(ServerInfo.ip));
825 <  ServerInfo.specific_ipv4_vhost = 0;
826 <  memset(&ServerInfo.ip6, 0, sizeof(ServerInfo.ip6));
827 <  ServerInfo.specific_ipv6_vhost = 0;
828 <
829 <  ServerInfo.max_clients = MAXCLIENTS_MAX;
830 <  ServerInfo.max_nick_length = 9;
831 <  ServerInfo.max_topic_length = 80;
832 <
833 <  ServerInfo.hub = 0;
834 <  ServerInfo.dns_host.sin_addr.s_addr = 0;
835 <  ServerInfo.dns_host.sin_port = 0;
836 <  AdminInfo.name = NULL;
1088 <  AdminInfo.email = NULL;
1089 <  AdminInfo.description = NULL;
818 >  /* ConfigServerInfo.name is not rehashable */
819 >  /* ConfigServerInfo.name = ConfigServerInfo.name; */
820 >  ConfigServerInfo.description = NULL;
821 >  ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
822 >  ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
823 >
824 >  memset(&ConfigServerInfo.ip, 0, sizeof(ConfigServerInfo.ip));
825 >  ConfigServerInfo.specific_ipv4_vhost = 0;
826 >  memset(&ConfigServerInfo.ip6, 0, sizeof(ConfigServerInfo.ip6));
827 >  ConfigServerInfo.specific_ipv6_vhost = 0;
828 >
829 >  ConfigServerInfo.max_clients = MAXCLIENTS_MAX;
830 >  ConfigServerInfo.max_nick_length = 9;
831 >  ConfigServerInfo.max_topic_length = 80;
832 >  ConfigServerInfo.hub = 0;
833 >
834 >  ConfigAdminInfo.name = NULL;
835 >  ConfigAdminInfo.email = NULL;
836 >  ConfigAdminInfo.description = NULL;
837  
838    log_del_all();
839  
840 <  ConfigLoggingEntry.use_logging = 1;
840 >  ConfigLog.use_logging = 1;
841  
842    ConfigChannel.disable_fake_channels = 0;
843    ConfigChannel.invite_client_count = 10;
# Line 1114 | Line 861 | set_default_conf(void)
861    ConfigServerHide.hide_server_ips = 0;
862    ConfigServerHide.disable_remote_commands = 0;
863  
864 <  ConfigFileEntry.service_name = xstrdup(SERVICE_NAME_DEFAULT);
865 <  ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
866 <  ConfigFileEntry.cycle_on_host_change = 1;
867 <  ConfigFileEntry.glines = 0;
868 <  ConfigFileEntry.gline_time = 12 * 3600;
869 <  ConfigFileEntry.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
870 <  ConfigFileEntry.gline_min_cidr = 16;
871 <  ConfigFileEntry.gline_min_cidr6 = 48;
872 <  ConfigFileEntry.invisible_on_connect = 1;
873 <  ConfigFileEntry.tkline_expire_notices = 1;
874 <  ConfigFileEntry.hide_spoof_ips = 1;
875 <  ConfigFileEntry.ignore_bogus_ts = 0;
876 <  ConfigFileEntry.disable_auth = 0;
877 <  ConfigFileEntry.kill_chase_time_limit = 90;
878 <  ConfigFileEntry.default_floodcount = 8;
879 <  ConfigFileEntry.failed_oper_notice = 1;
880 <  ConfigFileEntry.dots_in_ident = 0;
881 <  ConfigFileEntry.min_nonwildcard = 4;
882 <  ConfigFileEntry.min_nonwildcard_simple = 3;
883 <  ConfigFileEntry.max_accept = 20;
884 <  ConfigFileEntry.anti_nick_flood = 0;
885 <  ConfigFileEntry.max_nick_time = 20;
886 <  ConfigFileEntry.max_nick_changes = 5;
887 <  ConfigFileEntry.anti_spam_exit_message_time = 0;
888 <  ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
889 <  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
890 <  ConfigFileEntry.warn_no_connect_block = 1;
891 <  ConfigFileEntry.stats_e_disabled = 0;
892 <  ConfigFileEntry.stats_o_oper_only = 0;
893 <  ConfigFileEntry.stats_k_oper_only = 1;  /* 1 = masked */
894 <  ConfigFileEntry.stats_i_oper_only = 1;  /* 1 = masked */
895 <  ConfigFileEntry.stats_P_oper_only = 0;
896 <  ConfigFileEntry.stats_u_oper_only = 0;
897 <  ConfigFileEntry.caller_id_wait = 60;
898 <  ConfigFileEntry.opers_bypass_callerid = 0;
899 <  ConfigFileEntry.pace_wait = 10;
900 <  ConfigFileEntry.pace_wait_simple = 1;
901 <  ConfigFileEntry.short_motd = 0;
902 <  ConfigFileEntry.ping_cookie = 0;
903 <  ConfigFileEntry.no_oper_flood = 0;
904 <  ConfigFileEntry.true_no_oper_flood = 0;
905 <  ConfigFileEntry.oper_pass_resv = 1;
906 <  ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
907 <  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;
908 <  ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | UMODE_WALLOP;
909 <  ConfigFileEntry.use_egd = 0;
910 <  ConfigFileEntry.egdpool_path = NULL;
1164 <  ConfigFileEntry.throttle_count = 1;
1165 <  ConfigFileEntry.throttle_time = 1;
864 >  ConfigGeneral.away_count = 2;
865 >  ConfigGeneral.away_time = 10;
866 >  ConfigGeneral.max_watch = WATCHSIZE_DEFAULT;
867 >  ConfigGeneral.cycle_on_host_change = 1;
868 >  ConfigGeneral.glines = 0;
869 >  ConfigGeneral.gline_time = 12 * 3600;
870 >  ConfigGeneral.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
871 >  ConfigGeneral.gline_min_cidr = 16;
872 >  ConfigGeneral.gline_min_cidr6 = 48;
873 >  ConfigGeneral.invisible_on_connect = 1;
874 >  ConfigGeneral.tkline_expire_notices = 1;
875 >  ConfigGeneral.ignore_bogus_ts = 0;
876 >  ConfigGeneral.disable_auth = 0;
877 >  ConfigGeneral.kill_chase_time_limit = 90;
878 >  ConfigGeneral.default_floodcount = 8;
879 >  ConfigGeneral.failed_oper_notice = 1;
880 >  ConfigGeneral.dots_in_ident = 0;
881 >  ConfigGeneral.min_nonwildcard = 4;
882 >  ConfigGeneral.min_nonwildcard_simple = 3;
883 >  ConfigGeneral.max_accept = 20;
884 >  ConfigGeneral.anti_nick_flood = 0;
885 >  ConfigGeneral.max_nick_time = 20;
886 >  ConfigGeneral.max_nick_changes = 5;
887 >  ConfigGeneral.anti_spam_exit_message_time = 0;
888 >  ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
889 >  ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
890 >  ConfigGeneral.warn_no_connect_block = 1;
891 >  ConfigGeneral.stats_e_disabled = 0;
892 >  ConfigGeneral.stats_o_oper_only = 0;
893 >  ConfigGeneral.stats_k_oper_only = 1;  /* 1 = masked */
894 >  ConfigGeneral.stats_i_oper_only = 1;  /* 1 = masked */
895 >  ConfigGeneral.stats_P_oper_only = 0;
896 >  ConfigGeneral.stats_u_oper_only = 0;
897 >  ConfigGeneral.caller_id_wait = 60;
898 >  ConfigGeneral.opers_bypass_callerid = 0;
899 >  ConfigGeneral.pace_wait = 10;
900 >  ConfigGeneral.pace_wait_simple = 1;
901 >  ConfigGeneral.short_motd = 0;
902 >  ConfigGeneral.ping_cookie = 0;
903 >  ConfigGeneral.no_oper_flood = 0;
904 >  ConfigGeneral.true_no_oper_flood = 0;
905 >  ConfigGeneral.oper_pass_resv = 1;
906 >  ConfigGeneral.max_targets = MAX_TARGETS_DEFAULT;
907 >  ConfigGeneral.oper_only_umodes = UMODE_DEBUG;
908 >  ConfigGeneral.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | UMODE_WALLOP;
909 >  ConfigGeneral.throttle_count = 1;
910 >  ConfigGeneral.throttle_time = 1;
911   }
912  
913   static void
914   validate_conf(void)
915   {
916 <  if (ConfigFileEntry.ts_warn_delta < TS_WARN_DELTA_MIN)
917 <    ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
1173 <
1174 <  if (ConfigFileEntry.ts_max_delta < TS_MAX_DELTA_MIN)
1175 <    ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
916 >  if (ConfigGeneral.ts_warn_delta < TS_WARN_DELTA_MIN)
917 >    ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
918  
919 <  if (ServerInfo.network_name == NULL)
920 <    ServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
919 >  if (ConfigGeneral.ts_max_delta < TS_MAX_DELTA_MIN)
920 >    ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
921  
922 <  if (ServerInfo.network_desc == NULL)
923 <    ServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
922 >  if (ConfigServerInfo.network_name == NULL)
923 >    ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
924  
925 <  if (ConfigFileEntry.service_name == NULL)
926 <    ConfigFileEntry.service_name = xstrdup(SERVICE_NAME_DEFAULT);
925 >  if (ConfigServerInfo.network_desc == NULL)
926 >    ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
927  
928 <  ConfigFileEntry.max_watch = IRCD_MAX(ConfigFileEntry.max_watch, WATCHSIZE_MIN);
928 >  ConfigGeneral.max_watch = IRCD_MAX(ConfigGeneral.max_watch, WATCHSIZE_MIN);
929   }
930  
931   /* read_conf()
# Line 1258 | Line 1000 | int
1000   conf_connect_allowed(struct irc_ssaddr *addr, int aftype)
1001   {
1002    struct ip_entry *ip_found = NULL;
1003 <  struct MaskItem *conf = find_dline_conf(addr, aftype);
1003 >  struct MaskItem *const conf = find_dline_conf(addr, aftype);
1004  
1005    /* DLINE exempt also gets you out of static limits/pacing... */
1006    if (conf && (conf->type == CONF_EXEMPT))
# Line 1267 | Line 1009 | conf_connect_allowed(struct irc_ssaddr *
1009    if (conf)
1010      return BANNED_CLIENT;
1011  
1012 <  ip_found = find_or_add_ip(addr);
1012 >  ip_found = ipcache_find_or_add_address(addr);
1013  
1014 <  if ((CurrentTime - ip_found->last_attempt) < ConfigFileEntry.throttle_time)
1014 >  if ((CurrentTime - ip_found->last_attempt) < ConfigGeneral.throttle_time)
1015    {
1016 <    if (ip_found->connection_count >= ConfigFileEntry.throttle_count)
1016 >    if (ip_found->connection_count >= ConfigGeneral.throttle_count)
1017        return TOO_FAST;
1018  
1019      ++ip_found->connection_count;
# Line 1291 | Line 1033 | conf_connect_allowed(struct irc_ssaddr *
1033   *                This is an event started off in ircd.c
1034   */
1035   void
1036 < cleanup_tklines(void *notused)
1036 > cleanup_tklines(void *unused)
1037   {
1038    hostmask_expire_temporary();
1039    expire_tklines(&xconf_items);
# Line 1306 | Line 1048 | cleanup_tklines(void *notused)
1048   * side effects - expire tklines
1049   */
1050   static void
1051 < expire_tklines(dlink_list *tklist)
1051 > expire_tklines(dlink_list *list)
1052   {
1053 <  dlink_node *ptr = NULL, *ptr_next = NULL;
1312 <  struct MaskItem *conf = NULL;
1053 >  dlink_node *node = NULL, *node_next = NULL;
1054  
1055 <  DLINK_FOREACH_SAFE(ptr, ptr_next, tklist->head)
1055 >  DLINK_FOREACH_SAFE(node, node_next, list->head)
1056    {
1057 <    conf = ptr->data;
1057 >    struct MaskItem *conf = node->data;
1058  
1059      if (!conf->until || conf->until > CurrentTime)
1060        continue;
1061  
1062      if (conf->type == CONF_XLINE)
1063      {
1064 <      if (ConfigFileEntry.tkline_expire_notices)
1064 >      if (ConfigGeneral.tkline_expire_notices)
1065          sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1066                                 "Temporary X-line for [%s] expired", conf->name);
1067        conf_free(conf);
1068      }
1069      else if (conf->type == CONF_NRESV || conf->type == CONF_CRESV)
1070      {
1071 <      if (ConfigFileEntry.tkline_expire_notices)
1071 >      if (ConfigGeneral.tkline_expire_notices)
1072          sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1073                                 "Temporary RESV for [%s] expired", conf->name);
1074        conf_free(conf);
# Line 1383 | Line 1124 | oper_privs_as_string(const unsigned int
1124   }
1125  
1126   /*
1127 < * Input: A client to find the active oper{} name for.
1127 > * Input: A client to find the active operator {} name for.
1128   * Output: The nick!user@host{oper} of the oper.
1129   *         "oper" is server name for remote opers
1130   * Side effects: None.
# Line 1391 | Line 1132 | oper_privs_as_string(const unsigned int
1132   const char *
1133   get_oper_name(const struct Client *client_p)
1134   {
1394  const dlink_node *cnode = NULL;
1135    /* +5 for !,@,{,} and null */
1136    static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
1137  
1138 +  if (IsServer(client_p))
1139 +    return client_p->name;
1140 +
1141    if (MyConnect(client_p))
1142    {
1143 <    if ((cnode = client_p->localClient->confs.head))
1143 >    const dlink_node *const node = client_p->connection->confs.head;
1144 >
1145 >    if (node)
1146      {
1147 <      const struct MaskItem *conf = cnode->data;
1147 >      const struct MaskItem *const conf = node->data;
1148  
1149 <      if (IsConfOperator(conf))
1149 >      if (conf->type == CONF_OPER)
1150        {
1151          snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1152                   client_p->username, client_p->host, conf->name);
# Line 1409 | Line 1154 | get_oper_name(const struct Client *clien
1154        }
1155      }
1156  
1157 <    /* Probably should assert here for now. If there is an oper out there
1158 <     * with no oper{} conf attached, it would be good for us to know...
1157 >    /*
1158 >     * Probably should assert here for now. If there is an oper out there
1159 >     * with no operator {} conf attached, it would be good for us to know...
1160       */
1161 <    assert(0); /* Oper without oper conf! */
1161 >    assert(0);  /* Oper without oper conf! */
1162    }
1163  
1164    snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
# Line 1434 | Line 1180 | read_conf_files(int cold)
1180    char chanlimit[IRCD_BUFSIZE] = "";
1181  
1182    conf_parser_ctx.boot = cold;
1183 <  filename = ConfigFileEntry.configfile;
1183 >  filename = ConfigGeneral.configfile;
1184  
1185    /* We need to know the initial filename for the yyerror() to report
1186       FIXME: The full path is in conffilenamebuf first time since we
1187 <             dont know anything else
1187 >             don't know anything else
1188  
1189       - Gozem 2002-07-21
1190    */
# Line 1469 | Line 1215 | read_conf_files(int cold)
1215  
1216    log_reopen_all();
1217  
1218 <  add_isupport("NICKLEN", NULL, ServerInfo.max_nick_length);
1219 <  add_isupport("NETWORK", ServerInfo.network_name, -1);
1218 >  add_isupport("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1219 >  add_isupport("NETWORK", ConfigServerInfo.network_name, -1);
1220  
1221    snprintf(chanmodes, sizeof(chanmodes), "beI:%d", ConfigChannel.max_bans);
1222    add_isupport("MAXLIST", chanmodes, -1);
1223 <  add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets);
1223 >  add_isupport("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1224    add_isupport("CHANTYPES", "#", -1);
1225  
1226    snprintf(chanlimit, sizeof(chanlimit), "#:%d",
# Line 1482 | Line 1228 | read_conf_files(int cold)
1228    add_isupport("CHANLIMIT", chanlimit, -1);
1229    snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstMORS");
1230    add_isupport("CHANNELLEN", NULL, CHANNELLEN);
1231 <  add_isupport("TOPICLEN", NULL, ServerInfo.max_topic_length);
1231 >  add_isupport("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1232    add_isupport("CHANMODES", chanmodes, -1);
1233  
1234    /*
# Line 1501 | Line 1247 | read_conf_files(int cold)
1247   static void
1248   clear_out_old_conf(void)
1249   {
1250 <  dlink_node *ptr = NULL, *next_ptr = NULL;
1505 <  struct MaskItem *conf;
1250 >  dlink_node *node = NULL, *node_next = NULL;
1251    dlink_list *free_items [] = {
1252      &server_items,   &oconf_items,
1253       &uconf_items,   &xconf_items,
# Line 1517 | Line 1262 | clear_out_old_conf(void)
1262  
1263    for (; *iterator != NULL; iterator++)
1264    {
1265 <    DLINK_FOREACH_SAFE(ptr, next_ptr, (*iterator)->head)
1265 >    DLINK_FOREACH_SAFE(node, node_next, (*iterator)->head)
1266      {
1267 <      conf = ptr->data;
1267 >      struct MaskItem *conf = node->data;
1268  
1269 <      dlinkDelete(&conf->node, map_to_list(conf->type));
1269 >      conf->active = 0;
1270 >      dlinkDelete(&conf->node, *iterator);
1271  
1272        /* XXX This is less than pretty */
1273        if (conf->type == CONF_SERVER || conf->type == CONF_OPER)
# Line 1552 | Line 1298 | clear_out_old_conf(void)
1298    /* clean out module paths */
1299    mod_clear_paths();
1300  
1301 <  /* clean out ServerInfo */
1302 <  MyFree(ServerInfo.description);
1303 <  ServerInfo.description = NULL;
1304 <  MyFree(ServerInfo.network_name);
1305 <  ServerInfo.network_name = NULL;
1306 <  MyFree(ServerInfo.network_desc);
1307 <  ServerInfo.network_desc = NULL;
1308 <  MyFree(ConfigFileEntry.egdpool_path);
1309 <  ConfigFileEntry.egdpool_path = NULL;
1301 >  pseudo_clear();
1302 >
1303 >  /* clean out ConfigServerInfo */
1304 >  MyFree(ConfigServerInfo.description);
1305 >  ConfigServerInfo.description = NULL;
1306 >  MyFree(ConfigServerInfo.network_name);
1307 >  ConfigServerInfo.network_name = NULL;
1308 >  MyFree(ConfigServerInfo.network_desc);
1309 >  ConfigServerInfo.network_desc = NULL;
1310   #ifdef HAVE_LIBCRYPTO
1311 <  if (ServerInfo.rsa_private_key)
1311 >  if (ConfigServerInfo.rsa_private_key)
1312    {
1313 <    RSA_free(ServerInfo.rsa_private_key);
1314 <    ServerInfo.rsa_private_key = NULL;
1313 >    RSA_free(ConfigServerInfo.rsa_private_key);
1314 >    ConfigServerInfo.rsa_private_key = NULL;
1315    }
1316  
1317 <  MyFree(ServerInfo.rsa_private_key_file);
1318 <  ServerInfo.rsa_private_key_file = NULL;
1317 >  MyFree(ConfigServerInfo.rsa_private_key_file);
1318 >  ConfigServerInfo.rsa_private_key_file = NULL;
1319   #endif
1320  
1321 <  /* clean out AdminInfo */
1322 <  MyFree(AdminInfo.name);
1323 <  AdminInfo.name = NULL;
1324 <  MyFree(AdminInfo.email);
1325 <  AdminInfo.email = NULL;
1326 <  MyFree(AdminInfo.description);
1327 <  AdminInfo.description = NULL;
1321 >  /* clean out ConfigAdminInfo */
1322 >  MyFree(ConfigAdminInfo.name);
1323 >  ConfigAdminInfo.name = NULL;
1324 >  MyFree(ConfigAdminInfo.email);
1325 >  ConfigAdminInfo.email = NULL;
1326 >  MyFree(ConfigAdminInfo.description);
1327 >  ConfigAdminInfo.description = NULL;
1328  
1329    /* clean out listeners */
1330    close_listeners();
1585
1586  /* clean out general */
1587  MyFree(ConfigFileEntry.service_name);
1588  ConfigFileEntry.service_name = NULL;
1331   }
1332  
1333   /* conf_add_class_to_conf()
# Line 1601 | Line 1343 | conf_add_class_to_conf(struct MaskItem *
1343    {
1344      conf->class = class_default;
1345  
1346 <    if (conf->type == CONF_CLIENT)
1346 >    if (conf->type == CONF_CLIENT || conf->type == CONF_OPER)
1347        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1348                             "Warning *** Defaulting to default class for %s@%s",
1349                             conf->user, conf->host);
# Line 1615 | Line 1357 | conf_add_class_to_conf(struct MaskItem *
1357  
1358    if (conf->class == NULL)
1359    {
1360 <    if (conf->type == CONF_CLIENT)
1360 >    if (conf->type == CONF_CLIENT || conf->type == CONF_OPER)
1361        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1362                             "Warning *** Defaulting to default class for %s@%s",
1363                             conf->user, conf->host);
# Line 1726 | Line 1468 | valid_wild_card_simple(const char *data)
1468  
1469    while ((tmpch = *p++))
1470    {
1471 <    if (tmpch == '\\')
1471 >    if (tmpch == '\\' && *p)
1472      {
1473        ++p;
1474 <      if (++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
1474 >      if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1475          return 1;
1476      }
1477      else if (!IsMWildChar(tmpch))
1478      {
1479 <      if (++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
1479 >      if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1480          return 1;
1481      }
1482    }
# Line 1785 | Line 1527 | valid_wild_card(struct Client *source_p,
1527           * If we find enough non-wild characters, we can
1528           * break - no point in searching further.
1529           */
1530 <        if (++nonwild >= ConfigFileEntry.min_nonwildcard)
1530 >        if (++nonwild >= ConfigGeneral.min_nonwildcard)
1531          {
1532            va_end(args);
1533            return 1;
# Line 1797 | Line 1539 | valid_wild_card(struct Client *source_p,
1539    if (warn)
1540      sendto_one_notice(source_p, &me,
1541                        ":Please include at least %u non-wildcard characters with the mask",
1542 <                      ConfigFileEntry.min_nonwildcard);
1542 >                      ConfigGeneral.min_nonwildcard);
1543    va_end(args);
1544    return 0;
1545   }
# Line 2009 | Line 1751 | find_user_host(struct Client *source_p,
1751  
1752      if (IsExemptKline(target_p))
1753      {
1754 <      if (!IsServer(source_p))
1754 >      if (IsClient(source_p))
1755          sendto_one_notice(source_p, &me, ":%s is E-lined", target_p->name);
1756        return 0;
1757      }
# Line 2023 | Line 1765 | find_user_host(struct Client *source_p,
1765      if (target_p->username[0] == '~')
1766        luser[0] = '*';
1767  
1768 <    if (target_p->sockhost[0] == '\0' ||
2027 <        (target_p->sockhost[0] == '0' && target_p->sockhost[1] == '\0'))
1768 >    if (!strcmp(target_p->sockhost, "0"))
1769        strlcpy(lhost, target_p->host, HOSTLEN*4 + 1);
1770      else
1771        strlcpy(lhost, target_p->sockhost, HOSTLEN*4 + 1);
# Line 2092 | Line 1833 | cluster_a_line(struct Client *source_p,
1833   {
1834    va_list args;
1835    char buffer[IRCD_BUFSIZE] = "";
1836 <  const dlink_node *ptr = NULL;
1836 >  const dlink_node *node = NULL;
1837  
1838    va_start(args, pattern);
1839    vsnprintf(buffer, sizeof(buffer), pattern, args);
1840    va_end(args);
1841  
1842 <  DLINK_FOREACH(ptr, cluster_items.head)
1842 >  DLINK_FOREACH(node, cluster_items.head)
1843    {
1844 <    const struct MaskItem *conf = ptr->data;
1844 >    const struct MaskItem *conf = node->data;
1845  
1846      if (conf->flags & cluster_type)
1847        sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab,

Diff Legend

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