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 936 by db, Mon Apr 13 04:27:47 2009 UTC vs.
ircd-hybrid-8/src/s_conf.c (file contents), Revision 1176 by michael, Sun Aug 14 11:24:24 2011 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 + #include "list.h"
27   #include "ircd_defs.h"
28 < #include "tools.h"
28 > #include "balloc.h"
29   #include "s_conf.h"
30   #include "s_serv.h"
31   #include "resv.h"
# Line 37 | Line 38
38   #include "irc_string.h"
39   #include "sprintf_irc.h"
40   #include "s_bsd.h"
40 #include "irc_getaddrinfo.h"
41   #include "ircd.h"
42 #include "list.h"
42   #include "listener.h"
43   #include "hostmask.h"
44   #include "modules.h"
# Line 59 | Line 58 | struct Callback *client_check_cb = NULL;
58   struct config_server_hide ConfigServerHide;
59  
60   /* general conf items link list root, other than k lines etc. */
61 + dlink_list service_items = { NULL, NULL, 0 };
62   dlink_list server_items  = { NULL, NULL, 0 };
63   dlink_list cluster_items = { NULL, NULL, 0 };
64   dlink_list hub_items     = { NULL, NULL, 0 };
# Line 85 | Line 85 | extern char linebuf[];
85   extern char conffilebuf[IRCD_BUFSIZE];
86   extern char yytext[];
87   extern int yyparse(); /* defined in y.tab.c */
88 < int ypass = 1; /* used by yyparse()      */
88 >
89 > struct conf_parser_context conf_parser_ctx = { 0, 0, NULL };
90  
91   /* internally defined functions */
92   static void lookup_confhost(struct ConfItem *);
# Line 114 | Line 115 | static void destroy_cidr_class(struct Cl
115  
116   static void flags_to_ascii(unsigned int, const unsigned int[], char *, int);
117  
117 FBFILE *conf_fbfile_in = NULL;
118
118   /* address of default class conf */
119   static struct ConfItem *class_default;
120  
# Line 138 | Line 137 | static BlockHeap *ip_entry_heap = NULL;
137   static int ip_entries_count = 0;
138  
139  
140 < inline void *
140 > void *
141   map_to_conf(struct ConfItem *aconf)
142   {
143    void *conf;
144 <  conf = (void *)((unsigned long)aconf +
145 <                  (unsigned long)sizeof(struct ConfItem));
144 >  conf = (void *)((uintptr_t)aconf +
145 >                  (uintptr_t)sizeof(struct ConfItem));
146    return(conf);
147   }
148  
149 < inline struct ConfItem *
149 > struct ConfItem *
150   unmap_conf_item(void *aconf)
151   {
152    struct ConfItem *conf;
153  
154 <  conf = (struct ConfItem *)((unsigned long)aconf -
155 <                             (unsigned long)sizeof(struct ConfItem));
154 >  conf = (struct ConfItem *)((uintptr_t)aconf -
155 >                             (uintptr_t)sizeof(struct ConfItem));
156    return(conf);
157   }
158  
# Line 168 | Line 167 | unmap_conf_item(void *aconf)
167   * if successful save hp in the conf item it was called with
168   */
169   static void
170 < conf_dns_callback(void *vptr, struct DNSReply *reply)
170 > conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name)
171   {
172 <  struct AccessItem *aconf = (struct AccessItem *)vptr;
174 <  struct ConfItem *conf;
172 >  struct AccessItem *aconf = vptr;
173  
174 <  MyFree(aconf->dns_query);
177 <  aconf->dns_query = NULL;
174 >  aconf->dns_pending = 0;
175  
176 <  if (reply != NULL)
177 <    memcpy(&aconf->ipnum, &reply->addr, sizeof(reply->addr));
178 <  else {
179 <    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 <  }
176 >  if (addr != NULL)
177 >    memcpy(&aconf->ipnum, addr, sizeof(aconf->ipnum));
178 >  else
179 >    aconf->dns_failed = 1;
180   }
181  
182   /* conf_dns_lookup()
# Line 198 | Line 188 | conf_dns_callback(void *vptr, struct DNS
188   static void
189   conf_dns_lookup(struct AccessItem *aconf)
190   {
191 <  if (aconf->dns_query == NULL)
191 >  if (!aconf->dns_pending)
192    {
193 <    aconf->dns_query = MyMalloc(sizeof(struct DNSQuery));
194 <    aconf->dns_query->ptr = aconf;
205 <    aconf->dns_query->callback = conf_dns_callback;
206 <    gethost_byname(aconf->host, aconf->dns_query);
193 >    aconf->dns_pending = 1;
194 >    gethost_byname(conf_dns_callback, aconf, aconf->host);
195    }
196   }
197  
# Line 303 | Line 291 | make_conf_item(ConfType type)
291                                         sizeof(struct MatchItem));
292      dlinkAdd(conf, &conf->node, &xconf_items);
293      break;
294 <
294 > #ifdef HAVE_LIBPCRE
295    case RXLINE_TYPE:
296      conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) +
297                                         sizeof(struct MatchItem));
# Line 317 | Line 305 | make_conf_item(ConfType type)
305      aconf->status = CONF_KLINE;
306      dlinkAdd(conf, &conf->node, &rkconf_items);
307      break;
308 <
308 > #endif
309    case CLUSTER_TYPE:
310      conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem));
311      dlinkAdd(conf, &conf->node, &cluster_items);
# Line 334 | Line 322 | make_conf_item(ConfType type)
322      dlinkAdd(conf, &conf->node, &nresv_items);
323      break;
324  
325 +  case SERVICE_TYPE:
326 +    status = CONF_SERVICE;
327 +    conf = MyMalloc(sizeof(struct ConfItem));
328 +    dlinkAdd(conf, &conf->node, &service_items);
329 +    break;
330 +
331    case CLASS_TYPE:
332      conf = MyMalloc(sizeof(struct ConfItem) +
333                             sizeof(struct ClassItem));
# Line 381 | Line 375 | delete_conf_item(struct ConfItem *conf)
375    case SERVER_TYPE:
376      aconf = map_to_conf(conf);
377  
378 <    if (aconf->dns_query != NULL)
379 <    {
386 <      delete_resolver_queries(aconf->dns_query);
387 <      MyFree(aconf->dns_query);
388 <    }
378 >    if (aconf->dns_pending)
379 >      delete_resolver_queries(aconf);
380      if (aconf->passwd != NULL)
381        memset(aconf->passwd, 0, strlen(aconf->passwd));
382      if (aconf->spasswd != NULL)
# Line 398 | Line 389 | delete_conf_item(struct ConfItem *conf)
389      MyFree(aconf->oper_reason);
390      MyFree(aconf->user);
391      MyFree(aconf->host);
401    MyFree(aconf->fakename);
392   #ifdef HAVE_LIBCRYPTO
393      if (aconf->rsa_public_key)
394        RSA_free(aconf->rsa_public_key);
# Line 478 | Line 468 | delete_conf_item(struct ConfItem *conf)
468      dlinkDelete(&conf->node, &xconf_items);
469      MyFree(conf);
470      break;
471 <
471 > #ifdef HAVE_LIBPCRE
472    case RKLINE_TYPE:
473      aconf = map_to_conf(conf);
474      MyFree(aconf->regexuser);
# Line 501 | Line 491 | delete_conf_item(struct ConfItem *conf)
491      dlinkDelete(&conf->node, &rxconf_items);
492      MyFree(conf);
493      break;
494 <
494 > #endif
495    case NRESV_TYPE:
496      match_item = map_to_conf(conf);
497      MyFree(match_item->user);
# Line 543 | Line 533 | delete_conf_item(struct ConfItem *conf)
533      MyFree(conf);
534      break;
535  
536 +  case SERVICE_TYPE:
537 +    dlinkDelete(&conf->node, &service_items);
538 +    MyFree(conf);
539 +    break;
540 +
541    default:
542      break;
543    }
# Line 628 | Line 623 | report_confitem_types(struct Client *sou
623      }
624      break;
625  
626 + #ifdef HAVE_LIBPCRE
627    case RXLINE_TYPE:
628      DLINK_FOREACH(ptr, rxconf_items.head)
629      {
# Line 656 | Line 652 | report_confitem_types(struct Client *sou
652                   aconf->reason, aconf->oper_reason ? aconf->oper_reason : "");
653      }
654      break;
655 + #endif
656  
657    case ULINE_TYPE:
658      DLINK_FOREACH(ptr, uconf_items.head)
# Line 732 | Line 729 | report_confitem_types(struct Client *sou
729    case CLIENT_TYPE:
730      break;
731  
732 +  case SERVICE_TYPE:
733 +    DLINK_FOREACH(ptr, service_items.head)
734 +    {
735 +      conf = ptr->data;
736 +      sendto_one(source_p, form_str(RPL_STATSSERVICE),
737 +                 me.name, source_p->name, 'S', "*", conf->name, 0, 0);
738 +    }
739 +    break;
740 +
741    case SERVER_TYPE:
742      DLINK_FOREACH(ptr, server_items.head)
743      {
# Line 746 | Line 752 | report_confitem_types(struct Client *sou
752          *p++ = 'A';
753        if (IsConfCryptLink(aconf))
754          *p++ = 'C';
749      if (aconf->fakename)
750        *p++ = 'M';
755        if (IsConfTopicBurst(aconf))
756          *p++ = 'T';
757        if (IsConfCompressed(aconf))
# Line 800 | Line 804 | report_confitem_types(struct Client *sou
804    case CRESV_TYPE:
805    case NRESV_TYPE:
806    case CLUSTER_TYPE:
807 +  default:
808      break;
809    }
810   }
# Line 1191 | Line 1196 | hash_ip(struct irc_ssaddr *addr)
1196    {
1197      struct sockaddr_in *v4 = (struct sockaddr_in *)addr;
1198      int hash;
1199 <    u_int32_t ip;
1199 >    uint32_t ip;
1200  
1201      ip   = ntohl(v4->sin_addr.s_addr);
1202      hash = ((ip >> 12) + ip) & (IP_HASH_SIZE-1);
# Line 1202 | Line 1207 | hash_ip(struct irc_ssaddr *addr)
1207    {
1208      int hash;
1209      struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)addr;
1210 <    u_int32_t *ip = (u_int32_t *)&v6->sin6_addr.s6_addr;
1210 >    uint32_t *ip = (uint32_t *)&v6->sin6_addr.s6_addr;
1211  
1212      hash  = ip[0] ^ ip[3];
1213      hash ^= hash >> 16;  
# Line 1226 | Line 1231 | hash_ip(struct irc_ssaddr *addr)
1231   * used in the hash.
1232   */
1233   void
1234 < count_ip_hash(int *number_ips_stored, unsigned long *mem_ips_stored)
1234 > count_ip_hash(unsigned int *number_ips_stored, uint64_t *mem_ips_stored)
1235   {
1236    struct ip_entry *ptr;
1237    int i;
# Line 1552 | Line 1557 | map_to_list(ConfType type)
1557    case SERVER_TYPE:
1558      return(&server_items);
1559      break;
1560 +  case SERVICE_TYPE:
1561 +    return(&service_items);
1562 +    break;
1563    case CLUSTER_TYPE:
1564      return(&cluster_items);
1565      break;
# Line 1587 | Line 1595 | find_matching_name_conf(ConfType type, c
1595  
1596    switch (type)
1597    {
1598 <    case RXLINE_TYPE:
1598 > #ifdef HAVE_LIBPCRE
1599 >  case RXLINE_TYPE:
1600        DLINK_FOREACH(ptr, list_p->head)
1601        {
1602          conf = ptr->data;
# Line 1597 | Line 1606 | find_matching_name_conf(ConfType type, c
1606            return conf;
1607        }
1608        break;
1609 + #endif
1610 +  case SERVICE_TYPE:
1611 +    DLINK_FOREACH(ptr, list_p->head)
1612 +    {
1613 +      conf = ptr->data;
1614 +
1615 +      if (EmptyString(conf->name))
1616 +        continue;
1617 +      if ((name != NULL) && !irccmp(name, conf->name))
1618 +        return conf;
1619 +    }
1620 +    break;
1621  
1622    case XLINE_TYPE:
1623    case ULINE_TYPE:
# Line 1761 | Line 1782 | rehash(int sig)
1782      sendto_realops_flags(UMODE_ALL, L_ALL,
1783                           "Got signal SIGHUP, reloading ircd.conf file");
1784  
1764 #ifndef _WIN32
1785    restart_resolver();
1786 < #endif
1786 >
1787    /* don't close listeners until we know we can go ahead with the rehash */
1788  
1789    /* Check to see if we magically got(or lost) IPv6 support */
# Line 1774 | Line 1794 | rehash(int sig)
1794    if (ServerInfo.description != NULL)
1795      strlcpy(me.info, ServerInfo.description, sizeof(me.info));
1796  
1777 #ifndef STATIC_MODULES
1797    load_conf_modules();
1779 #endif
1798  
1799    flush_deleted_I_P();
1800  
# Line 1822 | Line 1840 | set_default_conf(void)
1840    ServerInfo.specific_ipv6_vhost = 0;
1841  
1842    ServerInfo.max_clients = MAXCLIENTS_MAX;
1843 <  /* Don't reset hub, as that will break lazylinks */
1844 <  /* ServerInfo.hub = NO; */
1843 >
1844 >  ServerInfo.hub = 0;
1845    ServerInfo.dns_host.sin_addr.s_addr = 0;
1846    ServerInfo.dns_host.sin_port = 0;
1847    AdminInfo.name = NULL;
# Line 1867 | Line 1885 | set_default_conf(void)
1885    ConfigServerHide.hide_server_ips = NO;
1886  
1887    
1888 +  DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT);
1889    ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
1890    ConfigFileEntry.gline_min_cidr = 16;
1891    ConfigFileEntry.gline_min_cidr6 = 48;
# Line 1879 | Line 1898 | set_default_conf(void)
1898    ConfigFileEntry.disable_auth = NO;
1899    ConfigFileEntry.disable_remote = NO;
1900    ConfigFileEntry.kill_chase_time_limit = 90;
1901 <  ConfigFileEntry.default_floodcount = 8; /* XXX */
1901 >  ConfigFileEntry.default_floodcount = 8;
1902    ConfigFileEntry.failed_oper_notice = YES;
1903 <  ConfigFileEntry.dots_in_ident = 0;      /* XXX */
1885 <  ConfigFileEntry.dot_in_ip6_addr = YES;
1903 >  ConfigFileEntry.dots_in_ident = 0;
1904    ConfigFileEntry.min_nonwildcard = 4;
1905    ConfigFileEntry.min_nonwildcard_simple = 3;
1906    ConfigFileEntry.max_accept = 20;
1907 <  ConfigFileEntry.anti_nick_flood = NO;   /* XXX */
1907 >  ConfigFileEntry.anti_nick_flood = NO;
1908    ConfigFileEntry.max_nick_time = 20;
1909    ConfigFileEntry.max_nick_changes = 5;
1910 <  ConfigFileEntry.anti_spam_exit_message_time = 0;  /* XXX */
1910 >  ConfigFileEntry.anti_spam_exit_message_time = 0;
1911    ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
1912 <  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;  /* XXX */
1912 >  ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
1913    ConfigFileEntry.kline_with_reason = YES;
1914    ConfigFileEntry.kline_reason = NULL;
1915    ConfigFileEntry.warn_no_nline = YES;
1916 <  ConfigFileEntry.stats_o_oper_only = NO; /* XXX */
1916 >  ConfigFileEntry.stats_o_oper_only = NO;
1917    ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
1918    ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
1919    ConfigFileEntry.stats_P_oper_only = NO;
# Line 1905 | Line 1923 | set_default_conf(void)
1923    ConfigFileEntry.pace_wait_simple = 1;
1924    ConfigFileEntry.short_motd = NO;
1925    ConfigFileEntry.ping_cookie = NO;
1926 <  ConfigFileEntry.no_oper_flood = NO;     /* XXX */
1927 <  ConfigFileEntry.true_no_oper_flood = NO;  /* XXX */
1926 >  ConfigFileEntry.no_oper_flood = NO;
1927 >  ConfigFileEntry.true_no_oper_flood = NO;
1928    ConfigFileEntry.oper_pass_resv = YES;
1929 <  ConfigFileEntry.glines = NO;            /* XXX */
1930 <  ConfigFileEntry.gline_time = 12 * 3600; /* XXX */
1913 <  ConfigFileEntry.idletime = 0;
1929 >  ConfigFileEntry.glines = NO;
1930 >  ConfigFileEntry.gline_time = 12 * 3600;
1931    ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
1932    ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT;
1933 <  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;  /* XXX */
1933 >  ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;
1934    ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE |
1935 <    UMODE_OPERWALL | UMODE_WALLOP;        /* XXX */
1935 >    UMODE_OPERWALL | UMODE_WALLOP;
1936    DupString(ConfigFileEntry.servlink_path, SLPATH);
1937   #ifdef HAVE_LIBCRYPTO
1938    /* jdc -- This is our default value for a cipher.  According to the
# Line 1948 | Line 1965 | read_conf(FBFILE *file)
1965    lineno = 0;
1966  
1967    set_default_conf(); /* Set default values prior to conf parsing */
1968 <  ypass = 1;
1968 >  conf_parser_ctx.pass = 1;
1969    yyparse();          /* pick up the classes first */
1970  
1971    fbrewind(file);
1972  
1973 <  ypass = 2;
1973 >  conf_parser_ctx.pass = 2;
1974    yyparse();          /* Load the values from the conf */
1975    validate_conf();    /* Check to make sure some values are still okay. */
1976                        /* Some global values are also loaded here. */
# Line 1978 | Line 1995 | validate_conf(void)
1995    if (ServerInfo.network_desc == NULL)
1996      DupString(ServerInfo.network_desc,NETWORK_DESC_DEFAULT);
1997  
1998 +  if (ConfigFileEntry.service_name == NULL)
1999 +    DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT);
2000 +
2001    if ((ConfigFileEntry.client_flood < CLIENT_FLOOD_MIN) ||
2002        (ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX))
2003      ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX;
# Line 2021 | Line 2041 | lookup_confhost(struct ConfItem *conf)
2041    /* Get us ready for a bind() and don't bother doing dns lookup */
2042    hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2043  
2044 <  if (irc_getaddrinfo(aconf->host, NULL, &hints, &res))
2044 >  if (getaddrinfo(aconf->host, NULL, &hints, &res))
2045    {
2046      conf_dns_lookup(aconf);
2047      return;
# Line 2032 | Line 2052 | lookup_confhost(struct ConfItem *conf)
2052    memcpy(&aconf->ipnum, res->ai_addr, res->ai_addrlen);
2053    aconf->ipnum.ss_len = res->ai_addrlen;
2054    aconf->ipnum.ss.ss_family = res->ai_family;
2055 <  irc_freeaddrinfo(res);
2055 >  freeaddrinfo(res);
2056   }
2057  
2058   /* conf_connect_allowed()
# Line 2071 | Line 2091 | conf_connect_allowed(struct irc_ssaddr *
2091   static struct AccessItem *
2092   find_regexp_kline(const char *uhi[])
2093   {
2094 + #ifdef HAVE_LIBPCRE
2095    const dlink_node *ptr = NULL;
2096  
2097    DLINK_FOREACH(ptr, rkconf_items.head)
# Line 2085 | Line 2106 | find_regexp_kline(const char *uhi[])
2106           !ircd_pcre_exec(aptr->regexhost, uhi[2])))
2107        return aptr;
2108    }
2109 <
2109 > #endif
2110    return NULL;
2111   }
2112  
# Line 2383 | Line 2404 | get_oper_name(const struct Client *clien
2404    struct AccessItem *aconf;
2405  
2406    /* +5 for !,@,{,} and null */
2407 <  static char buffer[NICKLEN+USERLEN+HOSTLEN+HOSTLEN+5];
2407 >  static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
2408  
2409    if (MyConnect(client_p))
2410    {
# Line 2394 | Line 2415 | get_oper_name(const struct Client *clien
2415  
2416        if (IsConfOperator(aconf))
2417        {
2418 <        ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name,
2419 <                   client_p->username, client_p->host,
2399 <                   conf->name);
2418 >        snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
2419 >                 client_p->username, client_p->host, conf->name);
2420          return buffer;
2421        }
2422      }
# Line 2407 | Line 2427 | get_oper_name(const struct Client *clien
2427      assert(0); /* Oper without oper conf! */
2428    }
2429  
2430 <  ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name,
2431 <             client_p->username, client_p->host, client_p->servptr->name);
2430 >  snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
2431 >           client_p->username, client_p->host, client_p->servptr->name);
2432    return buffer;
2433   }
2434  
# Line 2425 | Line 2445 | read_conf_files(int cold)
2445    char chanmodes[32];
2446    char chanlimit[32];
2447  
2448 +  conf_parser_ctx.boot = cold;
2449    filename = get_conf_name(CONF_TYPE);
2450  
2451    /* We need to know the initial filename for the yyerror() to report
# Line 2435 | Line 2456 | read_conf_files(int cold)
2456    */
2457    strlcpy(conffilebuf, filename, sizeof(conffilebuf));
2458  
2459 <  if ((conf_fbfile_in = fbopen(filename, "r")) == NULL)
2459 >  if ((conf_parser_ctx.conf_file = fbopen(filename, "r")) == NULL)
2460    {
2461      if (cold)
2462      {
# Line 2455 | Line 2476 | read_conf_files(int cold)
2476    if (!cold)
2477      clear_out_old_conf();
2478  
2479 <  read_conf(conf_fbfile_in);
2480 <  fbclose(conf_fbfile_in);
2479 >  read_conf(conf_parser_ctx.conf_file);
2480 >  fbclose(conf_parser_ctx.conf_file);
2481  
2482    add_isupport("NETWORK", ServerInfo.network_name, -1);
2483 <  ircsprintf(chanmodes, "b%s%s:%d", ConfigChannel.use_except ? "e" : "",
2484 <             ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans);
2483 >  snprintf(chanmodes, sizeof(chanmodes), "b%s%s:%d",
2484 >           ConfigChannel.use_except ? "e" : "",
2485 >           ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans);
2486    add_isupport("MAXLIST", chanmodes, -1);
2487    add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets);
2488 +
2489    if (ConfigChannel.disable_local_channels)
2490      add_isupport("CHANTYPES", "#", -1);
2491    else
2492      add_isupport("CHANTYPES", "#&", -1);
2493 <  ircsprintf(chanlimit, "%s:%d", ConfigChannel.disable_local_channels ? "#" : "#&",
2494 <             ConfigChannel.max_chans_per_user);
2493 >
2494 >  snprintf(chanlimit, sizeof(chanlimit), "%s:%d",
2495 >           ConfigChannel.disable_local_channels ? "#" : "#&",
2496 >           ConfigChannel.max_chans_per_user);
2497    add_isupport("CHANLIMIT", chanlimit, -1);
2498 <  ircsprintf(chanmodes, "%s%s%s", ConfigChannel.use_except ? "e" : "",
2499 <             ConfigChannel.use_invex ? "I" : "", "b,k,l,imnpst");
2498 >  snprintf(chanmodes, sizeof(chanmodes), "%s%s%s",
2499 >           ConfigChannel.use_except ? "e" : "",
2500 >           ConfigChannel.use_invex ? "I" : "", "b,k,l,imnprstORS");
2501    add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN);
2502 +
2503    if (ConfigChannel.use_except)
2504      add_isupport("EXCEPTS", "e", -1);
2505    if (ConfigChannel.use_invex)
# Line 2485 | Line 2512 | read_conf_files(int cold)
2512     */
2513    rebuild_isupport_message_line();
2514  
2515 <  parse_conf_file(KLINE_TYPE, cold);
2515 > #ifdef HAVE_LIBPCRE
2516    parse_conf_file(RKLINE_TYPE, cold);
2517 +  parse_conf_file(RXLINE_TYPE, cold);
2518 + #endif
2519 +  parse_conf_file(KLINE_TYPE, cold);
2520    parse_conf_file(DLINE_TYPE, cold);
2521    parse_conf_file(XLINE_TYPE, cold);
2492  parse_conf_file(RXLINE_TYPE, cold);
2522    parse_conf_file(NRESV_TYPE, cold);
2523    parse_conf_file(CRESV_TYPE, cold);
2524   }
# Line 2540 | Line 2569 | clear_out_old_conf(void)
2569    dlink_list *free_items [] = {
2570      &server_items,   &oconf_items,    &hub_items, &leaf_items,
2571       &uconf_items,   &xconf_items, &rxconf_items, &rkconf_items,
2572 <     &nresv_items, &cluster_items,  &gdeny_items, NULL
2572 >     &nresv_items, &cluster_items,  &gdeny_items, &service_items, NULL
2573    };
2574  
2575    dlink_list ** iterator = free_items; /* C is dumb */
# Line 2641 | Line 2670 | clear_out_old_conf(void)
2670    clear_out_address_conf();
2671  
2672    /* clean out module paths */
2644 #ifndef STATIC_MODULES
2673    mod_clear_paths();
2646 #endif
2674  
2675    /* clean out ServerInfo */
2676    MyFree(ServerInfo.description);
# Line 2685 | Line 2712 | clear_out_old_conf(void)
2712     */
2713  
2714    /* clean out general */
2715 +  MyFree(ConfigFileEntry.service_name);
2716 +  ConfigFileEntry.service_name = NULL;
2717 +
2718    MyFree(ConfigFileEntry.servlink_path);
2719    ConfigFileEntry.servlink_path = NULL;
2720   #ifdef HAVE_LIBCRYPTO
# Line 2943 | Line 2973 | init_class(void)
2973   * output       - sendq for this client as found from its class
2974   * side effects - NONE
2975   */
2976 < unsigned long
2976 > unsigned int
2977   get_sendq(struct Client *client_p)
2978   {
2979 <  unsigned long sendq = DEFAULT_SENDQ;
2979 >  unsigned int sendq = DEFAULT_SENDQ;
2980    dlink_node *ptr;
2981    struct ConfItem *conf;
2982    struct ConfItem *class_conf;
# Line 3079 | Line 3109 | conf_add_server(struct ConfItem *conf, c
3109    return 0;
3110   }
3111  
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
3112   /* yyerror()
3113   *
3114   * inputs       - message from parser
# Line 3121 | Line 3120 | yyerror(const char *msg)
3120   {
3121    char newlinebuf[IRCD_BUFSIZE];
3122  
3123 <  if (ypass != 1)
3123 >  if (conf_parser_ctx.pass != 1)
3124      return;
3125  
3126    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
# Line 3157 | Line 3156 | conf_yy_fatal_error(const char *msg)
3156   * Originally written by Dianora (Diane, db@db.net)
3157   */
3158   time_t
3159 < valid_tkline(char *p, int minutes)
3159 > valid_tkline(const char *p, int minutes)
3160   {
3161    time_t result = 0;
3162  
3163 <  while (*p)
3163 >  for (; *p; ++p)
3164    {
3165 <    if (IsDigit(*p))
3167 <    {
3168 <      result *= 10;
3169 <      result += ((*p) & 0xF);
3170 <      p++;
3171 <    }
3172 <    else
3165 >    if (!IsDigit(*p))
3166        return 0;
3167 +
3168 +    result *= 10;
3169 +    result += ((*p) & 0xF);
3170    }
3171  
3172 <  /* in the degenerate case where oper does a /quote kline 0 user@host :reason
3172 >  /*
3173 >   * In the degenerate case where oper does a /quote kline 0 user@host :reason
3174     * i.e. they specifically use 0, I am going to return 1 instead
3175     * as a return value of non-zero is used to flag it as a temporary kline
3176     */
3180
3177    if (result == 0)
3178      result = 1;
3179  

Diff Legend

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