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 1363 by michael, Sun Apr 22 19:15:48 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 83 | Line 81 | dlink_list temporary_resv = { NULL, NULL
81   extern unsigned int lineno;
82   extern char linebuf[];
83   extern char conffilebuf[IRCD_BUFSIZE];
86 extern char yytext[];
84   extern int yyparse(); /* defined in y.tab.c */
85 < int ypass = 1; /* used by yyparse()      */
85 >
86 > struct conf_parser_context conf_parser_ctx = { 0, 0, NULL };
87  
88   /* internally defined functions */
89 < 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 *);
89 > static void read_conf(FILE *);
90   static void clear_out_old_conf(void);
91   static void flush_deleted_I_P(void);
92   static void expire_tklines(dlink_list *);
# Line 114 | Line 109 | static void destroy_cidr_class(struct Cl
109  
110   static void flags_to_ascii(unsigned int, const unsigned int[], char *, int);
111  
117 FBFILE *conf_fbfile_in = NULL;
118
112   /* address of default class conf */
113   static struct ConfItem *class_default;
114  
# Line 138 | Line 131 | static BlockHeap *ip_entry_heap = NULL;
131   static int ip_entries_count = 0;
132  
133  
134 < inline void *
134 > void *
135   map_to_conf(struct ConfItem *aconf)
136   {
137    void *conf;
138 <  conf = (void *)((unsigned long)aconf +
139 <                  (unsigned long)sizeof(struct ConfItem));
138 >  conf = (void *)((uintptr_t)aconf +
139 >                  (uintptr_t)sizeof(struct ConfItem));
140    return(conf);
141   }
142  
143 < inline struct ConfItem *
143 > struct ConfItem *
144   unmap_conf_item(void *aconf)
145   {
146    struct ConfItem *conf;
147  
148 <  conf = (struct ConfItem *)((unsigned long)aconf -
149 <                             (unsigned long)sizeof(struct ConfItem));
148 >  conf = (struct ConfItem *)((uintptr_t)aconf -
149 >                             (uintptr_t)sizeof(struct ConfItem));
150    return(conf);
151   }
152  
# Line 168 | Line 161 | unmap_conf_item(void *aconf)
161   * if successful save hp in the conf item it was called with
162   */
163   static void
164 < conf_dns_callback(void *vptr, struct DNSReply *reply)
164 > conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name)
165   {
166 <  struct AccessItem *aconf = (struct AccessItem *)vptr;
174 <  struct ConfItem *conf;
166 >  struct AccessItem *aconf = vptr;
167  
168 <  MyFree(aconf->dns_query);
177 <  aconf->dns_query = NULL;
168 >  aconf->dns_pending = 0;
169  
170 <  if (reply != NULL)
171 <    memcpy(&aconf->ipnum, &reply->addr, sizeof(reply->addr));
172 <  else {
173 <    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 <  }
170 >  if (addr != NULL)
171 >    memcpy(&aconf->ipnum, addr, sizeof(aconf->ipnum));
172 >  else
173 >    aconf->dns_failed = 1;
174   }
175  
176   /* conf_dns_lookup()
# Line 198 | Line 182 | conf_dns_callback(void *vptr, struct DNS
182   static void
183   conf_dns_lookup(struct AccessItem *aconf)
184   {
185 <  if (aconf->dns_query == NULL)
185 >  if (!aconf->dns_pending)
186    {
187 <    aconf->dns_query = MyMalloc(sizeof(struct DNSQuery));
188 <    aconf->dns_query->ptr = aconf;
205 <    aconf->dns_query->callback = conf_dns_callback;
206 <    gethost_byname(aconf->host, aconf->dns_query);
187 >    aconf->dns_pending = 1;
188 >    gethost_byname(conf_dns_callback, aconf, aconf->host);
189    }
190   }
191  
# Line 303 | Line 285 | make_conf_item(ConfType type)
285                                         sizeof(struct MatchItem));
286      dlinkAdd(conf, &conf->node, &xconf_items);
287      break;
288 <
288 > #ifdef HAVE_LIBPCRE
289    case RXLINE_TYPE:
290      conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) +
291                                         sizeof(struct MatchItem));
# Line 317 | Line 299 | make_conf_item(ConfType type)
299      aconf->status = CONF_KLINE;
300      dlinkAdd(conf, &conf->node, &rkconf_items);
301      break;
302 <
302 > #endif
303    case CLUSTER_TYPE:
304      conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem));
305      dlinkAdd(conf, &conf->node, &cluster_items);
# Line 334 | Line 316 | make_conf_item(ConfType type)
316      dlinkAdd(conf, &conf->node, &nresv_items);
317      break;
318  
319 +  case SERVICE_TYPE:
320 +    status = CONF_SERVICE;
321 +    conf = MyMalloc(sizeof(struct ConfItem));
322 +    dlinkAdd(conf, &conf->node, &service_items);
323 +    break;
324 +
325    case CLASS_TYPE:
326      conf = MyMalloc(sizeof(struct ConfItem) +
327                             sizeof(struct ClassItem));
# Line 381 | Line 369 | delete_conf_item(struct ConfItem *conf)
369    case SERVER_TYPE:
370      aconf = map_to_conf(conf);
371  
372 <    if (aconf->dns_query != NULL)
373 <    {
386 <      delete_resolver_queries(aconf->dns_query);
387 <      MyFree(aconf->dns_query);
388 <    }
372 >    if (aconf->dns_pending)
373 >      delete_resolver_queries(aconf);
374      if (aconf->passwd != NULL)
375        memset(aconf->passwd, 0, strlen(aconf->passwd));
376      if (aconf->spasswd != NULL)
# Line 398 | Line 383 | delete_conf_item(struct ConfItem *conf)
383      MyFree(aconf->oper_reason);
384      MyFree(aconf->user);
385      MyFree(aconf->host);
386 <    MyFree(aconf->fakename);
386 >    MyFree(aconf->cipher_list);
387   #ifdef HAVE_LIBCRYPTO
388      if (aconf->rsa_public_key)
389        RSA_free(aconf->rsa_public_key);
# Line 478 | Line 463 | delete_conf_item(struct ConfItem *conf)
463      dlinkDelete(&conf->node, &xconf_items);
464      MyFree(conf);
465      break;
466 <
466 > #ifdef HAVE_LIBPCRE
467    case RKLINE_TYPE:
468      aconf = map_to_conf(conf);
469      MyFree(aconf->regexuser);
# Line 501 | Line 486 | delete_conf_item(struct ConfItem *conf)
486      dlinkDelete(&conf->node, &rxconf_items);
487      MyFree(conf);
488      break;
489 <
489 > #endif
490    case NRESV_TYPE:
491      match_item = map_to_conf(conf);
492      MyFree(match_item->user);
# Line 543 | Line 528 | delete_conf_item(struct ConfItem *conf)
528      MyFree(conf);
529      break;
530  
531 +  case SERVICE_TYPE:
532 +    dlinkDelete(&conf->node, &service_items);
533 +    MyFree(conf);
534 +    break;
535 +
536    default:
537      break;
538    }
# Line 628 | Line 618 | report_confitem_types(struct Client *sou
618      }
619      break;
620  
621 + #ifdef HAVE_LIBPCRE
622    case RXLINE_TYPE:
623      DLINK_FOREACH(ptr, rxconf_items.head)
624      {
# Line 656 | Line 647 | report_confitem_types(struct Client *sou
647                   aconf->reason, aconf->oper_reason ? aconf->oper_reason : "");
648      }
649      break;
650 + #endif
651  
652    case ULINE_TYPE:
653      DLINK_FOREACH(ptr, uconf_items.head)
# Line 700 | Line 692 | report_confitem_types(struct Client *sou
692        aconf = map_to_conf(conf);
693  
694        /* Don't allow non opers to see oper privs */
695 <      if (IsOper(source_p))
695 >      if (HasUMode(source_p, UMODE_OPER))
696          sendto_one(source_p, form_str(RPL_STATSOLINE),
697                     me.name, source_p->name, 'O', aconf->user, aconf->host,
698                     conf->name, oper_privs_as_string(aconf->port),
# Line 732 | Line 724 | report_confitem_types(struct Client *sou
724    case CLIENT_TYPE:
725      break;
726  
727 +  case SERVICE_TYPE:
728 +    DLINK_FOREACH(ptr, service_items.head)
729 +    {
730 +      conf = ptr->data;
731 +      sendto_one(source_p, form_str(RPL_STATSSERVICE),
732 +                 me.name, source_p->name, 'S', "*", conf->name, 0, 0);
733 +    }
734 +    break;
735 +
736    case SERVER_TYPE:
737      DLINK_FOREACH(ptr, server_items.head)
738      {
# Line 744 | Line 745 | report_confitem_types(struct Client *sou
745  
746        if (IsConfAllowAutoConn(aconf))
747          *p++ = 'A';
748 <      if (IsConfCryptLink(aconf))
749 <        *p++ = 'C';
749 <      if (aconf->fakename)
750 <        *p++ = 'M';
748 >      if (IsConfSSL(aconf))
749 >        *p++ = 'S';
750        if (IsConfTopicBurst(aconf))
751          *p++ = 'T';
753      if (IsConfCompressed(aconf))
754        *p++ = 'Z';
752        if (buf[0] == '\0')
753          *p++ = '*';
754  
# Line 760 | Line 757 | report_confitem_types(struct Client *sou
757        /*
758         * Allow admins to see actual ips unless hide_server_ips is enabled
759         */
760 <      if (!ConfigServerHide.hide_server_ips && IsAdmin(source_p))
760 >      if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
761          sendto_one(source_p, form_str(RPL_STATSCLINE),
762                     me.name, source_p->name, 'C', aconf->host,
763                     buf, conf->name, aconf->port,
# Line 800 | Line 797 | report_confitem_types(struct Client *sou
797    case CRESV_TYPE:
798    case NRESV_TYPE:
799    case CLUSTER_TYPE:
800 +  default:
801      break;
802    }
803   }
# Line 826 | Line 824 | check_client(va_list args)
824  
825    /* I'm already in big trouble if source_p->localClient is NULL -db */
826    if ((i = verify_access(source_p, username)))
827 <    ilog(L_INFO, "Access denied: %s[%s]",
827 >    ilog(LOG_TYPE_IRCD, "Access denied: %s[%s]",
828           source_p->name, source_p->sockhost);
829  
830    switch (i)
# Line 836 | Line 834 | check_client(va_list args)
834                             "Too many on IP for %s (%s).",
835                             get_client_name(source_p, SHOW_IP),
836                             source_p->sockhost);
837 <      ilog(L_INFO,"Too many connections on IP from %s.",
837 >      ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.",
838             get_client_name(source_p, SHOW_IP));
839        ++ServerStats.is_ref;
840        exit_client(source_p, &me, "No more connections allowed on that IP");
# Line 847 | Line 845 | check_client(va_list args)
845                             "I-line is full for %s (%s).",
846                             get_client_name(source_p, SHOW_IP),
847                             source_p->sockhost);
848 <      ilog(L_INFO,"Too many connections from %s.",
848 >      ilog(LOG_TYPE_IRCD, "Too many connections from %s.",
849             get_client_name(source_p, SHOW_IP));
850        ++ServerStats.is_ref;
851        exit_client(source_p, &me,
# Line 864 | Line 862 | check_client(va_list args)
862                             source_p->sockhost,
863                             source_p->localClient->listener->name,
864                             source_p->localClient->listener->port);
865 <      ilog(L_INFO,
865 >      ilog(LOG_TYPE_IRCD,
866            "Unauthorized client connection from %s on [%s/%u].",
867            get_client_name(source_p, SHOW_IP),
868            source_p->localClient->listener->name,
# Line 1191 | Line 1189 | hash_ip(struct irc_ssaddr *addr)
1189    {
1190      struct sockaddr_in *v4 = (struct sockaddr_in *)addr;
1191      int hash;
1192 <    u_int32_t ip;
1192 >    uint32_t ip;
1193  
1194      ip   = ntohl(v4->sin_addr.s_addr);
1195      hash = ((ip >> 12) + ip) & (IP_HASH_SIZE-1);
# Line 1202 | Line 1200 | hash_ip(struct irc_ssaddr *addr)
1200    {
1201      int hash;
1202      struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)addr;
1203 <    u_int32_t *ip = (u_int32_t *)&v6->sin6_addr.s6_addr;
1203 >    uint32_t *ip = (uint32_t *)&v6->sin6_addr.s6_addr;
1204  
1205      hash  = ip[0] ^ ip[3];
1206      hash ^= hash >> 16;  
# Line 1552 | Line 1550 | map_to_list(ConfType type)
1550    case SERVER_TYPE:
1551      return(&server_items);
1552      break;
1553 +  case SERVICE_TYPE:
1554 +    return(&service_items);
1555 +    break;
1556    case CLUSTER_TYPE:
1557      return(&cluster_items);
1558      break;
# Line 1587 | Line 1588 | find_matching_name_conf(ConfType type, c
1588  
1589    switch (type)
1590    {
1591 <    case RXLINE_TYPE:
1591 > #ifdef HAVE_LIBPCRE
1592 >  case RXLINE_TYPE:
1593        DLINK_FOREACH(ptr, list_p->head)
1594        {
1595          conf = ptr->data;
# Line 1597 | Line 1599 | find_matching_name_conf(ConfType type, c
1599            return conf;
1600        }
1601        break;
1602 + #endif
1603 +  case SERVICE_TYPE:
1604 +    DLINK_FOREACH(ptr, list_p->head)
1605 +    {
1606 +      conf = ptr->data;
1607 +
1608 +      if (EmptyString(conf->name))
1609 +        continue;
1610 +      if ((name != NULL) && !irccmp(name, conf->name))
1611 +        return conf;
1612 +    }
1613 +    break;
1614  
1615    case XLINE_TYPE:
1616    case ULINE_TYPE:
# Line 1651 | Line 1665 | find_matching_name_conf(ConfType type, c
1665   * side effects - looks for an exact match on name field
1666   */
1667   struct ConfItem *
1668 < find_exact_name_conf(ConfType type, const char *name,
1668 > find_exact_name_conf(ConfType type, const struct Client *who, const char *name,
1669                       const char *user, const char *host)
1670   {
1671    dlink_node *ptr = NULL;
# Line 1692 | Line 1706 | find_exact_name_conf(ConfType type, cons
1706      DLINK_FOREACH(ptr, list_p->head)
1707      {
1708        conf = ptr->data;
1709 <      aconf = (struct AccessItem *)map_to_conf(conf);
1709 >      aconf = map_to_conf(conf);
1710 >
1711        if (EmptyString(conf->name))
1712 <        continue;
1713 <    
1714 <      if (irccmp(conf->name, name) == 0)
1712 >        continue;
1713 >
1714 >      if (!irccmp(conf->name, name))
1715        {
1716 <        if ((user == NULL && (host == NULL)))
1717 <          return (conf);
1718 <        if (EmptyString(aconf->user) || EmptyString(aconf->host))
1719 <          return (conf);
1720 <        if (match(aconf->user, user) && match(aconf->host, host))
1721 <          return (conf);
1716 >        if (!who)
1717 >          return conf;
1718 >        if (EmptyString(aconf->user) || EmptyString(aconf->host))
1719 >          return conf;
1720 >        if (match(aconf->user, who->username))
1721 >        {
1722 >          switch (aconf->type)
1723 >          {
1724 >            case HM_HOST:
1725 >              if (match(aconf->host, who->host) || match(aconf->host, who->sockhost))
1726 >                return conf;
1727 >              break;
1728 >            case HM_IPV4:
1729 >              if (who->localClient->aftype == AF_INET)
1730 >                if (match_ipv4(&who->localClient->ip, &aconf->ipnum, aconf->bits))
1731 >                  return conf;
1732 >              break;
1733 > #ifdef IPV6
1734 >            case HM_IPV6:
1735 >              if (who->localClient->aftype == AF_INET6)
1736 >                if (match_ipv6(&who->localClient->ip, &aconf->ipnum, aconf->bits))
1737 >                  return conf;
1738 >              break;
1739 > #endif
1740 >            default:
1741 >              assert(0);
1742 >          }
1743 >        }
1744        }
1745      }
1746 +
1747      break;
1748  
1749    case SERVER_TYPE:
# Line 1761 | Line 1799 | rehash(int sig)
1799      sendto_realops_flags(UMODE_ALL, L_ALL,
1800                           "Got signal SIGHUP, reloading ircd.conf file");
1801  
1764 #ifndef _WIN32
1802    restart_resolver();
1803 < #endif
1803 >
1804    /* don't close listeners until we know we can go ahead with the rehash */
1805  
1806    /* Check to see if we magically got(or lost) IPv6 support */
# Line 1774 | Line 1811 | rehash(int sig)
1811    if (ServerInfo.description != NULL)
1812      strlcpy(me.info, ServerInfo.description, sizeof(me.info));
1813  
1777 #ifndef STATIC_MODULES
1814    load_conf_modules();
1779 #endif
1815  
1816    flush_deleted_I_P();
1817  
1818    rehashed_klines = 1;
1819 <
1819 > /* XXX */
1820    if (ConfigLoggingEntry.use_logging)
1821 <    reopen_log(logFileName);
1821 >    log_close_all();
1822  
1823    return(0);
1824   }
# Line 1822 | Line 1857 | set_default_conf(void)
1857    ServerInfo.specific_ipv6_vhost = 0;
1858  
1859    ServerInfo.max_clients = MAXCLIENTS_MAX;
1860 <  /* Don't reset hub, as that will break lazylinks */
1861 <  /* ServerInfo.hub = NO; */
1860 >
1861 >  ServerInfo.hub = 0;
1862    ServerInfo.dns_host.sin_addr.s_addr = 0;
1863    ServerInfo.dns_host.sin_port = 0;
1864    AdminInfo.name = NULL;
1865    AdminInfo.email = NULL;
1866    AdminInfo.description = NULL;
1867  
1868 <  set_log_level(L_NOTICE);
1868 >  log_close_all();
1869 >
1870    ConfigLoggingEntry.use_logging = 1;
1871 <  ConfigLoggingEntry.operlog[0] = '\0';
1872 <  ConfigLoggingEntry.userlog[0] = '\0';
1873 <  ConfigLoggingEntry.klinelog[0] = '\0';
1874 <  ConfigLoggingEntry.glinelog[0] = '\0';
1875 <  ConfigLoggingEntry.killlog[0] = '\0';
1876 <  ConfigLoggingEntry.operspylog[0] = '\0';
1877 <  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;
1871 >
1872 >  ConfigChannel.disable_fake_channels = 0;
1873 >  ConfigChannel.restrict_channels = 0;
1874 >  ConfigChannel.disable_local_channels = 0;
1875 >  ConfigChannel.use_invex = 1;
1876 >  ConfigChannel.use_except = 1;
1877 >  ConfigChannel.use_knock = 1;
1878    ConfigChannel.knock_delay = 300;
1879    ConfigChannel.knock_delay_channel = 60;
1880    ConfigChannel.max_chans_per_user = 15;
1881 <  ConfigChannel.quiet_on_ban = YES;
1881 >  ConfigChannel.quiet_on_ban = 1;
1882    ConfigChannel.max_bans = 25;
1883    ConfigChannel.default_split_user_count = 0;
1884    ConfigChannel.default_split_server_count = 0;
1885 <  ConfigChannel.no_join_on_split = NO;
1886 <  ConfigChannel.no_create_on_split = NO;
1887 <  ConfigChannel.burst_topicwho = YES;
1885 >  ConfigChannel.no_join_on_split = 0;
1886 >  ConfigChannel.no_create_on_split = 0;
1887 >  ConfigChannel.burst_topicwho = 1;
1888  
1889 <  ConfigServerHide.flatten_links = NO;
1889 >  ConfigServerHide.flatten_links = 0;
1890    ConfigServerHide.links_delay = 300;
1891 <  ConfigServerHide.hidden = NO;
1892 <  ConfigServerHide.disable_hidden = NO;
1893 <  ConfigServerHide.hide_servers = NO;
1891 >  ConfigServerHide.hidden = 0;
1892 >  ConfigServerHide.disable_hidden = 0;
1893 >  ConfigServerHide.hide_servers = 0;
1894    DupString(ConfigServerHide.hidden_name, NETWORK_NAME_DEFAULT);
1895 <  ConfigServerHide.hide_server_ips = NO;
1895 >  ConfigServerHide.hide_server_ips = 0;
1896  
1897    
1898 +  DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT);
1899    ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
1900    ConfigFileEntry.gline_min_cidr = 16;
1901    ConfigFileEntry.gline_min_cidr6 = 48;
1902 <  ConfigFileEntry.invisible_on_connect = YES;
1903 <  ConfigFileEntry.burst_away = NO;
1904 <  ConfigFileEntry.use_whois_actually = YES;
1905 <  ConfigFileEntry.tkline_expire_notices = YES;
1906 <  ConfigFileEntry.hide_spoof_ips = YES;
1907 <  ConfigFileEntry.ignore_bogus_ts = NO;
1908 <  ConfigFileEntry.disable_auth = NO;
1909 <  ConfigFileEntry.disable_remote = NO;
1902 >  ConfigFileEntry.invisible_on_connect = 1;
1903 >  ConfigFileEntry.burst_away = 0;
1904 >  ConfigFileEntry.use_whois_actually = 1;
1905 >  ConfigFileEntry.tkline_expire_notices = 1;
1906 >  ConfigFileEntry.hide_spoof_ips = 1;
1907 >  ConfigFileEntry.ignore_bogus_ts = 0;
1908 >  ConfigFileEntry.disable_auth = 0;
1909 >  ConfigFileEntry.disable_remote = 0;
1910    ConfigFileEntry.kill_chase_time_limit = 90;
1911 <  ConfigFileEntry.default_floodcount = 8; /* XXX */
1912 <  ConfigFileEntry.failed_oper_notice = YES;
1913 <  ConfigFileEntry.dots_in_ident = 0;      /* XXX */
1885 <  ConfigFileEntry.dot_in_ip6_addr = YES;
1911 >  ConfigFileEntry.default_floodcount = 8;
1912 >  ConfigFileEntry.failed_oper_notice = 1;
1913 >  ConfigFileEntry.dots_in_ident = 0;
1914    ConfigFileEntry.min_nonwildcard = 4;
1915    ConfigFileEntry.min_nonwildcard_simple = 3;
1916    ConfigFileEntry.max_accept = 20;
1917 <  ConfigFileEntry.anti_nick_flood = NO;   /* XXX */
1917 >  ConfigFileEntry.anti_nick_flood = 0;
1918    ConfigFileEntry.max_nick_time = 20;
1919    ConfigFileEntry.max_nick_changes = 5;
1920 <  ConfigFileEntry.anti_spam_exit_message_time = 0;  /* XXX */
1920 >  ConfigFileEntry.anti_spam_exit_message_time = 0;
1921    ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
1922 <  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;  /* XXX */
1923 <  ConfigFileEntry.kline_with_reason = YES;
1922 >  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
1923 >  ConfigFileEntry.kline_with_reason = 1;
1924    ConfigFileEntry.kline_reason = NULL;
1925 <  ConfigFileEntry.warn_no_nline = YES;
1926 <  ConfigFileEntry.stats_o_oper_only = NO; /* XXX */
1925 >  ConfigFileEntry.warn_no_nline = 1;
1926 >  ConfigFileEntry.stats_o_oper_only = 0;
1927    ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
1928    ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
1929 <  ConfigFileEntry.stats_P_oper_only = NO;
1929 >  ConfigFileEntry.stats_P_oper_only = 0;
1930    ConfigFileEntry.caller_id_wait = 60;
1931 <  ConfigFileEntry.opers_bypass_callerid = NO;
1931 >  ConfigFileEntry.opers_bypass_callerid = 0;
1932    ConfigFileEntry.pace_wait = 10;
1933    ConfigFileEntry.pace_wait_simple = 1;
1934 <  ConfigFileEntry.short_motd = NO;
1935 <  ConfigFileEntry.ping_cookie = NO;
1936 <  ConfigFileEntry.no_oper_flood = NO;     /* XXX */
1937 <  ConfigFileEntry.true_no_oper_flood = NO;  /* XXX */
1938 <  ConfigFileEntry.oper_pass_resv = YES;
1939 <  ConfigFileEntry.glines = NO;            /* XXX */
1940 <  ConfigFileEntry.gline_time = 12 * 3600; /* XXX */
1913 <  ConfigFileEntry.idletime = 0;
1934 >  ConfigFileEntry.short_motd = 0;
1935 >  ConfigFileEntry.ping_cookie = 0;
1936 >  ConfigFileEntry.no_oper_flood = 0;
1937 >  ConfigFileEntry.true_no_oper_flood = 0;
1938 >  ConfigFileEntry.oper_pass_resv = 1;
1939 >  ConfigFileEntry.glines = 0;
1940 >  ConfigFileEntry.gline_time = 12 * 3600;
1941    ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
1942    ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT;
1943 <  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;  /* XXX */
1943 >  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;
1944    ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE |
1945 <    UMODE_OPERWALL | UMODE_WALLOP;        /* XXX */
1946 <  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;
1945 >    UMODE_OPERWALL | UMODE_WALLOP;
1946 >  ConfigFileEntry.use_egd = 0;
1947    ConfigFileEntry.egdpool_path = NULL;
1933 #ifdef HAVE_LIBZ
1934  ConfigFileEntry.compression_level = 0;
1935 #endif
1948    ConfigFileEntry.throttle_time = 10;
1949   }
1950  
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
1951   static void
1952   validate_conf(void)
1953   {
# Line 1969 | Line 1957 | validate_conf(void)
1957    if (ConfigFileEntry.ts_max_delta < TS_MAX_DELTA_MIN)
1958      ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
1959  
1972  if (ConfigFileEntry.servlink_path == NULL)
1973    DupString(ConfigFileEntry.servlink_path, SLPATH);
1974
1960    if (ServerInfo.network_name == NULL)
1961      DupString(ServerInfo.network_name,NETWORK_NAME_DEFAULT);
1962  
1963    if (ServerInfo.network_desc == NULL)
1964      DupString(ServerInfo.network_desc,NETWORK_DESC_DEFAULT);
1965  
1966 +  if (ConfigFileEntry.service_name == NULL)
1967 +    DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT);
1968 +
1969    if ((ConfigFileEntry.client_flood < CLIENT_FLOOD_MIN) ||
1970        (ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX))
1971      ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX;
# Line 1985 | Line 1973 | validate_conf(void)
1973    ConfigFileEntry.max_watch = IRCD_MAX(ConfigFileEntry.max_watch, WATCHSIZE_MIN);
1974   }
1975  
1976 + /* read_conf()
1977 + *
1978 + * inputs       - file descriptor pointing to config file to use
1979 + * output       - None
1980 + * side effects - Read configuration file.
1981 + */
1982 + static void
1983 + read_conf(FILE *file)
1984 + {
1985 +  lineno = 0;
1986 +
1987 +  set_default_conf(); /* Set default values prior to conf parsing */
1988 +  conf_parser_ctx.pass = 1;
1989 +  yyparse();          /* pick up the classes first */
1990 +
1991 +  rewind(file);
1992 +
1993 +  conf_parser_ctx.pass = 2;
1994 +  yyparse();          /* Load the values from the conf */
1995 +  validate_conf();    /* Check to make sure some values are still okay. */
1996 +                      /* Some global values are also loaded here. */
1997 +  check_class();      /* Make sure classes are valid */
1998 + }
1999 +
2000   /* lookup_confhost()
2001   *
2002   * start DNS lookups of all hostnames in the conf
# Line 2001 | Line 2013 | lookup_confhost(struct ConfItem *conf)
2013    if (EmptyString(aconf->host) ||
2014        EmptyString(aconf->user))
2015    {
2016 <    ilog(L_ERROR, "Host/server name error: (%s) (%s)",
2016 >    ilog(LOG_TYPE_IRCD, "Host/server name error: (%s) (%s)",
2017           aconf->host, conf->name);
2018      return;
2019    }
# Line 2021 | Line 2033 | lookup_confhost(struct ConfItem *conf)
2033    /* Get us ready for a bind() and don't bother doing dns lookup */
2034    hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2035  
2036 <  if (irc_getaddrinfo(aconf->host, NULL, &hints, &res))
2036 >  if (getaddrinfo(aconf->host, NULL, &hints, &res))
2037    {
2038      conf_dns_lookup(aconf);
2039      return;
# Line 2032 | Line 2044 | lookup_confhost(struct ConfItem *conf)
2044    memcpy(&aconf->ipnum, res->ai_addr, res->ai_addrlen);
2045    aconf->ipnum.ss_len = res->ai_addrlen;
2046    aconf->ipnum.ss.ss_family = res->ai_family;
2047 <  irc_freeaddrinfo(res);
2047 >  freeaddrinfo(res);
2048   }
2049  
2050   /* conf_connect_allowed()
# Line 2071 | Line 2083 | conf_connect_allowed(struct irc_ssaddr *
2083   static struct AccessItem *
2084   find_regexp_kline(const char *uhi[])
2085   {
2086 + #ifdef HAVE_LIBPCRE
2087    const dlink_node *ptr = NULL;
2088  
2089    DLINK_FOREACH(ptr, rkconf_items.head)
# Line 2085 | Line 2098 | find_regexp_kline(const char *uhi[])
2098           !ircd_pcre_exec(aptr->regexhost, uhi[2])))
2099        return aptr;
2100    }
2101 <
2101 > #endif
2102    return NULL;
2103   }
2104  
# Line 2329 | Line 2342 | expire_tklines(dlink_list *tklist)
2342   static const struct oper_privs
2343   {
2344    const unsigned int oprivs;
2332  const unsigned int hidden;
2345    const unsigned char c;
2346   } flag_list[] = {
2347 <  { OPER_FLAG_ADMIN,       OPER_FLAG_HIDDEN_ADMIN,  'A' },
2348 <  { OPER_FLAG_REMOTEBAN,   0,                       'B' },
2349 <  { OPER_FLAG_DIE,         0,                       'D' },
2350 <  { OPER_FLAG_GLINE,       0,                       'G' },
2351 <  { OPER_FLAG_REHASH,      0,                       'H' },
2352 <  { OPER_FLAG_K,           0,                       'K' },
2353 <  { OPER_FLAG_OPERWALL,    0,                       'L' },
2354 <  { OPER_FLAG_N,           0,                       'N' },
2355 <  { OPER_FLAG_GLOBAL_KILL, 0,                       'O' },
2356 <  { OPER_FLAG_REMOTE,      0,                       'R' },
2357 <  { OPER_FLAG_OPER_SPY,    0,                       'S' },
2358 <  { OPER_FLAG_UNKLINE,     0,                       'U' },
2359 <  { OPER_FLAG_X,           0,                       'X' },
2360 <  { 0, 0, '\0' }
2347 >  { OPER_FLAG_ADMIN,       'A' },
2348 >  { OPER_FLAG_REMOTEBAN,   'B' },
2349 >  { OPER_FLAG_DIE,         'D' },
2350 >  { OPER_FLAG_GLINE,       'G' },
2351 >  { OPER_FLAG_REHASH,      'H' },
2352 >  { OPER_FLAG_K,           'K' },
2353 >  { OPER_FLAG_OPERWALL,    'L' },
2354 >  { OPER_FLAG_N,           'N' },
2355 >  { OPER_FLAG_GLOBAL_KILL, 'O' },
2356 >  { OPER_FLAG_REMOTE,      'R' },
2357 >  { OPER_FLAG_OPER_SPY,    'S' },
2358 >  { OPER_FLAG_UNKLINE,     'U' },
2359 >  { OPER_FLAG_X,           'X' },
2360 >  { 0, '\0' }
2361   };
2362  
2363   char *
# Line 2357 | Line 2369 | oper_privs_as_string(const unsigned int
2369  
2370    for (; flag_list[i].oprivs; ++i)
2371    {
2372 <    if ((port & flag_list[i].oprivs) &&
2361 <        (port & flag_list[i].hidden) == 0)
2372 >    if (port & flag_list[i].oprivs)
2373        *privs_ptr++ = flag_list[i].c;
2374      else
2375        *privs_ptr++ = ToLowerTab[flag_list[i].c];
# Line 2383 | Line 2394 | get_oper_name(const struct Client *clien
2394    struct AccessItem *aconf;
2395  
2396    /* +5 for !,@,{,} and null */
2397 <  static char buffer[NICKLEN+USERLEN+HOSTLEN+HOSTLEN+5];
2397 >  static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
2398  
2399    if (MyConnect(client_p))
2400    {
# Line 2394 | Line 2405 | get_oper_name(const struct Client *clien
2405  
2406        if (IsConfOperator(aconf))
2407        {
2408 <        ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name,
2409 <                   client_p->username, client_p->host,
2399 <                   conf->name);
2408 >        snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
2409 >                 client_p->username, client_p->host, conf->name);
2410          return buffer;
2411        }
2412      }
# Line 2407 | Line 2417 | get_oper_name(const struct Client *clien
2417      assert(0); /* Oper without oper conf! */
2418    }
2419  
2420 <  ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name,
2421 <             client_p->username, client_p->host, client_p->servptr->name);
2420 >  snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
2421 >           client_p->username, client_p->host, client_p->servptr->name);
2422    return buffer;
2423   }
2424  
# Line 2425 | Line 2435 | read_conf_files(int cold)
2435    char chanmodes[32];
2436    char chanlimit[32];
2437  
2438 +  conf_parser_ctx.boot = cold;
2439    filename = get_conf_name(CONF_TYPE);
2440  
2441    /* We need to know the initial filename for the yyerror() to report
# Line 2435 | Line 2446 | read_conf_files(int cold)
2446    */
2447    strlcpy(conffilebuf, filename, sizeof(conffilebuf));
2448  
2449 <  if ((conf_fbfile_in = fbopen(filename, "r")) == NULL)
2449 >  if ((conf_parser_ctx.conf_file = fopen(filename, "r")) == NULL)
2450    {
2451      if (cold)
2452      {
2453 <      ilog(L_CRIT, "Unable to read configuration file '%s': %s",
2453 >      ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
2454             filename, strerror(errno));
2455        exit(-1);
2456      }
# Line 2455 | Line 2466 | read_conf_files(int cold)
2466    if (!cold)
2467      clear_out_old_conf();
2468  
2469 <  read_conf(conf_fbfile_in);
2470 <  fbclose(conf_fbfile_in);
2469 >  read_conf(conf_parser_ctx.conf_file);
2470 >  fclose(conf_parser_ctx.conf_file);
2471  
2472    add_isupport("NETWORK", ServerInfo.network_name, -1);
2473 <  ircsprintf(chanmodes, "b%s%s:%d", ConfigChannel.use_except ? "e" : "",
2474 <             ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans);
2473 >  snprintf(chanmodes, sizeof(chanmodes), "b%s%s:%d",
2474 >           ConfigChannel.use_except ? "e" : "",
2475 >           ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans);
2476    add_isupport("MAXLIST", chanmodes, -1);
2477    add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets);
2478 +
2479    if (ConfigChannel.disable_local_channels)
2480      add_isupport("CHANTYPES", "#", -1);
2481    else
2482      add_isupport("CHANTYPES", "#&", -1);
2483 <  ircsprintf(chanlimit, "%s:%d", ConfigChannel.disable_local_channels ? "#" : "#&",
2484 <             ConfigChannel.max_chans_per_user);
2483 >
2484 >  snprintf(chanlimit, sizeof(chanlimit), "%s:%d",
2485 >           ConfigChannel.disable_local_channels ? "#" : "#&",
2486 >           ConfigChannel.max_chans_per_user);
2487    add_isupport("CHANLIMIT", chanlimit, -1);
2488 <  ircsprintf(chanmodes, "%s%s%s", ConfigChannel.use_except ? "e" : "",
2489 <             ConfigChannel.use_invex ? "I" : "", "b,k,l,imnpst");
2488 >  snprintf(chanmodes, sizeof(chanmodes), "%s%s%s",
2489 >           ConfigChannel.use_except ? "e" : "",
2490 >           ConfigChannel.use_invex ? "I" : "", "b,k,l,imnprstORS");
2491    add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN);
2492 +
2493    if (ConfigChannel.use_except)
2494      add_isupport("EXCEPTS", "e", -1);
2495    if (ConfigChannel.use_invex)
# Line 2485 | Line 2502 | read_conf_files(int cold)
2502     */
2503    rebuild_isupport_message_line();
2504  
2505 <  parse_conf_file(KLINE_TYPE, cold);
2505 > #ifdef HAVE_LIBPCRE
2506    parse_conf_file(RKLINE_TYPE, cold);
2507 +  parse_conf_file(RXLINE_TYPE, cold);
2508 + #endif
2509 +  parse_conf_file(KLINE_TYPE, cold);
2510    parse_conf_file(DLINE_TYPE, cold);
2511    parse_conf_file(XLINE_TYPE, cold);
2492  parse_conf_file(RXLINE_TYPE, cold);
2512    parse_conf_file(NRESV_TYPE, cold);
2513    parse_conf_file(CRESV_TYPE, cold);
2514   }
# Line 2503 | Line 2522 | read_conf_files(int cold)
2522   static void
2523   parse_conf_file(int type, int cold)
2524   {
2525 <  FBFILE *file = NULL;
2525 >  FILE *file = NULL;
2526    const char *filename = get_conf_name(type);
2527  
2528 <  if ((file = fbopen(filename, "r")) == NULL)
2528 >  if ((file = fopen(filename, "r")) == NULL)
2529    {
2530      if (cold)
2531 <      ilog(L_ERROR, "Unable to read configuration file '%s': %s",
2531 >      ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
2532             filename, strerror(errno));
2533      else
2534        sendto_realops_flags(UMODE_ALL, L_ALL,
# Line 2519 | Line 2538 | parse_conf_file(int type, int cold)
2538    else
2539    {
2540      parse_csv_file(file, type);
2541 <    fbclose(file);
2541 >    fclose(file);
2542    }
2543   }
2544  
# Line 2540 | Line 2559 | clear_out_old_conf(void)
2559    dlink_list *free_items [] = {
2560      &server_items,   &oconf_items,    &hub_items, &leaf_items,
2561       &uconf_items,   &xconf_items, &rxconf_items, &rkconf_items,
2562 <     &nresv_items, &cluster_items,  &gdeny_items, NULL
2562 >     &nresv_items, &cluster_items,  &gdeny_items, &service_items, NULL
2563    };
2564  
2565    dlink_list ** iterator = free_items; /* C is dumb */
# Line 2641 | Line 2660 | clear_out_old_conf(void)
2660    clear_out_address_conf();
2661  
2662    /* clean out module paths */
2644 #ifndef STATIC_MODULES
2663    mod_clear_paths();
2646 #endif
2664  
2665    /* clean out ServerInfo */
2666    MyFree(ServerInfo.description);
# Line 2663 | Line 2680 | clear_out_old_conf(void)
2680  
2681    MyFree(ServerInfo.rsa_private_key_file);
2682    ServerInfo.rsa_private_key_file = NULL;
2683 +
2684 +  if (ServerInfo.server_ctx)
2685 +    SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|
2686 +                                               SSL_OP_NO_SSLv3|
2687 +                                               SSL_OP_NO_TLSv1);
2688 +  if (ServerInfo.client_ctx)
2689 +    SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|
2690 +                                               SSL_OP_NO_SSLv3|
2691 +                                               SSL_OP_NO_TLSv1);
2692   #endif
2693  
2694    /* clean out old resvs from the conf */
# Line 2685 | Line 2711 | clear_out_old_conf(void)
2711     */
2712  
2713    /* clean out general */
2714 <  MyFree(ConfigFileEntry.servlink_path);
2715 <  ConfigFileEntry.servlink_path = NULL;
2716 < #ifdef HAVE_LIBCRYPTO
2691 <  ConfigFileEntry.default_cipher_preference = NULL;
2692 < #endif /* HAVE_LIBCRYPTO */
2714 >  MyFree(ConfigFileEntry.service_name);
2715 >  ConfigFileEntry.service_name = NULL;
2716 >
2717    delete_isupport("INVEX");
2718    delete_isupport("EXCEPTS");
2719   }
# Line 2884 | Line 2908 | find_class(const char *classname)
2908   {
2909    struct ConfItem *conf;
2910  
2911 <  if ((conf = find_exact_name_conf(CLASS_TYPE, classname, NULL, NULL)) != NULL)
2911 >  if ((conf = find_exact_name_conf(CLASS_TYPE, NULL, classname, NULL, NULL)) != NULL)
2912      return conf;
2913  
2914    return class_default;
# Line 3044 | Line 3068 | conf_add_server(struct ConfItem *conf, c
3068    if (!aconf->host || !conf->name)
3069    {
3070      sendto_realops_flags(UMODE_ALL, L_ALL, "Bad connect block");
3071 <    ilog(L_WARN, "Bad connect block");
3071 >    ilog(LOG_TYPE_IRCD, "Bad connect block");
3072      return -1;
3073    }
3074  
3075 <  if (EmptyString(aconf->passwd) && !IsConfCryptLink(aconf))
3075 >  if (EmptyString(aconf->passwd))
3076    {
3077      sendto_realops_flags(UMODE_ALL, L_ALL, "Bad connect block, name %s",
3078                           conf->name);
3079 <    ilog(L_WARN, "Bad connect block, host %s", conf->name);
3079 >    ilog(LOG_TYPE_IRCD, "Bad connect block, host %s", conf->name);
3080      return -1;
3081    }
3082  
# Line 3079 | Line 3103 | conf_add_server(struct ConfItem *conf, c
3103    return 0;
3104   }
3105  
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
3106   /* yyerror()
3107   *
3108   * inputs       - message from parser
# Line 3121 | Line 3114 | yyerror(const char *msg)
3114   {
3115    char newlinebuf[IRCD_BUFSIZE];
3116  
3117 <  if (ypass != 1)
3117 >  if (conf_parser_ctx.pass != 1)
3118      return;
3119  
3120    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
3121    sendto_realops_flags(UMODE_ALL, L_ALL, "\"%s\", line %u: %s: %s",
3122                         conffilebuf, lineno + 1, msg, newlinebuf);
3123 <  ilog(L_WARN, "\"%s\", line %u: %s: %s",
3123 >  ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
3124         conffilebuf, lineno + 1, msg, newlinebuf);
3125   }
3126  
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
3127   /*
3128   * valid_tkline()
3129   *
# Line 3157 | Line 3135 | conf_yy_fatal_error(const char *msg)
3135   * Originally written by Dianora (Diane, db@db.net)
3136   */
3137   time_t
3138 < valid_tkline(char *p, int minutes)
3138 > valid_tkline(const char *p, int minutes)
3139   {
3140    time_t result = 0;
3141  
3142 <  while (*p)
3142 >  for (; *p; ++p)
3143    {
3144 <    if (IsDigit(*p))
3167 <    {
3168 <      result *= 10;
3169 <      result += ((*p) & 0xF);
3170 <      p++;
3171 <    }
3172 <    else
3144 >    if (!IsDigit(*p))
3145        return 0;
3146 +
3147 +    result *= 10;
3148 +    result += ((*p) & 0xF);
3149    }
3150  
3151 <  /* in the degenerate case where oper does a /quote kline 0 user@host :reason
3151 >  /*
3152 >   * In the degenerate case where oper does a /quote kline 0 user@host :reason
3153     * i.e. they specifically use 0, I am going to return 1 instead
3154     * as a return value of non-zero is used to flag it as a temporary kline
3155     */
3180
3156    if (result == 0)
3157      result = 1;
3158  
# Line 3348 | Line 3323 | parse_aline(const char *cmd, struct Clie
3323          return -1;
3324        }
3325  
3326 <      if (!IsOperRemoteBan(source_p))
3326 >      if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
3327        {
3328          sendto_one(source_p, form_str(ERR_NOPRIVS),
3329                     me.name, source_p->name, "remoteban");
# Line 3385 | Line 3360 | parse_aline(const char *cmd, struct Clie
3360        return -1;
3361      }
3362  
3363 <    if ((parse_flags & AWILD) && !valid_wild_card(source_p, YES, 2, *up_p, *h_p))
3363 >    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 2, *up_p, *h_p))
3364        return -1;
3365    }
3366    else
3367 <    if ((parse_flags & AWILD) && !valid_wild_card(source_p, YES, 1, *up_p))
3367 >    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 1, *up_p))
3368        return -1;
3369  
3370    if (reason != NULL)
# Line 3397 | Line 3372 | parse_aline(const char *cmd, struct Clie
3372      if (parc != 0 && !EmptyString(*parv))
3373      {
3374        *reason = *parv;
3375 <      if (!valid_comment(source_p, *reason, YES))
3375 >      if (!valid_comment(source_p, *reason, 1))
3376          return -1;
3377      }
3378      else
# Line 3556 | Line 3531 | match_conf_password(const char *password
3531   * inputs       - client sending the cluster
3532   *              - command name "KLINE" "XLINE" etc.
3533   *              - capab -- CAP_KLN etc. from s_serv.h
3534 < *              - cluster type -- CLUSTER_KLINE etc. from s_conf.h
3534 > *              - cluster type -- CLUSTER_KLINE etc. from conf.h
3535   *              - pattern and args to send along
3536   * output       - none
3537   * side effects - Take source_p send the pattern with args given

Diff Legend

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