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

Comparing ircd-hybrid/trunk/src/conf_parser.y (file contents):
Revision 7121 by michael, Sun Jan 24 20:22:55 2016 UTC vs.
Revision 8792 by michael, Thu Jan 17 18:35:32 2019 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 2000-2016 ircd-hybrid development team
4 > *  Copyright (c) 2000-2019 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 27 | Line 27
27  
28   %{
29  
30 #include <sys/types.h>
31 #include <string.h>
32
30   #include "config.h"
31   #include "stdinc.h"
32   #include "ircd.h"
33   #include "list.h"
34 + #include "parse.h"
35   #include "conf.h"
36   #include "conf_class.h"
37 + #include "conf_cluster.h"
38 + #include "conf_gecos.h"
39   #include "conf_pseudo.h"
40 + #include "conf_resv.h"
41 + #include "conf_service.h"
42 + #include "conf_shared.h"
43   #include "event.h"
44   #include "id.h"
45   #include "log.h"
43 #include "client.h"     /* for UMODE_SERVNOTICE only */
46   #include "irc_string.h"
47   #include "memory.h"
48   #include "modules.h"
49   #include "server.h"
50   #include "hostmask.h"
49 #include "send.h"
51   #include "listener.h"
51 #include "resv.h"
52 #include "numeric.h"
52   #include "user.h"
53   #include "motd.h"
54  
# Line 94 | Line 93 | static struct
93      port,
94      aftype,
95      ping_freq,
96 <    max_perip,
96 >    max_perip_local,
97 >    max_perip_global,
98      con_freq,
99      min_idle,
100      max_idle,
101      max_total,
102    max_global,
103    max_local,
104    max_ident,
102      max_sendq,
103      max_recvq,
104      max_channels,
# Line 166 | Line 163 | reset_block_state(void)
163   %token  CONNECTFREQ
164   %token  CYCLE_ON_HOST_CHANGE
165   %token  DEFAULT_FLOODCOUNT
166 + %token  DEFAULT_FLOODTIME
167   %token  DEFAULT_JOIN_FLOOD_COUNT
168   %token  DEFAULT_JOIN_FLOOD_TIME
169   %token  DEFAULT_MAX_CLIENTS
# Line 199 | Line 197 | reset_block_state(void)
197   %token  HOST
198   %token  HUB
199   %token  HUB_MASK
202 %token  IGNORE_BOGUS_TS
200   %token  INVISIBLE_ON_CONNECT
201   %token  INVITE_CLIENT_COUNT
202   %token  INVITE_CLIENT_TIME
203   %token  INVITE_DELAY_CHANNEL
204 + %token  INVITE_EXPIRE_TIME
205   %token  IP
206   %token  IRCD_AUTH
207   %token  IRCD_FLAGS
# Line 223 | Line 221 | reset_block_state(void)
221   %token  MASK
222   %token  MAX_ACCEPT
223   %token  MAX_BANS
224 + %token  MAX_BANS_LARGE
225   %token  MAX_CHANNELS
227 %token  MAX_GLOBAL
228 %token  MAX_IDENT
226   %token  MAX_IDLE
227 < %token  MAX_LOCAL
227 > %token  MAX_INVITES
228   %token  MAX_NICK_CHANGES
229   %token  MAX_NICK_LENGTH
230   %token  MAX_NICK_TIME
# Line 251 | Line 248 | reset_block_state(void)
248   %token  NO_TILDE
249   %token  NUMBER
250   %token  NUMBER_PER_CIDR
251 < %token  NUMBER_PER_IP
251 > %token  NUMBER_PER_IP_GLOBAL
252 > %token  NUMBER_PER_IP_LOCAL
253   %token  OPER_ONLY_UMODES
254   %token  OPER_UMODES
255   %token  OPERATOR
# Line 360 | Line 358 | reset_block_state(void)
358   %token  VHOST6
359   %token  WARN_NO_CONNECT_BLOCK
360   %token  WHOIS
361 + %token  WHOWAS_HISTORY_LENGTH
362   %token  XLINE
363   %token  XLINE_EXEMPT
364  
# Line 527 | Line 526 | serverinfo_name: NAME '=' QSTRING ';'
526    /* This isn't rehashable */
527    if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
528    {
529 <    if (valid_servname(yylval.string))
529 >    if (server_valid_name(yylval.string) == true)
530        ConfigServerInfo.name = xstrdup(yylval.string);
531      else
532      {
# Line 646 | Line 645 | serverinfo_default_max_clients: DEFAULT_
645    if (conf_parser_ctx.pass != 2)
646      break;
647  
648 <  if ($3 < MAXCLIENTS_MIN)
648 >  if ($3 < 1)
649    {
650 <    char buf[IRCD_BUFSIZE] = "";
651 <
653 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
654 <    conf_error_report(buf);
655 <    ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN;
650 >    conf_error_report("default_max_clients too low, setting to 1");
651 >    ConfigServerInfo.default_max_clients = 1;
652    }
653    else if ($3 > MAXCLIENTS_MAX)
654    {
655      char buf[IRCD_BUFSIZE] = "";
656  
657 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
657 >    snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX);
658      conf_error_report(buf);
659      ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
660    }
# Line 975 | Line 971 | oper_entry: OPERATOR
971    {
972      struct MaskItem *conf = NULL;
973      struct split_nuh_item nuh;
974 +    char *s = node->data;
975 +
976 +    if (EmptyString(s))
977 +      continue;
978  
979 <    nuh.nuhmask  = node->data;
979 >    nuh.nuhmask  = s;
980      nuh.nickptr  = NULL;
981      nuh.userptr  = block_state.user.buf;
982      nuh.hostptr  = block_state.host.buf;
# Line 1327 | Line 1327 | class_entry: CLASS
1327    if (!block_state.class.buf[0])
1328      break;
1329  
1330 <  if (!(class = class_find(block_state.class.buf, 0)))
1330 >  if (!(class = class_find(block_state.class.buf, false)))
1331      class = class_make();
1332  
1333    class->active = 1;
1334    xfree(class->name);
1335    class->name = xstrdup(block_state.class.buf);
1336    class->ping_freq = block_state.ping_freq.value;
1337 <  class->max_perip = block_state.max_perip.value;
1337 >  class->max_perip_local = block_state.max_perip_local.value;
1338 >  class->max_perip_global = block_state.max_perip_global.value;
1339    class->con_freq = block_state.con_freq.value;
1340    class->max_total = block_state.max_total.value;
1340  class->max_global = block_state.max_global.value;
1341  class->max_local = block_state.max_local.value;
1342  class->max_ident = block_state.max_ident.value;
1341    class->max_sendq = block_state.max_sendq.value;
1342    class->max_recvq = block_state.max_recvq.value;
1343    class->max_channels = block_state.max_channels.value;
# Line 1355 | Line 1353 | class_entry: CLASS
1353    class->min_idle = block_state.min_idle.value;
1354    class->max_idle = block_state.max_idle.value;
1355  
1356 <  rebuild_cidr_list(class);
1357 <
1356 >  int diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value ||
1357 >              class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value);
1358    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1359    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1360    class->number_per_cidr = block_state.number_per_cidr.value;
1361 +
1362 +  if (diff)
1363 +    class_ip_limit_rebuild(class);
1364   };
1365  
1366   class_items:    class_items class_item | class_item;
# Line 1368 | Line 1369 | class_item:     class_name |
1369                  class_cidr_bitlen_ipv6 |
1370                  class_ping_time |
1371                  class_number_per_cidr |
1372 <                class_number_per_ip |
1372 >                class_number_per_ip_local |
1373 >                class_number_per_ip_global |
1374                  class_connectfreq |
1375                  class_max_channels |
1376                  class_max_number |
1377 <                class_max_global |
1378 <                class_max_local |
1377 <                class_max_ident |
1378 <                class_sendq | class_recvq |
1377 >                class_sendq |
1378 >                class_recvq |
1379                  class_min_idle |
1380                  class_max_idle |
1381                  class_flags |
# Line 1393 | Line 1393 | class_ping_time: PING_TIME '=' timespec
1393      block_state.ping_freq.value = $3;
1394   };
1395  
1396 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1396 > class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1397   {
1398    if (conf_parser_ctx.pass == 1)
1399 <    block_state.max_perip.value = $3;
1399 >    block_state.max_perip_local.value = $3;
1400 > };
1401 >
1402 > class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1403 > {
1404 >  if (conf_parser_ctx.pass == 1)
1405 >    block_state.max_perip_global.value = $3;
1406   };
1407  
1408   class_connectfreq: CONNECTFREQ '=' timespec ';'
# Line 1417 | Line 1423 | class_max_number: MAX_NUMBER '=' NUMBER
1423      block_state.max_total.value = $3;
1424   };
1425  
1420 class_max_global: MAX_GLOBAL '=' NUMBER ';'
1421 {
1422  if (conf_parser_ctx.pass == 1)
1423    block_state.max_global.value = $3;
1424 };
1425
1426 class_max_local: MAX_LOCAL '=' NUMBER ';'
1427 {
1428  if (conf_parser_ctx.pass == 1)
1429    block_state.max_local.value = $3;
1430 };
1431
1432 class_max_ident: MAX_IDENT '=' NUMBER ';'
1433 {
1434  if (conf_parser_ctx.pass == 1)
1435    block_state.max_ident.value = $3;
1436 };
1437
1426   class_sendq: SENDQ '=' sizespec ';'
1427   {
1428    if (conf_parser_ctx.pass == 1)
# Line 1599 | Line 1587 | auth_entry: IRCD_AUTH
1587    {
1588      struct MaskItem *conf = NULL;
1589      struct split_nuh_item nuh;
1590 +    char *s = node->data;
1591 +
1592 +    if (EmptyString(s))
1593 +      continue;
1594  
1595 <    nuh.nuhmask  = node->data;
1595 >    nuh.nuhmask  = s;
1596      nuh.nickptr  = NULL;
1597      nuh.userptr  = block_state.user.buf;
1598      nuh.hostptr  = block_state.host.buf;
# Line 1763 | Line 1755 | resv_entry: RESV
1755    if (conf_parser_ctx.pass != 2)
1756      break;
1757  
1758 <  create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1758 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1759   };
1760  
1761   resv_items:     resv_items resv_item | resv_item;
# Line 1801 | Line 1793 | service_name: NAME '=' QSTRING ';'
1793    if (conf_parser_ctx.pass != 2)
1794      break;
1795  
1796 <  if (valid_servname(yylval.string))
1796 >  if (server_valid_name(yylval.string) == true)
1797    {
1798 <    struct MaskItem *conf = conf_make(CONF_SERVICE);
1799 <    conf->name = xstrdup(yylval.string);
1798 >    struct ServiceItem *service = service_make();
1799 >    service->name = xstrdup(yylval.string);
1800    }
1801   };
1802  
# Line 1825 | Line 1817 | shared_entry: T_SHARED
1817    block_state.flags.value = SHARED_ALL;
1818   } '{' shared_items '}' ';'
1819   {
1828  struct MaskItem *conf = NULL;
1829
1820    if (conf_parser_ctx.pass != 2)
1821      break;
1822  
1823 <  conf = conf_make(CONF_SHARED);
1824 <  conf->flags = block_state.flags.value;
1825 <  conf->name = xstrdup(block_state.name.buf);
1826 <  conf->user = xstrdup(block_state.user.buf);
1827 <  conf->host = xstrdup(block_state.host.buf);
1823 >  struct SharedItem *shared = shared_make();
1824 >  shared->type = block_state.flags.value;
1825 >  shared->server = xstrdup(block_state.name.buf);
1826 >  shared->user = xstrdup(block_state.user.buf);
1827 >  shared->host = xstrdup(block_state.host.buf);
1828   };
1829  
1830   shared_items: shared_items shared_item | shared_item;
# Line 1926 | Line 1916 | cluster_entry: T_CLUSTER
1916    reset_block_state();
1917  
1918    strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1919 <  block_state.flags.value = SHARED_ALL;
1919 >  block_state.flags.value = CLUSTER_ALL;
1920   } '{' cluster_items '}' ';'
1921   {
1932  struct MaskItem *conf = NULL;
1933
1922    if (conf_parser_ctx.pass != 2)
1923      break;
1924  
1925 <  conf = conf_make(CONF_CLUSTER);
1926 <  conf->flags = block_state.flags.value;
1927 <  conf->name = xstrdup(block_state.name.buf);
1925 >  struct ClusterItem *cluster = cluster_make();
1926 >  cluster->type = block_state.flags.value;
1927 >  cluster->server = xstrdup(block_state.name.buf);
1928   };
1929  
1930   cluster_items:  cluster_items cluster_item | cluster_item;
# Line 1958 | Line 1946 | cluster_types:  cluster_types ',' cluste
1946   cluster_type_item: KLINE
1947   {
1948    if (conf_parser_ctx.pass == 2)
1949 <    block_state.flags.value |= SHARED_KLINE;
1949 >    block_state.flags.value |= CLUSTER_KLINE;
1950   } | UNKLINE
1951   {
1952    if (conf_parser_ctx.pass == 2)
1953 <    block_state.flags.value |= SHARED_UNKLINE;
1953 >    block_state.flags.value |= CLUSTER_UNKLINE;
1954   } | T_DLINE
1955   {
1956    if (conf_parser_ctx.pass == 2)
1957 <    block_state.flags.value |= SHARED_DLINE;
1957 >    block_state.flags.value |= CLUSTER_DLINE;
1958   } | T_UNDLINE
1959   {
1960    if (conf_parser_ctx.pass == 2)
1961 <    block_state.flags.value |= SHARED_UNDLINE;
1961 >    block_state.flags.value |= CLUSTER_UNDLINE;
1962   } | XLINE
1963   {
1964    if (conf_parser_ctx.pass == 2)
1965 <    block_state.flags.value |= SHARED_XLINE;
1965 >    block_state.flags.value |= CLUSTER_XLINE;
1966   } | T_UNXLINE
1967   {
1968    if (conf_parser_ctx.pass == 2)
1969 <    block_state.flags.value |= SHARED_UNXLINE;
1969 >    block_state.flags.value |= CLUSTER_UNXLINE;
1970   } | RESV
1971   {
1972    if (conf_parser_ctx.pass == 2)
1973 <    block_state.flags.value |= SHARED_RESV;
1973 >    block_state.flags.value |= CLUSTER_RESV;
1974   } | T_UNRESV
1975   {
1976    if (conf_parser_ctx.pass == 2)
1977 <    block_state.flags.value |= SHARED_UNRESV;
1977 >    block_state.flags.value |= CLUSTER_UNRESV;
1978   } | T_LOCOPS
1979   {
1980    if (conf_parser_ctx.pass == 2)
1981 <    block_state.flags.value |= SHARED_LOCOPS;
1981 >    block_state.flags.value |= CLUSTER_LOCOPS;
1982   } | T_ALL
1983   {
1984    if (conf_parser_ctx.pass == 2)
1985 <    block_state.flags.value = SHARED_ALL;
1985 >    block_state.flags.value = CLUSTER_ALL;
1986   };
1987  
1988  
# Line 2349 | Line 2337 | gecos_entry: GECOS
2337      reset_block_state();
2338   } '{' gecos_items '}' ';'
2339   {
2352  struct MaskItem *conf = NULL;
2353
2340    if (conf_parser_ctx.pass != 2)
2341      break;
2342  
2343    if (!block_state.name.buf[0])
2344      break;
2345  
2346 <  conf = conf_make(CONF_XLINE);
2347 <  conf->name = xstrdup(block_state.name.buf);
2346 >  struct GecosItem *gecos = gecos_make();
2347 >  gecos->mask = xstrdup(block_state.name.buf);
2348  
2349    if (block_state.rpass.buf[0])
2350 <    conf->reason = xstrdup(block_state.rpass.buf);
2350 >    gecos->reason = xstrdup(block_state.rpass.buf);
2351    else
2352 <    conf->reason = xstrdup(CONF_NOREASON);
2352 >    gecos->reason = xstrdup(CONF_NOREASON);
2353   };
2354  
2355   gecos_items: gecos_items gecos_item | gecos_item;
# Line 2390 | Line 2376 | general_entry: GENERAL '{' general_items
2376   general_items:      general_items general_item | general_item;
2377   general_item:       general_away_count |
2378                      general_away_time |
2393                    general_ignore_bogus_ts |
2379                      general_failed_oper_notice |
2380                      general_anti_nick_flood |
2381                      general_max_nick_time |
2382                      general_max_nick_changes |
2383                      general_max_accept |
2384 +                    general_whowas_history_length |
2385                      general_anti_spam_exit_message_time |
2386                      general_ts_warn_delta |
2387                      general_ts_max_delta |
# Line 2419 | Line 2405 | general_item:       general_away_count |
2405                      general_caller_id_wait |
2406                      general_opers_bypass_callerid |
2407                      general_default_floodcount |
2408 +                    general_default_floodtime |
2409                      general_min_nonwildcard |
2410                      general_min_nonwildcard_simple |
2411                      general_throttle_count |
# Line 2451 | Line 2438 | general_max_watch: MAX_WATCH '=' NUMBER
2438    ConfigGeneral.max_watch = $3;
2439   };
2440  
2441 + general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2442 + {
2443 +  ConfigGeneral.whowas_history_length = $3;
2444 + };
2445 +
2446   general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2447   {
2448    if (conf_parser_ctx.pass == 2)
# Line 2487 | Line 2479 | general_kill_chase_time_limit: KILL_CHAS
2479    ConfigGeneral.kill_chase_time_limit = $3;
2480   };
2481  
2490 general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2491 {
2492  ConfigGeneral.ignore_bogus_ts = yylval.number;
2493 };
2494
2482   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2483   {
2484    ConfigGeneral.failed_oper_notice = yylval.number;
# Line 2801 | Line 2788 | general_default_floodcount: DEFAULT_FLOO
2788    ConfigGeneral.default_floodcount = $3;
2789   };
2790  
2791 + general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2792 + {
2793 +  ConfigGeneral.default_floodtime = $3;
2794 + };
2795 +
2796  
2797   /***************************************************************************
2798   * channel {} section
# Line 2809 | Line 2801 | channel_entry: CHANNEL '{' channel_items
2801  
2802   channel_items:      channel_items channel_item | channel_item;
2803   channel_item:       channel_max_bans |
2804 +                    channel_max_bans_large |
2805                      channel_invite_client_count |
2806                      channel_invite_client_time |
2807                      channel_invite_delay_channel |
2808 +                    channel_invite_expire_time |
2809                      channel_knock_client_count |
2810                      channel_knock_client_time |
2811                      channel_knock_delay_channel |
2812                      channel_max_channels |
2813 +                    channel_max_invites |
2814                      channel_default_join_flood_count |
2815                      channel_default_join_flood_time |
2816                      channel_disable_fake_channels |
# Line 2841 | Line 2836 | channel_invite_delay_channel: INVITE_DEL
2836    ConfigChannel.invite_delay_channel = $3;
2837   };
2838  
2839 + channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2840 + {
2841 +  ConfigChannel.invite_expire_time = $3;
2842 + };
2843 +
2844   channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2845   {
2846    ConfigChannel.knock_client_count = $3;
# Line 2861 | Line 2861 | channel_max_channels: MAX_CHANNELS '=' N
2861    ConfigChannel.max_channels = $3;
2862   };
2863  
2864 + channel_max_invites: MAX_INVITES '=' NUMBER ';'
2865 + {
2866 +  ConfigChannel.max_invites = $3;
2867 + };
2868 +
2869   channel_max_bans: MAX_BANS '=' NUMBER ';'
2870   {
2871    ConfigChannel.max_bans = $3;
2872   };
2873  
2874 + channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2875 + {
2876 +  ConfigChannel.max_bans_large = $3;
2877 + };
2878 +
2879   channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2880   {
2881    ConfigChannel.default_join_flood_count = yylval.number;

Comparing ircd-hybrid/trunk/src/conf_parser.y (property svn:keywords):
Revision 7121 by michael, Sun Jan 24 20:22:55 2016 UTC vs.
Revision 8792 by michael, Thu Jan 17 18:35:32 2019 UTC

# Line 1 | Line 1
1 < Id Revision
1 > Id

Diff Legend

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