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 7282 by michael, Sun Feb 7 18:04:26 2016 UTC vs.
Revision 9110 by michael, Sat Jan 4 15:17:42 2020 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-2020 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 31 | Line 31
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"
# Line 89 | Line 91 | static struct
91      size,
92      type,
93      port,
94 +    timeout,
95      aftype,
96      ping_freq,
97 <    max_perip,
97 >    max_perip_local,
98 >    max_perip_global,
99      con_freq,
100      min_idle,
101      max_idle,
102      max_total,
99    max_global,
100    max_local,
101    max_ident,
103      max_sendq,
104      max_recvq,
105      max_channels,
# Line 155 | Line 156 | reset_block_state(void)
156   %token  CALLER_ID_WAIT
157   %token  CAN_FLOOD
158   %token  CHANNEL
158 %token  CHECK_CACHE
159   %token  CIDR_BITLEN_IPV4
160   %token  CIDR_BITLEN_IPV6
161   %token  CLASS
# Line 164 | Line 164 | reset_block_state(void)
164   %token  CONNECTFREQ
165   %token  CYCLE_ON_HOST_CHANGE
166   %token  DEFAULT_FLOODCOUNT
167 + %token  DEFAULT_FLOODTIME
168   %token  DEFAULT_JOIN_FLOOD_COUNT
169   %token  DEFAULT_JOIN_FLOOD_TIME
170   %token  DEFAULT_MAX_CLIENTS
# Line 180 | Line 181 | reset_block_state(void)
181   %token  ENCRYPTED
182   %token  EXCEED_LIMIT
183   %token  EXEMPT
184 + %token  EXPIRATION
185   %token  FAILED_OPER_NOTICE
186   %token  FLATTEN_LINKS
187   %token  FLATTEN_LINKS_DELAY
# Line 197 | Line 199 | reset_block_state(void)
199   %token  HOST
200   %token  HUB
201   %token  HUB_MASK
200 %token  IGNORE_BOGUS_TS
202   %token  INVISIBLE_ON_CONNECT
203   %token  INVITE_CLIENT_COUNT
204   %token  INVITE_CLIENT_TIME
205   %token  INVITE_DELAY_CHANNEL
206 + %token  INVITE_EXPIRE_TIME
207   %token  IP
208   %token  IRCD_AUTH
209   %token  IRCD_FLAGS
# Line 217 | Line 219 | reset_block_state(void)
219   %token  KNOCK_CLIENT_TIME
220   %token  KNOCK_DELAY_CHANNEL
221   %token  LEAF_MASK
220 %token  LIBGEOIP_DATABASE_OPTIONS
221 %token  LIBGEOIP_IPV4_DATABASE_FILE
222 %token  LIBGEOIP_IPV6_DATABASE_FILE
222   %token  LISTEN
223   %token  MASK
224   %token  MAX_ACCEPT
225   %token  MAX_BANS
226 + %token  MAX_BANS_LARGE
227   %token  MAX_CHANNELS
228 %token  MAX_GLOBAL
229 %token  MAX_IDENT
228   %token  MAX_IDLE
229 < %token  MAX_LOCAL
229 > %token  MAX_INVITES
230   %token  MAX_NICK_CHANGES
231   %token  MAX_NICK_LENGTH
232   %token  MAX_NICK_TIME
# Line 236 | Line 234 | reset_block_state(void)
234   %token  MAX_TARGETS
235   %token  MAX_TOPIC_LENGTH
236   %token  MAX_WATCH
239 %token  MEMORY_CACHE
237   %token  MIN_IDLE
238   %token  MIN_NONWILDCARD
239   %token  MIN_NONWILDCARD_SIMPLE
243 %token  MMAP_CACHE
240   %token  MODULE
241   %token  MODULES
242   %token  MOTD
# Line 254 | Line 250 | reset_block_state(void)
250   %token  NO_TILDE
251   %token  NUMBER
252   %token  NUMBER_PER_CIDR
253 < %token  NUMBER_PER_IP
253 > %token  NUMBER_PER_IP_GLOBAL
254 > %token  NUMBER_PER_IP_LOCAL
255   %token  OPER_ONLY_UMODES
256   %token  OPER_UMODES
257   %token  OPERATOR
# Line 292 | Line 289 | reset_block_state(void)
289   %token  SSL_DH_ELLIPTIC_CURVE
290   %token  SSL_DH_PARAM_FILE
291   %token  SSL_MESSAGE_DIGEST_ALGORITHM
295 %token  STANDARD
292   %token  STATS_E_DISABLED
293   %token  STATS_I_OPER_ONLY
294   %token  STATS_K_OPER_ONLY
# Line 301 | Line 297 | reset_block_state(void)
297   %token  STATS_P_OPER_ONLY
298   %token  STATS_U_OPER_ONLY
299   %token  T_ALL
300 + %token  T_BIND
301   %token  T_BOTS
302   %token  T_CALLERID
303   %token  T_CCONN
# Line 351 | Line 348 | reset_block_state(void)
348   %token  TBOOL
349   %token  THROTTLE_COUNT
350   %token  THROTTLE_TIME
351 < %token  TKLINE_EXPIRE_NOTICES
351 > %token  TIMEOUT
352   %token  TMASKED
353   %token  TS_MAX_DELTA
354   %token  TS_WARN_DELTA
# Line 364 | Line 361 | reset_block_state(void)
361   %token  VHOST6
362   %token  WARN_NO_CONNECT_BLOCK
363   %token  WHOIS
364 + %token  WHOWAS_HISTORY_LENGTH
365   %token  XLINE
366   %token  XLINE_EXEMPT
367  
# Line 453 | Line 451 | serverinfo_entry: SERVERINFO '{' serveri
451  
452   serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
453   serverinfo_item:        serverinfo_name |
456                        serverinfo_vhost |
454                          serverinfo_hub |
455                          serverinfo_description |
456                          serverinfo_network_name |
# Line 464 | Line 461 | serverinfo_item:        serverinfo_name
461                          serverinfo_ssl_dh_param_file |
462                          serverinfo_ssl_dh_elliptic_curve |
463                          serverinfo_rsa_private_key_file |
467                        serverinfo_vhost6 |
464                          serverinfo_sid |
465                          serverinfo_ssl_certificate_file |
466                          serverinfo_ssl_cipher_list |
467                          serverinfo_ssl_message_digest_algorithm |
472                        serverinfo_libgeoip_database_options |
473                        serverinfo_libgeoip_ipv4_database_file |
474                        serverinfo_libgeoip_ipv6_database_file |
468                          error ';' ;
469  
470  
# Line 529 | Line 522 | serverinfo_ssl_dh_elliptic_curve: SSL_DH
522    }
523   };
524  
532 serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS
533 {
534  if (conf_parser_ctx.pass == 1)
535    ConfigServerInfo.libgeoip_database_options = 0;
536 } '='  options_items ';';
537
538 options_items: options_items ',' options_item | options_item;
539 options_item: STANDARD
540 {
541 #ifdef HAVE_LIBGEOIP
542  if (conf_parser_ctx.pass == 1)
543    ConfigServerInfo.libgeoip_database_options |= GEOIP_STANDARD;
544 #endif
545 } | MEMORY_CACHE
546 {
547 #ifdef HAVE_LIBGEOIP
548  if (conf_parser_ctx.pass == 1)
549    ConfigServerInfo.libgeoip_database_options |= GEOIP_MEMORY_CACHE;
550 #endif
551 } | MMAP_CACHE
552 {
553 #ifdef HAVE_LIBGEOIP
554  if (conf_parser_ctx.pass == 1)
555    ConfigServerInfo.libgeoip_database_options |= GEOIP_MMAP_CACHE;
556 #endif
557 } | CHECK_CACHE
558 {
559 #ifdef HAVE_LIBGEOIP
560  if (conf_parser_ctx.pass == 1)
561    ConfigServerInfo.libgeoip_database_options |= GEOIP_CHECK_CACHE;
562 #endif
563 };
564
565 serverinfo_libgeoip_ipv4_database_file:  LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';'
566 {
567  if (conf_parser_ctx.pass == 2)
568  {
569    xfree(ConfigServerInfo.libgeoip_ipv4_database_file);
570    ConfigServerInfo.libgeoip_ipv4_database_file = xstrdup(yylval.string);
571
572 #ifdef HAVE_LIBGEOIP
573    if (GeoIPv4_ctx)
574      GeoIP_delete(GeoIPv4_ctx);
575    GeoIPv4_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
576 #endif
577  }
578 };
579
580 serverinfo_libgeoip_ipv6_database_file:  LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';'
581 {
582  if (conf_parser_ctx.pass == 2)
583  {
584    xfree(ConfigServerInfo.libgeoip_ipv6_database_file);
585    ConfigServerInfo.libgeoip_ipv6_database_file = xstrdup(yylval.string);
586
587 #ifdef HAVE_LIBGEOIP
588    if (GeoIPv6_ctx)
589      GeoIP_delete(GeoIPv6_ctx);
590    GeoIPv6_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
591 #endif
592  }
593 };
594
525   serverinfo_name: NAME '=' QSTRING ';'
526   {
527    /* This isn't rehashable */
528 <  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
528 >  if (conf_parser_ctx.pass == 2 && ConfigServerInfo.name == NULL)
529    {
530 <    if (valid_servname(yylval.string))
530 >    if (server_valid_name(yylval.string) == true)
531        ConfigServerInfo.name = xstrdup(yylval.string);
532      else
533      {
# Line 610 | Line 540 | serverinfo_name: NAME '=' QSTRING ';'
540   serverinfo_sid: IRCD_SID '=' QSTRING ';'
541   {
542    /* This isn't rehashable */
543 <  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
543 >  if (conf_parser_ctx.pass == 2 && ConfigServerInfo.sid == NULL)
544    {
545      if (valid_sid(yylval.string))
546        ConfigServerInfo.sid = xstrdup(yylval.string);
# Line 655 | Line 585 | serverinfo_network_desc: NETWORK_DESC '=
585    ConfigServerInfo.network_desc = xstrdup(yylval.string);
586   };
587  
658 serverinfo_vhost: VHOST '=' QSTRING ';'
659 {
660  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
661  {
662    struct addrinfo hints, *res;
663
664    memset(&hints, 0, sizeof(hints));
665
666    hints.ai_family   = AF_UNSPEC;
667    hints.ai_socktype = SOCK_STREAM;
668    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
669
670    if (getaddrinfo(yylval.string, NULL, &hints, &res))
671      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
672    else
673    {
674      assert(res);
675
676      memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen);
677      ConfigServerInfo.ip.ss.ss_family = res->ai_family;
678      ConfigServerInfo.ip.ss_len = res->ai_addrlen;
679      freeaddrinfo(res);
680
681      ConfigServerInfo.specific_ipv4_vhost = 1;
682    }
683  }
684 };
685
686 serverinfo_vhost6: VHOST6 '=' QSTRING ';'
687 {
688  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
689  {
690    struct addrinfo hints, *res;
691
692    memset(&hints, 0, sizeof(hints));
693
694    hints.ai_family   = AF_UNSPEC;
695    hints.ai_socktype = SOCK_STREAM;
696    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
697
698    if (getaddrinfo(yylval.string, NULL, &hints, &res))
699      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
700    else
701    {
702      assert(res);
703
704      memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen);
705      ConfigServerInfo.ip6.ss.ss_family = res->ai_family;
706      ConfigServerInfo.ip6.ss_len = res->ai_addrlen;
707      freeaddrinfo(res);
708
709      ConfigServerInfo.specific_ipv6_vhost = 1;
710    }
711  }
712 };
713
588   serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
589   {
590    if (conf_parser_ctx.pass != 2)
591      break;
592  
593 <  if ($3 < MAXCLIENTS_MIN)
593 >  if ($3 < 1)
594    {
595 <    char buf[IRCD_BUFSIZE] = "";
596 <
723 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
724 <    conf_error_report(buf);
725 <    ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN;
595 >    conf_error_report("default_max_clients too low, setting to 1");
596 >    ConfigServerInfo.default_max_clients = 1;
597    }
598    else if ($3 > MAXCLIENTS_MAX)
599    {
600      char buf[IRCD_BUFSIZE] = "";
601  
602 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
602 >    snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX);
603      conf_error_report(buf);
604 +
605      ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
606    }
607    else
# Line 752 | Line 624 | serverinfo_max_nick_length: MAX_NICK_LEN
624  
625      snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN);
626      conf_error_report(buf);
627 +
628      ConfigServerInfo.max_nick_length = NICKLEN;
629    }
630    else
# Line 774 | Line 647 | serverinfo_max_topic_length: MAX_TOPIC_L
647  
648      snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN);
649      conf_error_report(buf);
650 +
651      ConfigServerInfo.max_topic_length = TOPICLEN;
652    }
653    else
# Line 790 | Line 664 | serverinfo_hub: HUB '=' TBOOL ';'
664   /***************************************************************************
665   * admin {} section
666   ***************************************************************************/
667 < admin_entry: ADMIN  '{' admin_items '}' ';' ;
667 > admin_entry: ADMIN '{' admin_items '}' ';' ;
668  
669   admin_items: admin_items admin_item | admin_item;
670   admin_item:  admin_name |
# Line 1043 | Line 917 | oper_entry: OPERATOR
917  
918    DLINK_FOREACH(node, block_state.mask.list.head)
919    {
1046    struct MaskItem *conf = NULL;
920      struct split_nuh_item nuh;
921 +    char *s = node->data;
922 +
923 +    if (EmptyString(s))
924 +      continue;
925  
926 <    nuh.nuhmask  = node->data;
926 >    nuh.nuhmask  = s;
927      nuh.nickptr  = NULL;
928      nuh.userptr  = block_state.user.buf;
929      nuh.hostptr  = block_state.host.buf;
930 +
931      nuh.nicksize = 0;
932      nuh.usersize = sizeof(block_state.user.buf);
933      nuh.hostsize = sizeof(block_state.host.buf);
934 +
935      split_nuh(&nuh);
936  
937 <    conf         = conf_make(CONF_OPER);
938 <    conf->name   = xstrdup(block_state.name.buf);
939 <    conf->user   = xstrdup(block_state.user.buf);
940 <    conf->host   = xstrdup(block_state.host.buf);
937 >    struct MaskItem *conf = conf_make(CONF_OPER);
938 >    conf->addr = xcalloc(sizeof(*conf->addr));
939 >    conf->name = xstrdup(block_state.name.buf);
940 >    conf->user = xstrdup(block_state.user.buf);
941 >    conf->host = xstrdup(block_state.host.buf);
942  
943      if (block_state.cert.buf[0])
944        conf->certfp = xstrdup(block_state.cert.buf);
# Line 1072 | Line 952 | oper_entry: OPERATOR
952      conf->flags = block_state.flags.value;
953      conf->modes = block_state.modes.value;
954      conf->port  = block_state.port.value;
955 <    conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
955 >    conf->htype = parse_netmask(conf->host, conf->addr, &conf->bits);
956  
957      conf_add_class_to_conf(conf, block_state.class.buf);
958    }
# Line 1244 | Line 1124 | oper_umodes_item:  T_BOTS
1124   {
1125    if (conf_parser_ctx.pass == 2)
1126      block_state.modes.value |= UMODE_FARCONNECT;
1127 + } | EXPIRATION
1128 + {
1129 +  if (conf_parser_ctx.pass == 2)
1130 +    block_state.modes.value |= UMODE_EXPIRATION;
1131   };
1132  
1133   oper_flags: IRCD_FLAGS
# Line 1389 | Line 1273 | class_entry: CLASS
1273    block_state.max_recvq.value = DEFAULT_RECVQ;
1274   } '{' class_items '}' ';'
1275   {
1392  struct ClassItem *class = NULL;
1393
1276    if (conf_parser_ctx.pass != 1)
1277      break;
1278  
1279    if (!block_state.class.buf[0])
1280      break;
1281  
1282 <  if (!(class = class_find(block_state.class.buf, 0)))
1282 >  struct ClassItem *class = class_find(block_state.class.buf, false);
1283 >  if (class == NULL)
1284      class = class_make();
1285  
1286 <  class->active = 1;
1286 >  class->active = true;
1287    xfree(class->name);
1288    class->name = xstrdup(block_state.class.buf);
1289    class->ping_freq = block_state.ping_freq.value;
1290 <  class->max_perip = block_state.max_perip.value;
1290 >  class->max_perip_local = block_state.max_perip_local.value;
1291 >  class->max_perip_global = block_state.max_perip_global.value;
1292    class->con_freq = block_state.con_freq.value;
1293    class->max_total = block_state.max_total.value;
1410  class->max_global = block_state.max_global.value;
1411  class->max_local = block_state.max_local.value;
1412  class->max_ident = block_state.max_ident.value;
1294    class->max_sendq = block_state.max_sendq.value;
1295    class->max_recvq = block_state.max_recvq.value;
1296    class->max_channels = block_state.max_channels.value;
# Line 1425 | Line 1306 | class_entry: CLASS
1306    class->min_idle = block_state.min_idle.value;
1307    class->max_idle = block_state.max_idle.value;
1308  
1309 <  rebuild_cidr_list(class);
1310 <
1309 >  bool diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value ||
1310 >               class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value);
1311    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1312    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1313    class->number_per_cidr = block_state.number_per_cidr.value;
1314 +
1315 +  if (diff)
1316 +    class_ip_limit_rebuild(class);
1317   };
1318  
1319   class_items:    class_items class_item | class_item;
# Line 1438 | Line 1322 | class_item:     class_name |
1322                  class_cidr_bitlen_ipv6 |
1323                  class_ping_time |
1324                  class_number_per_cidr |
1325 <                class_number_per_ip |
1325 >                class_number_per_ip_local |
1326 >                class_number_per_ip_global |
1327                  class_connectfreq |
1328                  class_max_channels |
1329                  class_max_number |
1330 <                class_max_global |
1331 <                class_max_local |
1447 <                class_max_ident |
1448 <                class_sendq | class_recvq |
1330 >                class_sendq |
1331 >                class_recvq |
1332                  class_min_idle |
1333                  class_max_idle |
1334                  class_flags |
# Line 1463 | Line 1346 | class_ping_time: PING_TIME '=' timespec
1346      block_state.ping_freq.value = $3;
1347   };
1348  
1349 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1349 > class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1350 > {
1351 >  if (conf_parser_ctx.pass == 1)
1352 >    block_state.max_perip_local.value = $3;
1353 > };
1354 >
1355 > class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1356   {
1357    if (conf_parser_ctx.pass == 1)
1358 <    block_state.max_perip.value = $3;
1358 >    block_state.max_perip_global.value = $3;
1359   };
1360  
1361   class_connectfreq: CONNECTFREQ '=' timespec ';'
# Line 1487 | Line 1376 | class_max_number: MAX_NUMBER '=' NUMBER
1376      block_state.max_total.value = $3;
1377   };
1378  
1490 class_max_global: MAX_GLOBAL '=' NUMBER ';'
1491 {
1492  if (conf_parser_ctx.pass == 1)
1493    block_state.max_global.value = $3;
1494 };
1495
1496 class_max_local: MAX_LOCAL '=' NUMBER ';'
1497 {
1498  if (conf_parser_ctx.pass == 1)
1499    block_state.max_local.value = $3;
1500 };
1501
1502 class_max_ident: MAX_IDENT '=' NUMBER ';'
1503 {
1504  if (conf_parser_ctx.pass == 1)
1505    block_state.max_ident.value = $3;
1506 };
1507
1379   class_sendq: SENDQ '=' sizespec ';'
1380   {
1381    if (conf_parser_ctx.pass == 1)
# Line 1667 | Line 1538 | auth_entry: IRCD_AUTH
1538  
1539    DLINK_FOREACH(node, block_state.mask.list.head)
1540    {
1670    struct MaskItem *conf = NULL;
1541      struct split_nuh_item nuh;
1542 +    char *s = node->data;
1543  
1544 <    nuh.nuhmask  = node->data;
1544 >    if (EmptyString(s))
1545 >      continue;
1546 >
1547 >    nuh.nuhmask  = s;
1548      nuh.nickptr  = NULL;
1549      nuh.userptr  = block_state.user.buf;
1550      nuh.hostptr  = block_state.host.buf;
1551 +
1552      nuh.nicksize = 0;
1553      nuh.usersize = sizeof(block_state.user.buf);
1554      nuh.hostsize = sizeof(block_state.host.buf);
1555 +
1556      split_nuh(&nuh);
1557  
1558 <    conf        = conf_make(CONF_CLIENT);
1559 <    conf->user  = xstrdup(block_state.user.buf);
1560 <    conf->host  = xstrdup(block_state.host.buf);
1558 >    struct MaskItem *conf = conf_make(CONF_CLIENT);
1559 >    conf->user = xstrdup(block_state.user.buf);
1560 >    conf->host = xstrdup(block_state.host.buf);
1561  
1562      if (block_state.rpass.buf[0])
1563        conf->passwd = xstrdup(block_state.rpass.buf);
# Line 1740 | Line 1616 | auth_flags: IRCD_FLAGS
1616   {
1617    if (conf_parser_ctx.pass == 2)
1618      block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1619 < } '='  auth_flags_items ';';
1619 > } '=' auth_flags_items ';';
1620  
1621   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1622   auth_flags_item: SPOOF_NOTICE
# Line 1871 | Line 1747 | service_name: NAME '=' QSTRING ';'
1747    if (conf_parser_ctx.pass != 2)
1748      break;
1749  
1750 <  if (valid_servname(yylval.string))
1750 >  if (server_valid_name(yylval.string) == true)
1751    {
1752      struct ServiceItem *service = service_make();
1753      service->name = xstrdup(yylval.string);
# Line 2076 | Line 1952 | connect_entry: CONNECT
1952    reset_block_state();
1953    block_state.aftype.value = AF_INET;
1954    block_state.port.value = PORTNUM;
1955 +  block_state.timeout.value = CONNECTTIMEOUT;
1956   } '{' connect_items '}' ';'
1957   {
2081  struct MaskItem *conf = NULL;
1958    struct addrinfo hints, *res;
1959  
1960    if (conf_parser_ctx.pass != 2)
# Line 2092 | Line 1968 | connect_entry: CONNECT
1968        !block_state.spass.buf[0])
1969      break;
1970  
1971 +  if (server_valid_name(block_state.name.buf) == false)
1972 +    break;
1973 +
1974    if (has_wildcards(block_state.name.buf) ||
1975        has_wildcards(block_state.host.buf))
1976      break;
1977  
1978 <  conf = conf_make(CONF_SERVER);
1978 >  struct MaskItem *conf = conf_make(CONF_SERVER);
1979 >  conf->addr = xcalloc(sizeof(*conf->addr));
1980    conf->port = block_state.port.value;
1981 +  conf->timeout = block_state.timeout.value;
1982    conf->flags = block_state.flags.value;
1983    conf->aftype = block_state.aftype.value;
1984    conf->host = xstrdup(block_state.host.buf);
# Line 2123 | Line 2004 | connect_entry: CONNECT
2004      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2005  
2006      if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2007 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2007 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server bind(%s)", block_state.bind.buf);
2008      else
2009      {
2010        assert(res);
2011  
2012 <      memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2013 <      conf->bind.ss.ss_family = res->ai_family;
2014 <      conf->bind.ss_len = res->ai_addrlen;
2012 >      conf->bind = xcalloc(sizeof(*conf->bind));
2013 >
2014 >      memcpy(conf->bind, res->ai_addr, res->ai_addrlen);
2015 >      conf->bind->ss_len = res->ai_addrlen;
2016        freeaddrinfo(res);
2017      }
2018    }
2019  
2020    conf_add_class_to_conf(conf, block_state.class.buf);
2021 <  lookup_confhost(conf);
2021 >  conf_resolve_host(conf);
2022   };
2023  
2024   connect_items:  connect_items connect_item | connect_item;
2025   connect_item:   connect_name |
2026                  connect_host |
2027 <                connect_vhost |
2027 >                connect_timeout |
2028 >                connect_bind |
2029                  connect_send_password |
2030                  connect_accept_password |
2031                  connect_ssl_certificate_fingerprint |
# Line 2168 | Line 2051 | connect_host: HOST '=' QSTRING ';'
2051      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2052   };
2053  
2054 < connect_vhost: VHOST '=' QSTRING ';'
2054 > connect_timeout: TIMEOUT '=' timespec ';'
2055 > {
2056 >  if (conf_parser_ctx.pass == 2)
2057 >    block_state.timeout.value = $3;
2058 > };
2059 >
2060 > connect_bind: T_BIND '=' QSTRING ';'
2061   {
2062    if (conf_parser_ctx.pass == 2)
2063      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
# Line 2179 | Line 2068 | connect_send_password: SEND_PASSWORD '='
2068    if (conf_parser_ctx.pass != 2)
2069      break;
2070  
2071 <  if ($3[0] == ':')
2071 >  if (*yylval.string == ':')
2072      conf_error_report("Server passwords cannot begin with a colon");
2073 <  else if (strchr($3, ' '))
2073 >  else if (strchr(yylval.string, ' '))
2074      conf_error_report("Server passwords cannot contain spaces");
2075    else
2076      strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
# Line 2192 | Line 2081 | connect_accept_password: ACCEPT_PASSWORD
2081    if (conf_parser_ctx.pass != 2)
2082      break;
2083  
2084 <  if ($3[0] == ':')
2084 >  if (*yylval.string == ':')
2085      conf_error_report("Server passwords cannot begin with a colon");
2086 <  else if (strchr($3, ' '))
2086 >  else if (strchr(yylval.string, ' '))
2087      conf_error_report("Server passwords cannot contain spaces");
2088    else
2089      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2225 | Line 2114 | connect_aftype: AFTYPE '=' T_IPV4 ';'
2114   connect_flags: IRCD_FLAGS
2115   {
2116    block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2117 < } '='  connect_flags_items ';';
2117 > } '=' connect_flags_items ';';
2118  
2119   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2120   connect_flags_item: AUTOCONN
# Line 2288 | Line 2177 | kill_entry: KILL
2177      reset_block_state();
2178   } '{' kill_items '}' ';'
2179   {
2291  struct MaskItem *conf = NULL;
2292
2180    if (conf_parser_ctx.pass != 2)
2181      break;
2182  
# Line 2297 | Line 2184 | kill_entry: KILL
2184        !block_state.host.buf[0])
2185      break;
2186  
2187 <  conf = conf_make(CONF_KLINE);
2187 >  struct MaskItem *conf = conf_make(CONF_KLINE);
2188    conf->user = xstrdup(block_state.user.buf);
2189    conf->host = xstrdup(block_state.host.buf);
2190  
# Line 2347 | Line 2234 | deny_entry: DENY
2234      reset_block_state();
2235   } '{' deny_items '}' ';'
2236   {
2350  struct MaskItem *conf = NULL;
2351
2237    if (conf_parser_ctx.pass != 2)
2238      break;
2239  
# Line 2357 | Line 2242 | deny_entry: DENY
2242  
2243    if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2244    {
2245 <    conf = conf_make(CONF_DLINE);
2245 >    struct MaskItem *conf = conf_make(CONF_DLINE);
2246      conf->host = xstrdup(block_state.addr.buf);
2247  
2248      if (block_state.rpass.buf[0])
# Line 2415 | Line 2300 | gecos_entry: GECOS
2300      reset_block_state();
2301   } '{' gecos_items '}' ';'
2302   {
2418  struct MaskItem *conf = NULL;
2419
2303    if (conf_parser_ctx.pass != 2)
2304      break;
2305  
2306    if (!block_state.name.buf[0])
2307      break;
2308  
2309 <  conf = conf_make(CONF_XLINE);
2310 <  conf->name = xstrdup(block_state.name.buf);
2309 >  struct GecosItem *gecos = gecos_make();
2310 >  gecos->mask = xstrdup(block_state.name.buf);
2311  
2312    if (block_state.rpass.buf[0])
2313 <    conf->reason = xstrdup(block_state.rpass.buf);
2313 >    gecos->reason = xstrdup(block_state.rpass.buf);
2314    else
2315 <    conf->reason = xstrdup(CONF_NOREASON);
2315 >    gecos->reason = xstrdup(CONF_NOREASON);
2316   };
2317  
2318   gecos_items: gecos_items gecos_item | gecos_item;
# Line 2456 | Line 2339 | general_entry: GENERAL '{' general_items
2339   general_items:      general_items general_item | general_item;
2340   general_item:       general_away_count |
2341                      general_away_time |
2459                    general_ignore_bogus_ts |
2342                      general_failed_oper_notice |
2343                      general_anti_nick_flood |
2344                      general_max_nick_time |
2345                      general_max_nick_changes |
2346                      general_max_accept |
2347 +                    general_whowas_history_length |
2348                      general_anti_spam_exit_message_time |
2349                      general_ts_warn_delta |
2350                      general_ts_max_delta |
# Line 2485 | Line 2368 | general_item:       general_away_count |
2368                      general_caller_id_wait |
2369                      general_opers_bypass_callerid |
2370                      general_default_floodcount |
2371 +                    general_default_floodtime |
2372                      general_min_nonwildcard |
2373                      general_min_nonwildcard_simple |
2374                      general_throttle_count |
2375                      general_throttle_time |
2376                      general_ping_cookie |
2377                      general_disable_auth |
2494                    general_tkline_expire_notices |
2378                      general_dline_min_cidr |
2379                      general_dline_min_cidr6 |
2380                      general_kline_min_cidr |
# Line 2517 | Line 2400 | general_max_watch: MAX_WATCH '=' NUMBER
2400    ConfigGeneral.max_watch = $3;
2401   };
2402  
2403 + general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2404 + {
2405 +  ConfigGeneral.whowas_history_length = $3;
2406 + };
2407 +
2408   general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2409   {
2410 <  if (conf_parser_ctx.pass == 2)
2523 <    ConfigGeneral.cycle_on_host_change = yylval.number;
2410 >  ConfigGeneral.cycle_on_host_change = yylval.number;
2411   };
2412  
2413   general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
# Line 2543 | Line 2430 | general_kline_min_cidr6: KLINE_MIN_CIDR6
2430    ConfigGeneral.kline_min_cidr6 = $3;
2431   };
2432  
2546 general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2547 {
2548  ConfigGeneral.tkline_expire_notices = yylval.number;
2549 };
2550
2433   general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2434   {
2435    ConfigGeneral.kill_chase_time_limit = $3;
2436   };
2437  
2556 general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2557 {
2558  ConfigGeneral.ignore_bogus_ts = yylval.number;
2559 };
2560
2438   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2439   {
2440    ConfigGeneral.failed_oper_notice = yylval.number;
# Line 2595 | Line 2472 | general_ts_warn_delta: TS_WARN_DELTA '='
2472  
2473   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2474   {
2475 <  if (conf_parser_ctx.pass == 2)
2599 <    ConfigGeneral.ts_max_delta = $3;
2475 >  ConfigGeneral.ts_max_delta = $3;
2476   };
2477  
2478   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
# Line 2713 | Line 2589 | general_throttle_time: THROTTLE_TIME '='
2589   general_oper_umodes: OPER_UMODES
2590   {
2591    ConfigGeneral.oper_umodes = 0;
2592 < } '='  umode_oitems ';' ;
2592 > } '=' umode_oitems ';' ;
2593  
2594   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2595   umode_oitem:     T_BOTS
# Line 2782 | Line 2658 | umode_oitem:     T_BOTS
2658   } | T_FARCONNECT
2659   {
2660    ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2661 + } | EXPIRATION
2662 + {
2663 +  ConfigGeneral.oper_umodes |= UMODE_EXPIRATION;
2664   };
2665  
2666   general_oper_only_umodes: OPER_ONLY_UMODES
2667   {
2668    ConfigGeneral.oper_only_umodes = 0;
2669 < } '='  umode_items ';' ;
2669 > } '=' umode_items ';' ;
2670  
2671   umode_items:  umode_items ',' umode_item | umode_item;
2672   umode_item:   T_BOTS
# Line 2850 | Line 2729 | umode_item:   T_BOTS
2729   } | T_FARCONNECT
2730   {
2731    ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2732 + } | EXPIRATION
2733 + {
2734 +  ConfigGeneral.oper_only_umodes |= UMODE_EXPIRATION;
2735   };
2736  
2737   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
# Line 2867 | Line 2749 | general_default_floodcount: DEFAULT_FLOO
2749    ConfigGeneral.default_floodcount = $3;
2750   };
2751  
2752 + general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2753 + {
2754 +  ConfigGeneral.default_floodtime = $3;
2755 + };
2756 +
2757  
2758   /***************************************************************************
2759   * channel {} section
# Line 2875 | Line 2762 | channel_entry: CHANNEL '{' channel_items
2762  
2763   channel_items:      channel_items channel_item | channel_item;
2764   channel_item:       channel_max_bans |
2765 +                    channel_max_bans_large |
2766                      channel_invite_client_count |
2767                      channel_invite_client_time |
2768                      channel_invite_delay_channel |
2769 +                    channel_invite_expire_time |
2770                      channel_knock_client_count |
2771                      channel_knock_client_time |
2772                      channel_knock_delay_channel |
2773                      channel_max_channels |
2774 +                    channel_max_invites |
2775                      channel_default_join_flood_count |
2776                      channel_default_join_flood_time |
2777                      channel_disable_fake_channels |
# Line 2907 | Line 2797 | channel_invite_delay_channel: INVITE_DEL
2797    ConfigChannel.invite_delay_channel = $3;
2798   };
2799  
2800 + channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2801 + {
2802 +  ConfigChannel.invite_expire_time = $3;
2803 + };
2804 +
2805   channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2806   {
2807    ConfigChannel.knock_client_count = $3;
# Line 2927 | Line 2822 | channel_max_channels: MAX_CHANNELS '=' N
2822    ConfigChannel.max_channels = $3;
2823   };
2824  
2825 + channel_max_invites: MAX_INVITES '=' NUMBER ';'
2826 + {
2827 +  ConfigChannel.max_invites = $3;
2828 + };
2829 +
2830   channel_max_bans: MAX_BANS '=' NUMBER ';'
2831   {
2832    ConfigChannel.max_bans = $3;
2833   };
2834  
2835 + channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2836 + {
2837 +  ConfigChannel.max_bans_large = $3;
2838 + };
2839 +
2840   channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2841   {
2842    ConfigChannel.default_join_flood_count = yylval.number;

Comparing ircd-hybrid/trunk/src/conf_parser.y (property svn:keywords):
Revision 7282 by michael, Sun Feb 7 18:04:26 2016 UTC vs.
Revision 9110 by michael, Sat Jan 4 15:17:42 2020 UTC

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

Diff Legend

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