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-7.2/src/s_conf.c (file contents), Revision 948 by michael, Tue Jul 21 17:34:06 2009 UTC vs.
ircd-hybrid-8/src/conf.c (file contents), Revision 1377 by michael, Mon Apr 30 19:35:16 2012 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  s_conf.c: Configuration file functions.
3 > *  conf.c: Configuration file functions.
4   *
5   *  Copyright (C) 2002 by the past and present ircd coders, and others.
6   *
# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 + #include "list.h"
27   #include "ircd_defs.h"
28 < #include "tools.h"
29 < #include "s_conf.h"
28 > #include "balloc.h"
29 > #include "conf.h"
30   #include "s_serv.h"
31   #include "resv.h"
32   #include "channel.h"
33   #include "client.h"
33 #include "common.h"
34   #include "event.h"
35 #include "hash.h"
35   #include "hook.h"
36   #include "irc_string.h"
38 #include "sprintf_irc.h"
37   #include "s_bsd.h"
40 #include "irc_getaddrinfo.h"
38   #include "ircd.h"
42 #include "list.h"
39   #include "listener.h"
40   #include "hostmask.h"
41   #include "modules.h"
42   #include "numeric.h"
43   #include "fdlist.h"
44 < #include "s_log.h"
44 > #include "log.h"
45   #include "send.h"
46   #include "s_gline.h"
51 #include "fileio.h"
47   #include "memory.h"
48   #include "irc_res.h"
49   #include "userhost.h"
50   #include "s_user.h"
51   #include "channel_mode.h"
52 + #include "parse.h"
53 + #include "s_misc.h"
54  
55   struct Callback *client_check_cb = NULL;
56   struct config_server_hide ConfigServerHide;
57  
58   /* general conf items link list root, other than k lines etc. */
59 + dlink_list service_items = { NULL, NULL, 0 };
60   dlink_list server_items  = { NULL, NULL, 0 };
61   dlink_list cluster_items = { NULL, NULL, 0 };
62   dlink_list hub_items     = { NULL, NULL, 0 };
# Line 72 | Line 70 | dlink_list nresv_items   = { NULL, NULL,
70   dlink_list class_items   = { NULL, NULL, 0 };
71   dlink_list gdeny_items   = { NULL, NULL, 0 };
72  
75 dlink_list temporary_klines  = { NULL, NULL, 0 };
76 dlink_list temporary_dlines  = { NULL, NULL, 0 };
73   dlink_list temporary_xlines  = { NULL, NULL, 0 };
78 dlink_list temporary_rklines = { NULL, NULL, 0 };
79 dlink_list temporary_glines  = { NULL, NULL, 0 };
80 dlink_list temporary_rxlines = { NULL, NULL, 0 };
74   dlink_list temporary_resv = { NULL, NULL, 0 };
75  
76   extern unsigned int lineno;
77   extern char linebuf[];
78   extern char conffilebuf[IRCD_BUFSIZE];
86 extern char yytext[];
79   extern int yyparse(); /* defined in y.tab.c */
80 < int ypass = 1; /* used by yyparse()      */
80 >
81 > struct conf_parser_context conf_parser_ctx = { 0, 0, NULL };
82  
83   /* internally defined functions */
84 < static void lookup_confhost(struct ConfItem *);
92 < static void set_default_conf(void);
93 < static void validate_conf(void);
94 < static void read_conf(FBFILE *);
84 > static void read_conf(FILE *);
85   static void clear_out_old_conf(void);
86   static void flush_deleted_I_P(void);
87   static void expire_tklines(dlink_list *);
# Line 114 | Line 104 | static void destroy_cidr_class(struct Cl
104  
105   static void flags_to_ascii(unsigned int, const unsigned int[], char *, int);
106  
117 FBFILE *conf_fbfile_in = NULL;
118
107   /* address of default class conf */
108   static struct ConfItem *class_default;
109  
# Line 138 | Line 126 | static BlockHeap *ip_entry_heap = NULL;
126   static int ip_entries_count = 0;
127  
128  
129 < inline void *
129 > void *
130   map_to_conf(struct ConfItem *aconf)
131   {
132    void *conf;
133 <  conf = (void *)((unsigned long)aconf +
134 <                  (unsigned long)sizeof(struct ConfItem));
133 >  conf = (void *)((uintptr_t)aconf +
134 >                  (uintptr_t)sizeof(struct ConfItem));
135    return(conf);
136   }
137  
138 < inline struct ConfItem *
138 > struct ConfItem *
139   unmap_conf_item(void *aconf)
140   {
141    struct ConfItem *conf;
142  
143 <  conf = (struct ConfItem *)((unsigned long)aconf -
144 <                             (unsigned long)sizeof(struct ConfItem));
143 >  conf = (struct ConfItem *)((uintptr_t)aconf -
144 >                             (uintptr_t)sizeof(struct ConfItem));
145    return(conf);
146   }
147  
# Line 168 | Line 156 | unmap_conf_item(void *aconf)
156   * if successful save hp in the conf item it was called with
157   */
158   static void
159 < conf_dns_callback(void *vptr, struct DNSReply *reply)
159 > conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name)
160   {
161 <  struct AccessItem *aconf = (struct AccessItem *)vptr;
174 <  struct ConfItem *conf;
161 >  struct AccessItem *aconf = vptr;
162  
163 <  MyFree(aconf->dns_query);
177 <  aconf->dns_query = NULL;
163 >  aconf->dns_pending = 0;
164  
165 <  if (reply != NULL)
166 <    memcpy(&aconf->ipnum, &reply->addr, sizeof(reply->addr));
167 <  else {
168 <    ilog(L_NOTICE, "Host not found: %s, ignoring connect{} block",
183 <         aconf->host);
184 <    conf = unmap_conf_item(aconf);
185 <    sendto_realops_flags(UMODE_ALL, L_ALL,
186 <                         "Ignoring connect{} block for %s - host not found",
187 <                         conf->name);
188 <    delete_conf_item(conf);
189 <  }
165 >  if (addr != NULL)
166 >    memcpy(&aconf->ipnum, addr, sizeof(aconf->ipnum));
167 >  else
168 >    aconf->dns_failed = 1;
169   }
170  
171   /* conf_dns_lookup()
# Line 198 | Line 177 | conf_dns_callback(void *vptr, struct DNS
177   static void
178   conf_dns_lookup(struct AccessItem *aconf)
179   {
180 <  if (aconf->dns_query == NULL)
180 >  if (!aconf->dns_pending)
181    {
182 <    aconf->dns_query = MyMalloc(sizeof(struct DNSQuery));
183 <    aconf->dns_query->ptr = aconf;
205 <    aconf->dns_query->callback = conf_dns_callback;
206 <    gethost_byname(aconf->host, aconf->dns_query);
182 >    aconf->dns_pending = 1;
183 >    gethost_byname(conf_dns_callback, aconf, aconf->host);
184    }
185   }
186  
# Line 303 | Line 280 | make_conf_item(ConfType type)
280                                         sizeof(struct MatchItem));
281      dlinkAdd(conf, &conf->node, &xconf_items);
282      break;
283 <
283 > #ifdef HAVE_LIBPCRE
284    case RXLINE_TYPE:
285      conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) +
286                                         sizeof(struct MatchItem));
# Line 317 | Line 294 | make_conf_item(ConfType type)
294      aconf->status = CONF_KLINE;
295      dlinkAdd(conf, &conf->node, &rkconf_items);
296      break;
297 <
297 > #endif
298    case CLUSTER_TYPE:
299      conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem));
300      dlinkAdd(conf, &conf->node, &cluster_items);
# Line 334 | Line 311 | make_conf_item(ConfType type)
311      dlinkAdd(conf, &conf->node, &nresv_items);
312      break;
313  
314 +  case SERVICE_TYPE:
315 +    status = CONF_SERVICE;
316 +    conf = MyMalloc(sizeof(struct ConfItem));
317 +    dlinkAdd(conf, &conf->node, &service_items);
318 +    break;
319 +
320    case CLASS_TYPE:
321      conf = MyMalloc(sizeof(struct ConfItem) +
322                             sizeof(struct ClassItem));
# Line 341 | Line 324 | make_conf_item(ConfType type)
324  
325      aclass = map_to_conf(conf);
326      aclass->active = 1;
327 <    ConFreq(aclass) = DEFAULT_CONNECTFREQUENCY;
328 <    PingFreq(aclass) = DEFAULT_PINGFREQUENCY;
329 <    MaxTotal(aclass) = MAXIMUM_LINKS_DEFAULT;
330 <    MaxSendq(aclass) = DEFAULT_SENDQ;
327 >    aclass->con_freq = DEFAULT_CONNECTFREQUENCY;
328 >    aclass->ping_freq = DEFAULT_PINGFREQUENCY;
329 >    aclass->max_total = MAXIMUM_LINKS_DEFAULT;
330 >    aclass->max_sendq = DEFAULT_SENDQ;
331  
332      break;
333  
# Line 381 | Line 364 | delete_conf_item(struct ConfItem *conf)
364    case SERVER_TYPE:
365      aconf = map_to_conf(conf);
366  
367 <    if (aconf->dns_query != NULL)
368 <    {
386 <      delete_resolver_queries(aconf->dns_query);
387 <      MyFree(aconf->dns_query);
388 <    }
367 >    if (aconf->dns_pending)
368 >      delete_resolver_queries(aconf);
369      if (aconf->passwd != NULL)
370        memset(aconf->passwd, 0, strlen(aconf->passwd));
371      if (aconf->spasswd != NULL)
# Line 398 | Line 378 | delete_conf_item(struct ConfItem *conf)
378      MyFree(aconf->oper_reason);
379      MyFree(aconf->user);
380      MyFree(aconf->host);
381 <    MyFree(aconf->fakename);
381 >    MyFree(aconf->cipher_list);
382   #ifdef HAVE_LIBCRYPTO
383      if (aconf->rsa_public_key)
384        RSA_free(aconf->rsa_public_key);
# Line 478 | Line 458 | delete_conf_item(struct ConfItem *conf)
458      dlinkDelete(&conf->node, &xconf_items);
459      MyFree(conf);
460      break;
461 <
461 > #ifdef HAVE_LIBPCRE
462    case RKLINE_TYPE:
463      aconf = map_to_conf(conf);
464      MyFree(aconf->regexuser);
# Line 501 | Line 481 | delete_conf_item(struct ConfItem *conf)
481      dlinkDelete(&conf->node, &rxconf_items);
482      MyFree(conf);
483      break;
484 <
484 > #endif
485    case NRESV_TYPE:
486      match_item = map_to_conf(conf);
487      MyFree(match_item->user);
# Line 543 | Line 523 | delete_conf_item(struct ConfItem *conf)
523      MyFree(conf);
524      break;
525  
526 +  case SERVICE_TYPE:
527 +    dlinkDelete(&conf->node, &service_items);
528 +    MyFree(conf);
529 +    break;
530 +
531    default:
532      break;
533    }
# Line 576 | Line 561 | static const unsigned int shared_bit_tab
561   * side effects -
562   */
563   void
564 < report_confitem_types(struct Client *source_p, ConfType type, int temp)
564 > report_confitem_types(struct Client *source_p, ConfType type)
565   {
566    dlink_node *ptr = NULL;
567    struct ConfItem *conf = NULL;
# Line 585 | Line 570 | report_confitem_types(struct Client *sou
570    struct ClassItem *classitem = NULL;
571    char buf[12];
572    char *p = NULL;
588  const char *pfx = NULL;
573  
574    switch (type)
575    {
# Line 628 | Line 612 | report_confitem_types(struct Client *sou
612      }
613      break;
614  
615 + #ifdef HAVE_LIBPCRE
616    case RXLINE_TYPE:
617      DLINK_FOREACH(ptr, rxconf_items.head)
618      {
# Line 636 | Line 621 | report_confitem_types(struct Client *sou
621  
622        sendto_one(source_p, form_str(RPL_STATSXLINE),
623                   me.name, source_p->name,
624 <                 matchitem->hold ? "xR": "XR", matchitem->count,
624 >                 "XR", matchitem->count,
625                   conf->name, matchitem->reason);
626      }
627      break;
628  
629    case RKLINE_TYPE:
645    pfx = temp ? "kR" : "KR";
646
630      DLINK_FOREACH(ptr, rkconf_items.head)
631      {
632        aconf = map_to_conf((conf = ptr->data));
633  
651      if (temp && !(conf->flags & CONF_FLAGS_TEMPORARY))
652        continue;
653
634        sendto_one(source_p, form_str(RPL_STATSKLINE), me.name,
635 <                 source_p->name, pfx, aconf->host, aconf->user,
635 >                 source_p->name, "KR", aconf->host, aconf->user,
636                   aconf->reason, aconf->oper_reason ? aconf->oper_reason : "");
637      }
638      break;
639 + #endif
640  
641    case ULINE_TYPE:
642      DLINK_FOREACH(ptr, uconf_items.head)
# Line 700 | Line 681 | report_confitem_types(struct Client *sou
681        aconf = map_to_conf(conf);
682  
683        /* Don't allow non opers to see oper privs */
684 <      if (IsOper(source_p))
684 >      if (HasUMode(source_p, UMODE_OPER))
685          sendto_one(source_p, form_str(RPL_STATSOLINE),
686                     me.name, source_p->name, 'O', aconf->user, aconf->host,
687                     conf->name, oper_privs_as_string(aconf->port),
# Line 720 | Line 701 | report_confitem_types(struct Client *sou
701        classitem = map_to_conf(conf);
702        sendto_one(source_p, form_str(RPL_STATSYLINE),
703                   me.name, source_p->name, 'Y',
704 <                 conf->name, PingFreq(classitem),
705 <                 ConFreq(classitem),
706 <                 MaxTotal(classitem), MaxSendq(classitem),
707 <                 CurrUserCount(classitem),
704 >                 conf->name, classitem->ping_freq,
705 >                 classitem->con_freq,
706 >                 classitem->max_total, classitem->max_sendq,
707 >                 classitem->curr_user_count,
708                   classitem->active ? "active" : "disabled");
709      }
710      break;
# Line 732 | Line 713 | report_confitem_types(struct Client *sou
713    case CLIENT_TYPE:
714      break;
715  
716 +  case SERVICE_TYPE:
717 +    DLINK_FOREACH(ptr, service_items.head)
718 +    {
719 +      conf = ptr->data;
720 +      sendto_one(source_p, form_str(RPL_STATSSERVICE),
721 +                 me.name, source_p->name, 'S', "*", conf->name, 0, 0);
722 +    }
723 +    break;
724 +
725    case SERVER_TYPE:
726      DLINK_FOREACH(ptr, server_items.head)
727      {
# Line 744 | Line 734 | report_confitem_types(struct Client *sou
734  
735        if (IsConfAllowAutoConn(aconf))
736          *p++ = 'A';
737 <      if (IsConfCryptLink(aconf))
738 <        *p++ = 'C';
749 <      if (aconf->fakename)
750 <        *p++ = 'M';
737 >      if (IsConfSSL(aconf))
738 >        *p++ = 'S';
739        if (IsConfTopicBurst(aconf))
740          *p++ = 'T';
753      if (IsConfCompressed(aconf))
754        *p++ = 'Z';
741        if (buf[0] == '\0')
742          *p++ = '*';
743  
# Line 760 | Line 746 | report_confitem_types(struct Client *sou
746        /*
747         * Allow admins to see actual ips unless hide_server_ips is enabled
748         */
749 <      if (!ConfigServerHide.hide_server_ips && IsAdmin(source_p))
749 >      if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
750          sendto_one(source_p, form_str(RPL_STATSCLINE),
751                     me.name, source_p->name, 'C', aconf->host,
752                     buf, conf->name, aconf->port,
# Line 800 | Line 786 | report_confitem_types(struct Client *sou
786    case CRESV_TYPE:
787    case NRESV_TYPE:
788    case CLUSTER_TYPE:
789 +  default:
790      break;
791    }
792   }
# Line 826 | Line 813 | check_client(va_list args)
813  
814    /* I'm already in big trouble if source_p->localClient is NULL -db */
815    if ((i = verify_access(source_p, username)))
816 <    ilog(L_INFO, "Access denied: %s[%s]",
816 >    ilog(LOG_TYPE_IRCD, "Access denied: %s[%s]",
817           source_p->name, source_p->sockhost);
818  
819    switch (i)
# Line 836 | Line 823 | check_client(va_list args)
823                             "Too many on IP for %s (%s).",
824                             get_client_name(source_p, SHOW_IP),
825                             source_p->sockhost);
826 <      ilog(L_INFO,"Too many connections on IP from %s.",
826 >      ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.",
827             get_client_name(source_p, SHOW_IP));
828        ++ServerStats.is_ref;
829        exit_client(source_p, &me, "No more connections allowed on that IP");
# Line 847 | Line 834 | check_client(va_list args)
834                             "I-line is full for %s (%s).",
835                             get_client_name(source_p, SHOW_IP),
836                             source_p->sockhost);
837 <      ilog(L_INFO,"Too many connections from %s.",
837 >      ilog(LOG_TYPE_IRCD, "Too many connections from %s.",
838             get_client_name(source_p, SHOW_IP));
839        ++ServerStats.is_ref;
840        exit_client(source_p, &me,
# Line 864 | Line 851 | check_client(va_list args)
851                             source_p->sockhost,
852                             source_p->localClient->listener->name,
853                             source_p->localClient->listener->port);
854 <      ilog(L_INFO,
854 >      ilog(LOG_TYPE_IRCD,
855            "Unauthorized client connection from %s on [%s/%u].",
856            get_client_name(source_p, SHOW_IP),
857            source_p->localClient->listener->name,
# Line 1027 | Line 1014 | attach_iline(struct Client *client_p, st
1014     * setting a_limit_reached if any limit is reached.
1015     * - Dianora
1016     */
1017 <  if (MaxTotal(aclass) != 0 && CurrUserCount(aclass) >= MaxTotal(aclass))
1017 >  if (aclass->max_total != 0 && aclass->curr_user_count >= aclass->max_total)
1018      a_limit_reached = 1;
1019 <  else if (MaxPerIp(aclass) != 0 && ip_found->count > MaxPerIp(aclass))
1019 >  else if (aclass->max_perip != 0 && ip_found->count > aclass->max_perip)
1020      a_limit_reached = 1;
1021 <  else if (MaxLocal(aclass) != 0 && local >= MaxLocal(aclass))
1021 >  else if (aclass->max_local != 0 && local >= aclass->max_local)
1022      a_limit_reached = 1;
1023 <  else if (MaxGlobal(aclass) != 0 && global >= MaxGlobal(aclass))
1023 >  else if (aclass->max_global != 0 && global >= aclass->max_global)
1024      a_limit_reached = 1;
1025 <  else if (MaxIdent(aclass) != 0 && ident >= MaxIdent(aclass) &&
1025 >  else if (aclass->max_ident != 0 && ident >= aclass->max_ident &&
1026             client_p->username[0] != '~')
1027      a_limit_reached = 1;
1028  
# Line 1191 | Line 1178 | hash_ip(struct irc_ssaddr *addr)
1178    {
1179      struct sockaddr_in *v4 = (struct sockaddr_in *)addr;
1180      int hash;
1181 <    u_int32_t ip;
1181 >    uint32_t ip;
1182  
1183      ip   = ntohl(v4->sin_addr.s_addr);
1184      hash = ((ip >> 12) + ip) & (IP_HASH_SIZE-1);
# Line 1202 | Line 1189 | hash_ip(struct irc_ssaddr *addr)
1189    {
1190      int hash;
1191      struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)addr;
1192 <    u_int32_t *ip = (u_int32_t *)&v6->sin6_addr.s6_addr;
1192 >    uint32_t *ip = (uint32_t *)&v6->sin6_addr.s6_addr;
1193  
1194      hash  = ip[0] ^ ip[3];
1195      hash ^= hash >> 16;  
# Line 1318 | Line 1305 | detach_conf(struct Client *client_p, Con
1305  
1306          assert(aconf->clients > 0);
1307  
1308 <        if ((aclass_conf = ClassPtr(aconf)) != NULL)
1308 >        if ((aclass_conf = aconf->class_ptr) != NULL)
1309          {
1310            aclass = map_to_conf(aclass_conf);
1311  
# Line 1384 | Line 1371 | attach_conf(struct Client *client_p, str
1371                               &client_p->localClient->ip, aclass))
1372          return TOO_MANY;    /* Already at maximum allowed */
1373  
1374 <    CurrUserCount(aclass)++;
1374 >    aclass->curr_user_count++;
1375      aconf->clients++;
1376    }
1377    else if (conf->type == HUB_TYPE || conf->type == LEAF_TYPE)
# Line 1480 | Line 1467 | find_conf_exact(ConfType type, const cha
1467      {
1468        struct ClassItem *aclass = map_to_conf(aconf->class_ptr);
1469  
1470 <      if (aconf->clients >= MaxTotal(aclass))
1470 >      if (aconf->clients >= aclass->max_total)
1471          continue;
1472      }
1473  
# Line 1552 | Line 1539 | map_to_list(ConfType type)
1539    case SERVER_TYPE:
1540      return(&server_items);
1541      break;
1542 +  case SERVICE_TYPE:
1543 +    return(&service_items);
1544 +    break;
1545    case CLUSTER_TYPE:
1546      return(&cluster_items);
1547      break;
# Line 1587 | Line 1577 | find_matching_name_conf(ConfType type, c
1577  
1578    switch (type)
1579    {
1580 <    case RXLINE_TYPE:
1580 > #ifdef HAVE_LIBPCRE
1581 >  case RXLINE_TYPE:
1582        DLINK_FOREACH(ptr, list_p->head)
1583        {
1584          conf = ptr->data;
# Line 1597 | Line 1588 | find_matching_name_conf(ConfType type, c
1588            return conf;
1589        }
1590        break;
1591 + #endif
1592 +  case SERVICE_TYPE:
1593 +    DLINK_FOREACH(ptr, list_p->head)
1594 +    {
1595 +      conf = ptr->data;
1596 +
1597 +      if (EmptyString(conf->name))
1598 +        continue;
1599 +      if ((name != NULL) && !irccmp(name, conf->name))
1600 +        return conf;
1601 +    }
1602 +    break;
1603  
1604    case XLINE_TYPE:
1605    case ULINE_TYPE:
# Line 1651 | Line 1654 | find_matching_name_conf(ConfType type, c
1654   * side effects - looks for an exact match on name field
1655   */
1656   struct ConfItem *
1657 < find_exact_name_conf(ConfType type, const char *name,
1657 > find_exact_name_conf(ConfType type, const struct Client *who, const char *name,
1658                       const char *user, const char *host)
1659   {
1660    dlink_node *ptr = NULL;
# Line 1692 | Line 1695 | find_exact_name_conf(ConfType type, cons
1695      DLINK_FOREACH(ptr, list_p->head)
1696      {
1697        conf = ptr->data;
1698 <      aconf = (struct AccessItem *)map_to_conf(conf);
1698 >      aconf = map_to_conf(conf);
1699 >
1700        if (EmptyString(conf->name))
1701 <        continue;
1702 <    
1703 <      if (irccmp(conf->name, name) == 0)
1701 >        continue;
1702 >
1703 >      if (!irccmp(conf->name, name))
1704        {
1705 <        if ((user == NULL && (host == NULL)))
1706 <          return (conf);
1707 <        if (EmptyString(aconf->user) || EmptyString(aconf->host))
1708 <          return (conf);
1709 <        if (match(aconf->user, user) && match(aconf->host, host))
1710 <          return (conf);
1705 >        if (!who)
1706 >          return conf;
1707 >        if (EmptyString(aconf->user) || EmptyString(aconf->host))
1708 >          return conf;
1709 >        if (match(aconf->user, who->username))
1710 >        {
1711 >          switch (aconf->type)
1712 >          {
1713 >            case HM_HOST:
1714 >              if (match(aconf->host, who->host) || match(aconf->host, who->sockhost))
1715 >                return conf;
1716 >              break;
1717 >            case HM_IPV4:
1718 >              if (who->localClient->aftype == AF_INET)
1719 >                if (match_ipv4(&who->localClient->ip, &aconf->ipnum, aconf->bits))
1720 >                  return conf;
1721 >              break;
1722 > #ifdef IPV6
1723 >            case HM_IPV6:
1724 >              if (who->localClient->aftype == AF_INET6)
1725 >                if (match_ipv6(&who->localClient->ip, &aconf->ipnum, aconf->bits))
1726 >                  return conf;
1727 >              break;
1728 > #endif
1729 >            default:
1730 >              assert(0);
1731 >          }
1732 >        }
1733        }
1734      }
1735 +
1736      break;
1737  
1738    case SERVER_TYPE:
# Line 1761 | Line 1788 | rehash(int sig)
1788      sendto_realops_flags(UMODE_ALL, L_ALL,
1789                           "Got signal SIGHUP, reloading ircd.conf file");
1790  
1764 #ifndef _WIN32
1791    restart_resolver();
1792 < #endif
1792 >
1793    /* don't close listeners until we know we can go ahead with the rehash */
1794  
1795    /* Check to see if we magically got(or lost) IPv6 support */
# Line 1774 | Line 1800 | rehash(int sig)
1800    if (ServerInfo.description != NULL)
1801      strlcpy(me.info, ServerInfo.description, sizeof(me.info));
1802  
1777 #ifndef STATIC_MODULES
1803    load_conf_modules();
1779 #endif
1804  
1805    flush_deleted_I_P();
1806  
1807    rehashed_klines = 1;
1808 <
1808 > /* XXX */
1809    if (ConfigLoggingEntry.use_logging)
1810 <    reopen_log(logFileName);
1810 >    log_close_all();
1811  
1812    return(0);
1813   }
# Line 1822 | Line 1846 | set_default_conf(void)
1846    ServerInfo.specific_ipv6_vhost = 0;
1847  
1848    ServerInfo.max_clients = MAXCLIENTS_MAX;
1849 <  /* Don't reset hub, as that will break lazylinks */
1850 <  /* ServerInfo.hub = NO; */
1849 >
1850 >  ServerInfo.hub = 0;
1851    ServerInfo.dns_host.sin_addr.s_addr = 0;
1852    ServerInfo.dns_host.sin_port = 0;
1853    AdminInfo.name = NULL;
1854    AdminInfo.email = NULL;
1855    AdminInfo.description = NULL;
1856  
1857 <  set_log_level(L_NOTICE);
1857 >  log_close_all();
1858 >
1859    ConfigLoggingEntry.use_logging = 1;
1860 <  ConfigLoggingEntry.operlog[0] = '\0';
1861 <  ConfigLoggingEntry.userlog[0] = '\0';
1862 <  ConfigLoggingEntry.klinelog[0] = '\0';
1863 <  ConfigLoggingEntry.glinelog[0] = '\0';
1864 <  ConfigLoggingEntry.killlog[0] = '\0';
1865 <  ConfigLoggingEntry.operspylog[0] = '\0';
1866 <  ConfigLoggingEntry.ioerrlog[0] = '\0';
1842 <  ConfigLoggingEntry.failed_operlog[0] = '\0';
1843 <
1844 <  ConfigChannel.disable_fake_channels = NO;
1845 <  ConfigChannel.restrict_channels = NO;
1846 <  ConfigChannel.disable_local_channels = NO;
1847 <  ConfigChannel.use_invex = YES;
1848 <  ConfigChannel.use_except = YES;
1849 <  ConfigChannel.use_knock = YES;
1860 >
1861 >  ConfigChannel.disable_fake_channels = 0;
1862 >  ConfigChannel.restrict_channels = 0;
1863 >  ConfigChannel.disable_local_channels = 0;
1864 >  ConfigChannel.use_invex = 1;
1865 >  ConfigChannel.use_except = 1;
1866 >  ConfigChannel.use_knock = 1;
1867    ConfigChannel.knock_delay = 300;
1868    ConfigChannel.knock_delay_channel = 60;
1869    ConfigChannel.max_chans_per_user = 15;
1870 <  ConfigChannel.quiet_on_ban = YES;
1870 >  ConfigChannel.quiet_on_ban = 1;
1871    ConfigChannel.max_bans = 25;
1872    ConfigChannel.default_split_user_count = 0;
1873    ConfigChannel.default_split_server_count = 0;
1874 <  ConfigChannel.no_join_on_split = NO;
1875 <  ConfigChannel.no_create_on_split = NO;
1876 <  ConfigChannel.burst_topicwho = YES;
1874 >  ConfigChannel.no_join_on_split = 0;
1875 >  ConfigChannel.no_create_on_split = 0;
1876 >  ConfigChannel.burst_topicwho = 1;
1877  
1878 <  ConfigServerHide.flatten_links = NO;
1878 >  ConfigServerHide.flatten_links = 0;
1879    ConfigServerHide.links_delay = 300;
1880 <  ConfigServerHide.hidden = NO;
1881 <  ConfigServerHide.disable_hidden = NO;
1882 <  ConfigServerHide.hide_servers = NO;
1880 >  ConfigServerHide.hidden = 0;
1881 >  ConfigServerHide.disable_hidden = 0;
1882 >  ConfigServerHide.hide_servers = 0;
1883    DupString(ConfigServerHide.hidden_name, NETWORK_NAME_DEFAULT);
1884 <  ConfigServerHide.hide_server_ips = NO;
1884 >  ConfigServerHide.hide_server_ips = 0;
1885  
1886    
1887 +  DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT);
1888    ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
1889    ConfigFileEntry.gline_min_cidr = 16;
1890    ConfigFileEntry.gline_min_cidr6 = 48;
1891 <  ConfigFileEntry.invisible_on_connect = YES;
1892 <  ConfigFileEntry.burst_away = NO;
1893 <  ConfigFileEntry.use_whois_actually = YES;
1894 <  ConfigFileEntry.tkline_expire_notices = YES;
1895 <  ConfigFileEntry.hide_spoof_ips = YES;
1896 <  ConfigFileEntry.ignore_bogus_ts = NO;
1897 <  ConfigFileEntry.disable_auth = NO;
1898 <  ConfigFileEntry.disable_remote = NO;
1891 >  ConfigFileEntry.invisible_on_connect = 1;
1892 >  ConfigFileEntry.burst_away = 0;
1893 >  ConfigFileEntry.use_whois_actually = 1;
1894 >  ConfigFileEntry.tkline_expire_notices = 1;
1895 >  ConfigFileEntry.hide_spoof_ips = 1;
1896 >  ConfigFileEntry.ignore_bogus_ts = 0;
1897 >  ConfigFileEntry.disable_auth = 0;
1898 >  ConfigFileEntry.disable_remote = 0;
1899    ConfigFileEntry.kill_chase_time_limit = 90;
1900 <  ConfigFileEntry.default_floodcount = 8; /* XXX */
1901 <  ConfigFileEntry.failed_oper_notice = YES;
1902 <  ConfigFileEntry.dots_in_ident = 0;      /* XXX */
1885 <  ConfigFileEntry.dot_in_ip6_addr = YES;
1900 >  ConfigFileEntry.default_floodcount = 8;
1901 >  ConfigFileEntry.failed_oper_notice = 1;
1902 >  ConfigFileEntry.dots_in_ident = 0;
1903    ConfigFileEntry.min_nonwildcard = 4;
1904    ConfigFileEntry.min_nonwildcard_simple = 3;
1905    ConfigFileEntry.max_accept = 20;
1906 <  ConfigFileEntry.anti_nick_flood = NO;   /* XXX */
1906 >  ConfigFileEntry.anti_nick_flood = 0;
1907    ConfigFileEntry.max_nick_time = 20;
1908    ConfigFileEntry.max_nick_changes = 5;
1909 <  ConfigFileEntry.anti_spam_exit_message_time = 0;  /* XXX */
1909 >  ConfigFileEntry.anti_spam_exit_message_time = 0;
1910    ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
1911 <  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;  /* XXX */
1912 <  ConfigFileEntry.kline_with_reason = YES;
1911 >  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
1912 >  ConfigFileEntry.kline_with_reason = 1;
1913    ConfigFileEntry.kline_reason = NULL;
1914 <  ConfigFileEntry.warn_no_nline = YES;
1915 <  ConfigFileEntry.stats_o_oper_only = NO; /* XXX */
1914 >  ConfigFileEntry.warn_no_nline = 1;
1915 >  ConfigFileEntry.stats_o_oper_only = 0;
1916    ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
1917    ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
1918 <  ConfigFileEntry.stats_P_oper_only = NO;
1918 >  ConfigFileEntry.stats_P_oper_only = 0;
1919    ConfigFileEntry.caller_id_wait = 60;
1920 <  ConfigFileEntry.opers_bypass_callerid = NO;
1920 >  ConfigFileEntry.opers_bypass_callerid = 0;
1921    ConfigFileEntry.pace_wait = 10;
1922    ConfigFileEntry.pace_wait_simple = 1;
1923 <  ConfigFileEntry.short_motd = NO;
1924 <  ConfigFileEntry.ping_cookie = NO;
1925 <  ConfigFileEntry.no_oper_flood = NO;     /* XXX */
1926 <  ConfigFileEntry.true_no_oper_flood = NO;  /* XXX */
1927 <  ConfigFileEntry.oper_pass_resv = YES;
1928 <  ConfigFileEntry.glines = NO;            /* XXX */
1929 <  ConfigFileEntry.gline_time = 12 * 3600; /* XXX */
1913 <  ConfigFileEntry.idletime = 0;
1923 >  ConfigFileEntry.short_motd = 0;
1924 >  ConfigFileEntry.ping_cookie = 0;
1925 >  ConfigFileEntry.no_oper_flood = 0;
1926 >  ConfigFileEntry.true_no_oper_flood = 0;
1927 >  ConfigFileEntry.oper_pass_resv = 1;
1928 >  ConfigFileEntry.glines = 0;
1929 >  ConfigFileEntry.gline_time = 12 * 3600;
1930    ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
1931    ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT;
1932 <  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;  /* XXX */
1932 >  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;
1933    ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE |
1934 <    UMODE_OPERWALL | UMODE_WALLOP;        /* XXX */
1935 <  DupString(ConfigFileEntry.servlink_path, SLPATH);
1920 < #ifdef HAVE_LIBCRYPTO
1921 <  /* jdc -- This is our default value for a cipher.  According to the
1922 <   *        CRYPTLINK document (doc/cryptlink.txt), BF/128 must be supported
1923 <   *        under all circumstances if cryptlinks are enabled.  So,
1924 <   *        this will be our default.
1925 <   *
1926 <   *        NOTE: I apologise for the hard-coded value of "1" (BF/128).
1927 <   *              This should be moved into a find_cipher() routine.
1928 <   */
1929 <  ConfigFileEntry.default_cipher_preference = &CipherTable[1];
1930 < #endif
1931 <  ConfigFileEntry.use_egd = NO;
1934 >    UMODE_OPERWALL | UMODE_WALLOP;
1935 >  ConfigFileEntry.use_egd = 0;
1936    ConfigFileEntry.egdpool_path = NULL;
1933 #ifdef HAVE_LIBZ
1934  ConfigFileEntry.compression_level = 0;
1935 #endif
1937    ConfigFileEntry.throttle_time = 10;
1938   }
1939  
1939 /* read_conf()
1940 *
1941 * inputs       - file descriptor pointing to config file to use
1942 * output       - None
1943 * side effects - Read configuration file.
1944 */
1945 static void
1946 read_conf(FBFILE *file)
1947 {
1948  lineno = 0;
1949
1950  set_default_conf(); /* Set default values prior to conf parsing */
1951  ypass = 1;
1952  yyparse();          /* pick up the classes first */
1953
1954  fbrewind(file);
1955
1956  ypass = 2;
1957  yyparse();          /* Load the values from the conf */
1958  validate_conf();    /* Check to make sure some values are still okay. */
1959                      /* Some global values are also loaded here. */
1960  check_class();      /* Make sure classes are valid */
1961 }
1962
1940   static void
1941   validate_conf(void)
1942   {
# Line 1969 | Line 1946 | validate_conf(void)
1946    if (ConfigFileEntry.ts_max_delta < TS_MAX_DELTA_MIN)
1947      ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
1948  
1972  if (ConfigFileEntry.servlink_path == NULL)
1973    DupString(ConfigFileEntry.servlink_path, SLPATH);
1974
1949    if (ServerInfo.network_name == NULL)
1950      DupString(ServerInfo.network_name,NETWORK_NAME_DEFAULT);
1951  
1952    if (ServerInfo.network_desc == NULL)
1953      DupString(ServerInfo.network_desc,NETWORK_DESC_DEFAULT);
1954  
1955 +  if (ConfigFileEntry.service_name == NULL)
1956 +    DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT);
1957 +
1958    if ((ConfigFileEntry.client_flood < CLIENT_FLOOD_MIN) ||
1959        (ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX))
1960      ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX;
# Line 1985 | Line 1962 | validate_conf(void)
1962    ConfigFileEntry.max_watch = IRCD_MAX(ConfigFileEntry.max_watch, WATCHSIZE_MIN);
1963   }
1964  
1965 + /* read_conf()
1966 + *
1967 + * inputs       - file descriptor pointing to config file to use
1968 + * output       - None
1969 + * side effects - Read configuration file.
1970 + */
1971 + static void
1972 + read_conf(FILE *file)
1973 + {
1974 +  lineno = 0;
1975 +
1976 +  set_default_conf(); /* Set default values prior to conf parsing */
1977 +  conf_parser_ctx.pass = 1;
1978 +  yyparse();          /* pick up the classes first */
1979 +
1980 +  rewind(file);
1981 +
1982 +  conf_parser_ctx.pass = 2;
1983 +  yyparse();          /* Load the values from the conf */
1984 +  validate_conf();    /* Check to make sure some values are still okay. */
1985 +                      /* Some global values are also loaded here. */
1986 +  check_class();      /* Make sure classes are valid */
1987 + }
1988 +
1989   /* lookup_confhost()
1990   *
1991   * start DNS lookups of all hostnames in the conf
# Line 2001 | Line 2002 | lookup_confhost(struct ConfItem *conf)
2002    if (EmptyString(aconf->host) ||
2003        EmptyString(aconf->user))
2004    {
2005 <    ilog(L_ERROR, "Host/server name error: (%s) (%s)",
2005 >    ilog(LOG_TYPE_IRCD, "Host/server name error: (%s) (%s)",
2006           aconf->host, conf->name);
2007      return;
2008    }
# Line 2021 | Line 2022 | lookup_confhost(struct ConfItem *conf)
2022    /* Get us ready for a bind() and don't bother doing dns lookup */
2023    hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2024  
2025 <  if (irc_getaddrinfo(aconf->host, NULL, &hints, &res))
2025 >  if (getaddrinfo(aconf->host, NULL, &hints, &res))
2026    {
2027      conf_dns_lookup(aconf);
2028      return;
# Line 2032 | Line 2033 | lookup_confhost(struct ConfItem *conf)
2033    memcpy(&aconf->ipnum, res->ai_addr, res->ai_addrlen);
2034    aconf->ipnum.ss_len = res->ai_addrlen;
2035    aconf->ipnum.ss.ss_family = res->ai_family;
2036 <  irc_freeaddrinfo(res);
2036 >  freeaddrinfo(res);
2037   }
2038  
2039   /* conf_connect_allowed()
# Line 2071 | Line 2072 | conf_connect_allowed(struct irc_ssaddr *
2072   static struct AccessItem *
2073   find_regexp_kline(const char *uhi[])
2074   {
2075 + #ifdef HAVE_LIBPCRE
2076    const dlink_node *ptr = NULL;
2077  
2078    DLINK_FOREACH(ptr, rkconf_items.head)
# Line 2085 | Line 2087 | find_regexp_kline(const char *uhi[])
2087           !ircd_pcre_exec(aptr->regexhost, uhi[2])))
2088        return aptr;
2089    }
2090 <
2090 > #endif
2091    return NULL;
2092   }
2093  
# Line 2147 | Line 2149 | find_gline(struct Client *client_p)
2149   void
2150   add_temp_line(struct ConfItem *conf)
2151   {
2152 <  struct AccessItem *aconf;
2151 <
2152 <  if (conf->type == DLINE_TYPE)
2153 <  {
2154 <    aconf = map_to_conf(conf);
2155 <    SetConfTemporary(aconf);
2156 <    dlinkAdd(conf, &conf->node, &temporary_dlines);
2157 <    MyFree(aconf->user);
2158 <    aconf->user = NULL;
2159 <    add_conf_by_address(CONF_DLINE, aconf);
2160 <  }
2161 <  else if (conf->type == KLINE_TYPE)
2162 <  {
2163 <    aconf = map_to_conf(conf);
2164 <    SetConfTemporary(aconf);
2165 <    dlinkAdd(conf, &conf->node, &temporary_klines);
2166 <    add_conf_by_address(CONF_KILL, aconf);
2167 <  }
2168 <  else if (conf->type == GLINE_TYPE)
2169 <  {
2170 <    aconf = map_to_conf(conf);
2171 <    SetConfTemporary(aconf);
2172 <    dlinkAdd(conf, &conf->node, &temporary_glines);
2173 <    add_conf_by_address(CONF_GLINE, aconf);
2174 <  }
2175 <  else if (conf->type == XLINE_TYPE)
2152 >  if (conf->type == XLINE_TYPE)
2153    {
2154      conf->flags |= CONF_FLAGS_TEMPORARY;
2155      dlinkAdd(conf, make_dlink_node(), &temporary_xlines);
2156    }
2180  else if (conf->type == RXLINE_TYPE)
2181  {
2182    conf->flags |= CONF_FLAGS_TEMPORARY;
2183    dlinkAdd(conf, make_dlink_node(), &temporary_rxlines);
2184  }
2185  else if (conf->type == RKLINE_TYPE)
2186  {
2187    conf->flags |= CONF_FLAGS_TEMPORARY;
2188    dlinkAdd(conf, make_dlink_node(), &temporary_rklines);
2189  }
2157    else if ((conf->type == NRESV_TYPE) || (conf->type == CRESV_TYPE))
2158    {
2159      conf->flags |= CONF_FLAGS_TEMPORARY;
# Line 2204 | Line 2171 | add_temp_line(struct ConfItem *conf)
2171   void
2172   cleanup_tklines(void *notused)
2173   {
2174 <  expire_tklines(&temporary_glines);
2208 <  expire_tklines(&temporary_klines);
2209 <  expire_tklines(&temporary_dlines);
2174 >  hostmask_expire_temporary();
2175    expire_tklines(&temporary_xlines);
2211  expire_tklines(&temporary_rxlines);
2212  expire_tklines(&temporary_rklines);
2176    expire_tklines(&temporary_resv);
2177   }
2178  
# Line 2227 | Line 2190 | expire_tklines(dlink_list *tklist)
2190    struct ConfItem *conf;
2191    struct MatchItem *xconf;
2192    struct MatchItem *nconf;
2230  struct AccessItem *aconf;
2193    struct ResvChannel *cconf;
2194  
2195    DLINK_FOREACH_SAFE(ptr, next_ptr, tklist->head)
2196    {
2197      conf = ptr->data;
2236    if (conf->type == GLINE_TYPE ||
2237        conf->type == KLINE_TYPE ||
2238        conf->type == DLINE_TYPE)
2239    {
2240      aconf = (struct AccessItem *)map_to_conf(conf);
2241      if (aconf->hold <= CurrentTime)
2242      {
2243        /* XXX - Do we want GLINE expiry notices?? */
2244        /* Alert opers that a TKline expired - Hwy */
2245        if (ConfigFileEntry.tkline_expire_notices)
2246        {
2247          if (aconf->status & CONF_KILL)
2248          {
2249            sendto_realops_flags(UMODE_ALL, L_ALL,
2250                                 "Temporary K-line for [%s@%s] expired",
2251                                 (aconf->user) ? aconf->user : "*",
2252                                 (aconf->host) ? aconf->host : "*");
2253          }
2254          else if (conf->type == DLINE_TYPE)
2255          {
2256            sendto_realops_flags(UMODE_ALL, L_ALL,
2257                                 "Temporary D-line for [%s] expired",
2258                                 (aconf->host) ? aconf->host : "*");
2259          }
2260        }
2198  
2199 <        dlinkDelete(ptr, tklist);
2263 <        delete_one_address_conf(aconf->host, aconf);
2264 <      }
2265 <    }
2266 <    else if (conf->type == XLINE_TYPE ||
2267 <             conf->type == RXLINE_TYPE)
2199 >    if (conf->type == XLINE_TYPE)
2200      {
2201        xconf = (struct MatchItem *)map_to_conf(conf);
2202        if (xconf->hold <= CurrentTime)
2203        {
2204          if (ConfigFileEntry.tkline_expire_notices)
2205            sendto_realops_flags(UMODE_ALL, L_ALL,
2206 <                               "Temporary X-line for [%s] %sexpired", conf->name,
2275 <                               conf->type == RXLINE_TYPE ? "(REGEX) " : "");
2206 >                               "Temporary X-line for [%s] sexpired", conf->name);
2207          dlinkDelete(ptr, tklist);
2208          free_dlink_node(ptr);
2209          delete_conf_item(conf);
2210        }
2211      }
2281    else if (conf->type == RKLINE_TYPE)
2282    {
2283      aconf = map_to_conf(conf);
2284      if (aconf->hold <= CurrentTime)
2285      {
2286        if (ConfigFileEntry.tkline_expire_notices)
2287           sendto_realops_flags(UMODE_ALL, L_ALL,
2288                                "Temporary K-line for [%s@%s] (REGEX) expired",
2289                                (aconf->user) ? aconf->user : "*",
2290                                (aconf->host) ? aconf->host : "*");
2291        dlinkDelete(ptr, tklist);
2292        free_dlink_node(ptr);
2293        delete_conf_item(conf);
2294      }
2295    }
2212      else if (conf->type == NRESV_TYPE)
2213      {
2214        nconf = (struct MatchItem *)map_to_conf(conf);
# Line 2329 | Line 2245 | expire_tklines(dlink_list *tklist)
2245   static const struct oper_privs
2246   {
2247    const unsigned int oprivs;
2332  const unsigned int hidden;
2248    const unsigned char c;
2249   } flag_list[] = {
2250 <  { OPER_FLAG_ADMIN,       OPER_FLAG_HIDDEN_ADMIN,  'A' },
2251 <  { OPER_FLAG_REMOTEBAN,   0,                       'B' },
2252 <  { OPER_FLAG_DIE,         0,                       'D' },
2253 <  { OPER_FLAG_GLINE,       0,                       'G' },
2254 <  { OPER_FLAG_REHASH,      0,                       'H' },
2255 <  { OPER_FLAG_K,           0,                       'K' },
2256 <  { OPER_FLAG_OPERWALL,    0,                       'L' },
2257 <  { OPER_FLAG_N,           0,                       'N' },
2258 <  { OPER_FLAG_GLOBAL_KILL, 0,                       'O' },
2259 <  { OPER_FLAG_REMOTE,      0,                       'R' },
2260 <  { OPER_FLAG_OPER_SPY,    0,                       'S' },
2261 <  { OPER_FLAG_UNKLINE,     0,                       'U' },
2262 <  { OPER_FLAG_X,           0,                       'X' },
2263 <  { 0, 0, '\0' }
2250 >  { OPER_FLAG_ADMIN,       'A' },
2251 >  { OPER_FLAG_REMOTEBAN,   'B' },
2252 >  { OPER_FLAG_DIE,         'D' },
2253 >  { OPER_FLAG_GLINE,       'G' },
2254 >  { OPER_FLAG_REHASH,      'H' },
2255 >  { OPER_FLAG_K,           'K' },
2256 >  { OPER_FLAG_OPERWALL,    'L' },
2257 >  { OPER_FLAG_N,           'N' },
2258 >  { OPER_FLAG_GLOBAL_KILL, 'O' },
2259 >  { OPER_FLAG_REMOTE,      'R' },
2260 >  { OPER_FLAG_OPER_SPY,    'S' },
2261 >  { OPER_FLAG_UNKLINE,     'U' },
2262 >  { OPER_FLAG_X,           'X' },
2263 >  { 0, '\0' }
2264   };
2265  
2266   char *
# Line 2357 | Line 2272 | oper_privs_as_string(const unsigned int
2272  
2273    for (; flag_list[i].oprivs; ++i)
2274    {
2275 <    if ((port & flag_list[i].oprivs) &&
2361 <        (port & flag_list[i].hidden) == 0)
2275 >    if (port & flag_list[i].oprivs)
2276        *privs_ptr++ = flag_list[i].c;
2277      else
2278        *privs_ptr++ = ToLowerTab[flag_list[i].c];
# Line 2375 | Line 2289 | oper_privs_as_string(const unsigned int
2289   *         "oper" is server name for remote opers
2290   * Side effects: None.
2291   */
2292 < char *
2292 > const char *
2293   get_oper_name(const struct Client *client_p)
2294   {
2295 <  dlink_node *cnode;
2382 <  struct ConfItem *conf;
2383 <  struct AccessItem *aconf;
2384 <
2295 >  dlink_node *cnode = NULL;
2296    /* +5 for !,@,{,} and null */
2297 <  static char buffer[NICKLEN+USERLEN+HOSTLEN+HOSTLEN+5];
2297 >  static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
2298  
2299    if (MyConnect(client_p))
2300    {
2301 <    DLINK_FOREACH(cnode, client_p->localClient->confs.head)
2301 >    if ((cnode = client_p->localClient->confs.head))
2302      {
2303 <      conf = cnode->data;
2304 <      aconf = map_to_conf(conf);
2303 >      struct ConfItem *conf = cnode->data;
2304 >      const struct AccessItem *aconf = map_to_conf(conf);
2305  
2306        if (IsConfOperator(aconf))
2307        {
2308 <        ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name,
2309 <                   client_p->username, client_p->host,
2399 <                   conf->name);
2308 >        snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
2309 >                 client_p->username, client_p->host, conf->name);
2310          return buffer;
2311        }
2312      }
# Line 2407 | Line 2317 | get_oper_name(const struct Client *clien
2317      assert(0); /* Oper without oper conf! */
2318    }
2319  
2320 <  ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name,
2321 <             client_p->username, client_p->host, client_p->servptr->name);
2320 >  snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
2321 >           client_p->username, client_p->host, client_p->servptr->name);
2322    return buffer;
2323   }
2324  
# Line 2425 | Line 2335 | read_conf_files(int cold)
2335    char chanmodes[32];
2336    char chanlimit[32];
2337  
2338 +  conf_parser_ctx.boot = cold;
2339    filename = get_conf_name(CONF_TYPE);
2340  
2341    /* We need to know the initial filename for the yyerror() to report
# Line 2435 | Line 2346 | read_conf_files(int cold)
2346    */
2347    strlcpy(conffilebuf, filename, sizeof(conffilebuf));
2348  
2349 <  if ((conf_fbfile_in = fbopen(filename, "r")) == NULL)
2349 >  if ((conf_parser_ctx.conf_file = fopen(filename, "r")) == NULL)
2350    {
2351      if (cold)
2352      {
2353 <      ilog(L_CRIT, "Unable to read configuration file '%s': %s",
2353 >      ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
2354             filename, strerror(errno));
2355        exit(-1);
2356      }
# Line 2455 | Line 2366 | read_conf_files(int cold)
2366    if (!cold)
2367      clear_out_old_conf();
2368  
2369 <  read_conf(conf_fbfile_in);
2370 <  fbclose(conf_fbfile_in);
2369 >  read_conf(conf_parser_ctx.conf_file);
2370 >  fclose(conf_parser_ctx.conf_file);
2371  
2372    add_isupport("NETWORK", ServerInfo.network_name, -1);
2373 <  ircsprintf(chanmodes, "b%s%s:%d", ConfigChannel.use_except ? "e" : "",
2374 <             ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans);
2373 >  snprintf(chanmodes, sizeof(chanmodes), "b%s%s:%d",
2374 >           ConfigChannel.use_except ? "e" : "",
2375 >           ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans);
2376    add_isupport("MAXLIST", chanmodes, -1);
2377    add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets);
2378 +
2379    if (ConfigChannel.disable_local_channels)
2380      add_isupport("CHANTYPES", "#", -1);
2381    else
2382      add_isupport("CHANTYPES", "#&", -1);
2383 <  ircsprintf(chanlimit, "%s:%d", ConfigChannel.disable_local_channels ? "#" : "#&",
2384 <             ConfigChannel.max_chans_per_user);
2383 >
2384 >  snprintf(chanlimit, sizeof(chanlimit), "%s:%d",
2385 >           ConfigChannel.disable_local_channels ? "#" : "#&",
2386 >           ConfigChannel.max_chans_per_user);
2387    add_isupport("CHANLIMIT", chanlimit, -1);
2388 <  ircsprintf(chanmodes, "%s%s%s", ConfigChannel.use_except ? "e" : "",
2389 <             ConfigChannel.use_invex ? "I" : "", "b,k,l,imnpst");
2388 >  snprintf(chanmodes, sizeof(chanmodes), "%s%s%s",
2389 >           ConfigChannel.use_except ? "e" : "",
2390 >           ConfigChannel.use_invex ? "I" : "", "b,k,l,imnprstORS");
2391    add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN);
2392 +
2393    if (ConfigChannel.use_except)
2394      add_isupport("EXCEPTS", "e", -1);
2395    if (ConfigChannel.use_invex)
# Line 2485 | Line 2402 | read_conf_files(int cold)
2402     */
2403    rebuild_isupport_message_line();
2404  
2405 <  parse_conf_file(KLINE_TYPE, cold);
2405 > #ifdef HAVE_LIBPCRE
2406    parse_conf_file(RKLINE_TYPE, cold);
2407 +  parse_conf_file(RXLINE_TYPE, cold);
2408 + #endif
2409 +  parse_conf_file(KLINE_TYPE, cold);
2410    parse_conf_file(DLINE_TYPE, cold);
2411    parse_conf_file(XLINE_TYPE, cold);
2492  parse_conf_file(RXLINE_TYPE, cold);
2412    parse_conf_file(NRESV_TYPE, cold);
2413    parse_conf_file(CRESV_TYPE, cold);
2414   }
# Line 2503 | Line 2422 | read_conf_files(int cold)
2422   static void
2423   parse_conf_file(int type, int cold)
2424   {
2425 <  FBFILE *file = NULL;
2425 >  FILE *file = NULL;
2426    const char *filename = get_conf_name(type);
2427  
2428 <  if ((file = fbopen(filename, "r")) == NULL)
2428 >  if ((file = fopen(filename, "r")) == NULL)
2429    {
2430      if (cold)
2431 <      ilog(L_ERROR, "Unable to read configuration file '%s': %s",
2431 >      ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
2432             filename, strerror(errno));
2433      else
2434        sendto_realops_flags(UMODE_ALL, L_ALL,
# Line 2519 | Line 2438 | parse_conf_file(int type, int cold)
2438    else
2439    {
2440      parse_csv_file(file, type);
2441 <    fbclose(file);
2441 >    fclose(file);
2442    }
2443   }
2444  
# Line 2540 | Line 2459 | clear_out_old_conf(void)
2459    dlink_list *free_items [] = {
2460      &server_items,   &oconf_items,    &hub_items, &leaf_items,
2461       &uconf_items,   &xconf_items, &rxconf_items, &rkconf_items,
2462 <     &nresv_items, &cluster_items,  &gdeny_items, NULL
2462 >     &nresv_items, &cluster_items,  &gdeny_items, &service_items, NULL
2463    };
2464  
2465    dlink_list ** iterator = free_items; /* C is dumb */
# Line 2641 | Line 2560 | clear_out_old_conf(void)
2560    clear_out_address_conf();
2561  
2562    /* clean out module paths */
2644 #ifndef STATIC_MODULES
2563    mod_clear_paths();
2646 #endif
2564  
2565    /* clean out ServerInfo */
2566    MyFree(ServerInfo.description);
# Line 2663 | Line 2580 | clear_out_old_conf(void)
2580  
2581    MyFree(ServerInfo.rsa_private_key_file);
2582    ServerInfo.rsa_private_key_file = NULL;
2583 +
2584 +  if (ServerInfo.server_ctx)
2585 +    SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|
2586 +                                               SSL_OP_NO_SSLv3|
2587 +                                               SSL_OP_NO_TLSv1);
2588 +  if (ServerInfo.client_ctx)
2589 +    SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|
2590 +                                               SSL_OP_NO_SSLv3|
2591 +                                               SSL_OP_NO_TLSv1);
2592   #endif
2593  
2594    /* clean out old resvs from the conf */
# Line 2685 | Line 2611 | clear_out_old_conf(void)
2611     */
2612  
2613    /* clean out general */
2614 <  MyFree(ConfigFileEntry.servlink_path);
2615 <  ConfigFileEntry.servlink_path = NULL;
2616 < #ifdef HAVE_LIBCRYPTO
2691 <  ConfigFileEntry.default_cipher_preference = NULL;
2692 < #endif /* HAVE_LIBCRYPTO */
2614 >  MyFree(ConfigFileEntry.service_name);
2615 >  ConfigFileEntry.service_name = NULL;
2616 >
2617    delete_isupport("INVEX");
2618    delete_isupport("EXCEPTS");
2619   }
# Line 2800 | Line 2724 | get_conf_ping(struct ConfItem *conf, int
2724      if (aconf->class_ptr != NULL)
2725      {
2726        aclass = (struct ClassItem *)map_to_conf(aconf->class_ptr);
2727 <      *pingwarn = PingWarning(aclass);
2728 <      return PingFreq(aclass);
2727 >      *pingwarn = aclass->ping_warning;
2728 >      return aclass->ping_freq;
2729      }
2730    }
2731  
# Line 2884 | Line 2808 | find_class(const char *classname)
2808   {
2809    struct ConfItem *conf;
2810  
2811 <  if ((conf = find_exact_name_conf(CLASS_TYPE, classname, NULL, NULL)) != NULL)
2811 >  if ((conf = find_exact_name_conf(CLASS_TYPE, NULL, classname, NULL, NULL)) != NULL)
2812      return conf;
2813  
2814    return class_default;
# Line 2905 | Line 2829 | check_class(void)
2829    {
2830      struct ClassItem *aclass = map_to_conf(ptr->data);
2831  
2832 <    if (!aclass->active && !CurrUserCount(aclass))
2832 >    if (!aclass->active && !aclass->curr_user_count)
2833      {
2834        destroy_cidr_class(aclass);
2835        delete_conf_item(ptr->data);
# Line 2929 | Line 2853 | init_class(void)
2853    aclass = map_to_conf(class_default);
2854    aclass->active = 1;
2855    DupString(class_default->name, "default");
2856 <  ConFreq(aclass)  = DEFAULT_CONNECTFREQUENCY;
2857 <  PingFreq(aclass) = DEFAULT_PINGFREQUENCY;
2858 <  MaxTotal(aclass) = MAXIMUM_LINKS_DEFAULT;
2859 <  MaxSendq(aclass) = DEFAULT_SENDQ;
2856 >  aclass->con_freq  = DEFAULT_CONNECTFREQUENCY;
2857 >  aclass->ping_freq = DEFAULT_PINGFREQUENCY;
2858 >  aclass->max_total = MAXIMUM_LINKS_DEFAULT;
2859 >  aclass->max_sendq = DEFAULT_SENDQ;
2860  
2861    client_check_cb = register_callback("check_client", check_client);
2862   }
# Line 2965 | Line 2889 | get_sendq(struct Client *client_p)
2889          if ((class_conf = aconf->class_ptr) == NULL)
2890            continue;
2891          aclass = (struct ClassItem *)map_to_conf(class_conf);
2892 <        sendq = MaxSendq(aclass);
2892 >        sendq = aclass->max_sendq;
2893          return sendq;
2894        }
2895      }
# Line 3032 | Line 2956 | conf_add_class_to_conf(struct ConfItem *
2956   int
2957   conf_add_server(struct ConfItem *conf, const char *class_name)
2958   {
2959 <  struct AccessItem *aconf;
3036 <  struct split_nuh_item nuh;
3037 <  char conf_user[USERLEN + 1];
3038 <  char conf_host[HOSTLEN + 1];
3039 <
3040 <  aconf = map_to_conf(conf);
2959 >  struct AccessItem *aconf = map_to_conf(conf);
2960  
2961    conf_add_class_to_conf(conf, class_name);
2962  
2963    if (!aconf->host || !conf->name)
2964    {
2965      sendto_realops_flags(UMODE_ALL, L_ALL, "Bad connect block");
2966 <    ilog(L_WARN, "Bad connect block");
2966 >    ilog(LOG_TYPE_IRCD, "Bad connect block");
2967      return -1;
2968    }
2969  
2970 <  if (EmptyString(aconf->passwd) && !IsConfCryptLink(aconf))
2970 >  if (EmptyString(aconf->passwd))
2971    {
2972      sendto_realops_flags(UMODE_ALL, L_ALL, "Bad connect block, name %s",
2973                           conf->name);
2974 <    ilog(L_WARN, "Bad connect block, host %s", conf->name);
2974 >    ilog(LOG_TYPE_IRCD, "Bad connect block, host %s", conf->name);
2975      return -1;
2976    }
2977  
3059  nuh.nuhmask  = aconf->host;
3060  nuh.nickptr  = NULL;
3061  nuh.userptr  = conf_user;
3062  nuh.hostptr  = conf_host;
3063
3064  nuh.nicksize = 0;
3065  nuh.usersize = sizeof(conf_user);
3066  nuh.hostsize = sizeof(conf_host);
3067
3068  split_nuh(&nuh);
3069
3070  MyFree(aconf->host);
3071  aconf->host = NULL;
3072
3073  DupString(aconf->user, conf_user); /* somehow username checking for servers
3074                                 got lost in H6/7, will have to be re-added */
3075  DupString(aconf->host, conf_host);
3076
2978    lookup_confhost(conf);
2979  
2980    return 0;
2981   }
2982  
3082 /* conf_add_d_conf()
3083 *
3084 * inputs       - pointer to config item
3085 * output       - NONE
3086 * side effects - Add a d/D line
3087 */
3088 void
3089 conf_add_d_conf(struct AccessItem *aconf)
3090 {
3091  if (aconf->host == NULL)
3092    return;
3093
3094  aconf->user = NULL;
3095
3096  /* XXX - Should 'd' ever be in the old conf? For new conf we don't
3097   *       need this anyway, so I will disable it for now... -A1kmm
3098   */
3099  if (parse_netmask(aconf->host, NULL, NULL) == HM_HOST)
3100  {
3101    ilog(L_WARN, "Invalid Dline %s ignored", aconf->host);
3102    free_access_item(aconf);
3103  }
3104  else
3105  {
3106    /* XXX ensure user is NULL */
3107    MyFree(aconf->user);
3108    aconf->user = NULL;
3109    add_conf_by_address(CONF_DLINE, aconf);
3110  }
3111 }
3112
2983   /* yyerror()
2984   *
2985   * inputs       - message from parser
# Line 3121 | Line 2991 | yyerror(const char *msg)
2991   {
2992    char newlinebuf[IRCD_BUFSIZE];
2993  
2994 <  if (ypass != 1)
2994 >  if (conf_parser_ctx.pass != 1)
2995      return;
2996  
2997    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
2998    sendto_realops_flags(UMODE_ALL, L_ALL, "\"%s\", line %u: %s: %s",
2999                         conffilebuf, lineno + 1, msg, newlinebuf);
3000 <  ilog(L_WARN, "\"%s\", line %u: %s: %s",
3000 >  ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
3001         conffilebuf, lineno + 1, msg, newlinebuf);
3002   }
3003  
3134 int
3135 conf_fbgets(char *lbuf, unsigned int max_size, FBFILE *fb)
3136 {
3137  if (fbgets(lbuf, max_size, fb) == NULL)
3138    return 0;
3139
3140  return strlen(lbuf);
3141 }
3142
3143 int
3144 conf_yy_fatal_error(const char *msg)
3145 {
3146  return 0;
3147 }
3148
3004   /*
3005   * valid_tkline()
3006   *
# Line 3157 | Line 3012 | conf_yy_fatal_error(const char *msg)
3012   * Originally written by Dianora (Diane, db@db.net)
3013   */
3014   time_t
3015 < valid_tkline(char *p, int minutes)
3015 > valid_tkline(const char *p, int minutes)
3016   {
3017    time_t result = 0;
3018  
3019 <  while (*p)
3019 >  for (; *p; ++p)
3020    {
3021 <    if (IsDigit(*p))
3167 <    {
3168 <      result *= 10;
3169 <      result += ((*p) & 0xF);
3170 <      p++;
3171 <    }
3172 <    else
3021 >    if (!IsDigit(*p))
3022        return 0;
3023 +
3024 +    result *= 10;
3025 +    result += ((*p) & 0xF);
3026    }
3027  
3028 <  /* in the degenerate case where oper does a /quote kline 0 user@host :reason
3028 >  /*
3029 >   * In the degenerate case where oper does a /quote kline 0 user@host :reason
3030     * i.e. they specifically use 0, I am going to return 1 instead
3031     * as a return value of non-zero is used to flag it as a temporary kline
3032     */
3180
3033    if (result == 0)
3034      result = 1;
3035  
# Line 3348 | Line 3200 | parse_aline(const char *cmd, struct Clie
3200          return -1;
3201        }
3202  
3203 <      if (!IsOperRemoteBan(source_p))
3203 >      if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
3204        {
3205          sendto_one(source_p, form_str(ERR_NOPRIVS),
3206                     me.name, source_p->name, "remoteban");
# Line 3385 | Line 3237 | parse_aline(const char *cmd, struct Clie
3237        return -1;
3238      }
3239  
3240 <    if ((parse_flags & AWILD) && !valid_wild_card(source_p, YES, 2, *up_p, *h_p))
3240 >    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 2, *up_p, *h_p))
3241        return -1;
3242    }
3243    else
3244 <    if ((parse_flags & AWILD) && !valid_wild_card(source_p, YES, 1, *up_p))
3244 >    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 1, *up_p))
3245        return -1;
3246  
3247    if (reason != NULL)
# Line 3397 | Line 3249 | parse_aline(const char *cmd, struct Clie
3249      if (parc != 0 && !EmptyString(*parv))
3250      {
3251        *reason = *parv;
3252 <      if (!valid_comment(source_p, *reason, YES))
3252 >      if (!valid_comment(source_p, *reason, 1))
3253          return -1;
3254      }
3255      else
# Line 3556 | Line 3408 | match_conf_password(const char *password
3408   * inputs       - client sending the cluster
3409   *              - command name "KLINE" "XLINE" etc.
3410   *              - capab -- CAP_KLN etc. from s_serv.h
3411 < *              - cluster type -- CLUSTER_KLINE etc. from s_conf.h
3411 > *              - cluster type -- CLUSTER_KLINE etc. from conf.h
3412   *              - pattern and args to send along
3413   * output       - none
3414   * side effects - Take source_p send the pattern with args given
# Line 3716 | Line 3568 | cidr_limit_reached(int over_rule,
3568    dlink_node *ptr = NULL;
3569    struct CidrItem *cidr;
3570  
3571 <  if (NumberPerCidr(aclass) <= 0)
3571 >  if (aclass->number_per_cidr <= 0)
3572      return 0;
3573  
3574    if (ip->ss.ss_family == AF_INET)
3575    {
3576 <    if (CidrBitlenIPV4(aclass) <= 0)
3576 >    if (aclass->cidr_bitlen_ipv4 <= 0)
3577        return 0;
3578  
3579      DLINK_FOREACH(ptr, aclass->list_ipv4.head)
3580      {
3581        cidr = ptr->data;
3582 <      if (match_ipv4(ip, &cidr->mask, CidrBitlenIPV4(aclass)))
3582 >      if (match_ipv4(ip, &cidr->mask, aclass->cidr_bitlen_ipv4))
3583        {
3584 <        if (!over_rule && (cidr->number_on_this_cidr >= NumberPerCidr(aclass)))
3584 >        if (!over_rule && (cidr->number_on_this_cidr >= aclass->number_per_cidr))
3585            return -1;
3586          cidr->number_on_this_cidr++;
3587          return 0;
# Line 3738 | Line 3590 | cidr_limit_reached(int over_rule,
3590      cidr = MyMalloc(sizeof(struct CidrItem));
3591      cidr->number_on_this_cidr = 1;
3592      cidr->mask = *ip;
3593 <    mask_addr(&cidr->mask, CidrBitlenIPV4(aclass));
3593 >    mask_addr(&cidr->mask, aclass->cidr_bitlen_ipv4);
3594      dlinkAdd(cidr, &cidr->node, &aclass->list_ipv4);
3595    }
3596   #ifdef IPV6
3597 <  else if (CidrBitlenIPV6(aclass) > 0)
3597 >  else if (aclass->cidr_bitlen_ipv6 > 0)
3598    {
3599      DLINK_FOREACH(ptr, aclass->list_ipv6.head)
3600      {
3601        cidr = ptr->data;
3602 <      if (match_ipv6(ip, &cidr->mask, CidrBitlenIPV6(aclass)))
3602 >      if (match_ipv6(ip, &cidr->mask, aclass->cidr_bitlen_ipv6))
3603        {
3604 <        if (!over_rule && (cidr->number_on_this_cidr >= NumberPerCidr(aclass)))
3604 >        if (!over_rule && (cidr->number_on_this_cidr >= aclass->number_per_cidr))
3605            return -1;
3606          cidr->number_on_this_cidr++;
3607          return 0;
# Line 3758 | Line 3610 | cidr_limit_reached(int over_rule,
3610      cidr = MyMalloc(sizeof(struct CidrItem));
3611      cidr->number_on_this_cidr = 1;
3612      cidr->mask = *ip;
3613 <    mask_addr(&cidr->mask, CidrBitlenIPV6(aclass));
3613 >    mask_addr(&cidr->mask, aclass->cidr_bitlen_ipv6);
3614      dlinkAdd(cidr, &cidr->node, &aclass->list_ipv6);
3615    }
3616   #endif
# Line 3780 | Line 3632 | remove_from_cidr_check(struct irc_ssaddr
3632    dlink_node *next_ptr = NULL;
3633    struct CidrItem *cidr;
3634  
3635 <  if (NumberPerCidr(aclass) == 0)
3635 >  if (aclass->number_per_cidr == 0)
3636      return;
3637  
3638    if (ip->ss.ss_family == AF_INET)
3639    {
3640 <    if (CidrBitlenIPV4(aclass) <= 0)
3640 >    if (aclass->cidr_bitlen_ipv4 <= 0)
3641        return;
3642  
3643      DLINK_FOREACH_SAFE(ptr, next_ptr, aclass->list_ipv4.head)
3644      {
3645        cidr = ptr->data;
3646 <      if (match_ipv4(ip, &cidr->mask, CidrBitlenIPV4(aclass)))
3646 >      if (match_ipv4(ip, &cidr->mask, aclass->cidr_bitlen_ipv4))
3647        {
3648          cidr->number_on_this_cidr--;
3649          if (cidr->number_on_this_cidr == 0)
# Line 3804 | Line 3656 | remove_from_cidr_check(struct irc_ssaddr
3656      }
3657    }
3658   #ifdef IPV6
3659 <  else if (CidrBitlenIPV6(aclass) > 0)
3659 >  else if (aclass->cidr_bitlen_ipv6 > 0)
3660    {
3661      DLINK_FOREACH_SAFE(ptr, next_ptr, aclass->list_ipv6.head)
3662      {
3663        cidr = ptr->data;
3664 <      if (match_ipv6(ip, &cidr->mask, CidrBitlenIPV6(aclass)))
3664 >      if (match_ipv6(ip, &cidr->mask, aclass->cidr_bitlen_ipv6))
3665        {
3666          cidr->number_on_this_cidr--;
3667          if (cidr->number_on_this_cidr == 0)
# Line 3872 | Line 3724 | rebuild_cidr_class(struct ConfItem *conf
3724   {
3725    struct ClassItem *old_class = map_to_conf(conf);
3726  
3727 <  if (NumberPerCidr(old_class) > 0 && NumberPerCidr(new_class) > 0)
3727 >  if (old_class->number_per_cidr > 0 && new_class->number_per_cidr > 0)
3728    {
3729 <    if (CidrBitlenIPV4(old_class) > 0 && CidrBitlenIPV4(new_class) > 0)
3729 >    if (old_class->cidr_bitlen_ipv4 > 0 && new_class->cidr_bitlen_ipv4 > 0)
3730        rebuild_cidr_list(AF_INET, conf, new_class,
3731                          &old_class->list_ipv4, &new_class->list_ipv4,
3732 <                        CidrBitlenIPV4(old_class) != CidrBitlenIPV4(new_class));
3732 >                        old_class->cidr_bitlen_ipv4 != new_class->cidr_bitlen_ipv4);
3733  
3734   #ifdef IPV6
3735 <    if (CidrBitlenIPV6(old_class) > 0 && CidrBitlenIPV6(new_class) > 0)
3735 >    if (old_class->cidr_bitlen_ipv6 > 0 && new_class->cidr_bitlen_ipv6 > 0)
3736        rebuild_cidr_list(AF_INET6, conf, new_class,
3737                          &old_class->list_ipv6, &new_class->list_ipv6,
3738 <                        CidrBitlenIPV6(old_class) != CidrBitlenIPV6(new_class));
3738 >                        old_class->cidr_bitlen_ipv6 != new_class->cidr_bitlen_ipv6);
3739   #endif
3740    }
3741  

Diff Legend

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