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 8963 by michael, Sat May 11 21:06:49 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 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 91 | 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,
99    max_global,
100    max_local,
101    max_ident,
102      max_sendq,
103      max_recvq,
104      max_channels,
# Line 155 | Line 155 | reset_block_state(void)
155   %token  CALLER_ID_WAIT
156   %token  CAN_FLOOD
157   %token  CHANNEL
158 %token  CHECK_CACHE
158   %token  CIDR_BITLEN_IPV4
159   %token  CIDR_BITLEN_IPV6
160   %token  CLASS
# Line 164 | 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 180 | Line 180 | reset_block_state(void)
180   %token  ENCRYPTED
181   %token  EXCEED_LIMIT
182   %token  EXEMPT
183 + %token  EXPIRATION
184   %token  FAILED_OPER_NOTICE
185   %token  FLATTEN_LINKS
186   %token  FLATTEN_LINKS_DELAY
# Line 197 | Line 198 | reset_block_state(void)
198   %token  HOST
199   %token  HUB
200   %token  HUB_MASK
200 %token  IGNORE_BOGUS_TS
201   %token  INVISIBLE_ON_CONNECT
202   %token  INVITE_CLIENT_COUNT
203   %token  INVITE_CLIENT_TIME
204   %token  INVITE_DELAY_CHANNEL
205 + %token  INVITE_EXPIRE_TIME
206   %token  IP
207   %token  IRCD_AUTH
208   %token  IRCD_FLAGS
# Line 217 | Line 218 | reset_block_state(void)
218   %token  KNOCK_CLIENT_TIME
219   %token  KNOCK_DELAY_CHANNEL
220   %token  LEAF_MASK
220 %token  LIBGEOIP_DATABASE_OPTIONS
221 %token  LIBGEOIP_IPV4_DATABASE_FILE
222 %token  LIBGEOIP_IPV6_DATABASE_FILE
221   %token  LISTEN
222   %token  MASK
223   %token  MAX_ACCEPT
224   %token  MAX_BANS
225 + %token  MAX_BANS_LARGE
226   %token  MAX_CHANNELS
228 %token  MAX_GLOBAL
229 %token  MAX_IDENT
227   %token  MAX_IDLE
228 < %token  MAX_LOCAL
228 > %token  MAX_INVITES
229   %token  MAX_NICK_CHANGES
230   %token  MAX_NICK_LENGTH
231   %token  MAX_NICK_TIME
# Line 236 | Line 233 | reset_block_state(void)
233   %token  MAX_TARGETS
234   %token  MAX_TOPIC_LENGTH
235   %token  MAX_WATCH
239 %token  MEMORY_CACHE
236   %token  MIN_IDLE
237   %token  MIN_NONWILDCARD
238   %token  MIN_NONWILDCARD_SIMPLE
243 %token  MMAP_CACHE
239   %token  MODULE
240   %token  MODULES
241   %token  MOTD
# Line 254 | Line 249 | reset_block_state(void)
249   %token  NO_TILDE
250   %token  NUMBER
251   %token  NUMBER_PER_CIDR
252 < %token  NUMBER_PER_IP
252 > %token  NUMBER_PER_IP_GLOBAL
253 > %token  NUMBER_PER_IP_LOCAL
254   %token  OPER_ONLY_UMODES
255   %token  OPER_UMODES
256   %token  OPERATOR
# Line 292 | Line 288 | reset_block_state(void)
288   %token  SSL_DH_ELLIPTIC_CURVE
289   %token  SSL_DH_PARAM_FILE
290   %token  SSL_MESSAGE_DIGEST_ALGORITHM
295 %token  STANDARD
291   %token  STATS_E_DISABLED
292   %token  STATS_I_OPER_ONLY
293   %token  STATS_K_OPER_ONLY
# Line 301 | Line 296 | reset_block_state(void)
296   %token  STATS_P_OPER_ONLY
297   %token  STATS_U_OPER_ONLY
298   %token  T_ALL
299 + %token  T_BIND
300   %token  T_BOTS
301   %token  T_CALLERID
302   %token  T_CCONN
# Line 351 | Line 347 | reset_block_state(void)
347   %token  TBOOL
348   %token  THROTTLE_COUNT
349   %token  THROTTLE_TIME
354 %token  TKLINE_EXPIRE_NOTICES
350   %token  TMASKED
351   %token  TS_MAX_DELTA
352   %token  TS_WARN_DELTA
# Line 364 | Line 359 | reset_block_state(void)
359   %token  VHOST6
360   %token  WARN_NO_CONNECT_BLOCK
361   %token  WHOIS
362 + %token  WHOWAS_HISTORY_LENGTH
363   %token  XLINE
364   %token  XLINE_EXEMPT
365  
# Line 453 | Line 449 | serverinfo_entry: SERVERINFO '{' serveri
449  
450   serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
451   serverinfo_item:        serverinfo_name |
456                        serverinfo_vhost |
452                          serverinfo_hub |
453                          serverinfo_description |
454                          serverinfo_network_name |
# Line 464 | Line 459 | serverinfo_item:        serverinfo_name
459                          serverinfo_ssl_dh_param_file |
460                          serverinfo_ssl_dh_elliptic_curve |
461                          serverinfo_rsa_private_key_file |
467                        serverinfo_vhost6 |
462                          serverinfo_sid |
463                          serverinfo_ssl_certificate_file |
464                          serverinfo_ssl_cipher_list |
465                          serverinfo_ssl_message_digest_algorithm |
472                        serverinfo_libgeoip_database_options |
473                        serverinfo_libgeoip_ipv4_database_file |
474                        serverinfo_libgeoip_ipv6_database_file |
466                          error ';' ;
467  
468  
# Line 529 | Line 520 | serverinfo_ssl_dh_elliptic_curve: SSL_DH
520    }
521   };
522  
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
523   serverinfo_name: NAME '=' QSTRING ';'
524   {
525    /* This isn't rehashable */
526 <  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
526 >  if (conf_parser_ctx.pass == 2 && ConfigServerInfo.name == NULL)
527    {
528 <    if (valid_servname(yylval.string))
528 >    if (server_valid_name(yylval.string) == true)
529        ConfigServerInfo.name = xstrdup(yylval.string);
530      else
531      {
# Line 610 | Line 538 | serverinfo_name: NAME '=' QSTRING ';'
538   serverinfo_sid: IRCD_SID '=' QSTRING ';'
539   {
540    /* This isn't rehashable */
541 <  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
541 >  if (conf_parser_ctx.pass == 2 && ConfigServerInfo.sid == NULL)
542    {
543      if (valid_sid(yylval.string))
544        ConfigServerInfo.sid = xstrdup(yylval.string);
# Line 655 | Line 583 | serverinfo_network_desc: NETWORK_DESC '=
583    ConfigServerInfo.network_desc = xstrdup(yylval.string);
584   };
585  
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
586   serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
587   {
588    if (conf_parser_ctx.pass != 2)
589      break;
590  
591 <  if ($3 < MAXCLIENTS_MIN)
591 >  if ($3 < 1)
592    {
593 <    char buf[IRCD_BUFSIZE] = "";
594 <
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;
593 >    conf_error_report("default_max_clients too low, setting to 1");
594 >    ConfigServerInfo.default_max_clients = 1;
595    }
596    else if ($3 > MAXCLIENTS_MAX)
597    {
598      char buf[IRCD_BUFSIZE] = "";
599  
600 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
600 >    snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX);
601      conf_error_report(buf);
602 +
603      ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
604    }
605    else
# Line 752 | Line 622 | serverinfo_max_nick_length: MAX_NICK_LEN
622  
623      snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN);
624      conf_error_report(buf);
625 +
626      ConfigServerInfo.max_nick_length = NICKLEN;
627    }
628    else
# Line 774 | Line 645 | serverinfo_max_topic_length: MAX_TOPIC_L
645  
646      snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN);
647      conf_error_report(buf);
648 +
649      ConfigServerInfo.max_topic_length = TOPICLEN;
650    }
651    else
# Line 790 | Line 662 | serverinfo_hub: HUB '=' TBOOL ';'
662   /***************************************************************************
663   * admin {} section
664   ***************************************************************************/
665 < admin_entry: ADMIN  '{' admin_items '}' ';' ;
665 > admin_entry: ADMIN '{' admin_items '}' ';' ;
666  
667   admin_items: admin_items admin_item | admin_item;
668   admin_item:  admin_name |
# Line 1043 | Line 915 | oper_entry: OPERATOR
915  
916    DLINK_FOREACH(node, block_state.mask.list.head)
917    {
1046    struct MaskItem *conf = NULL;
918      struct split_nuh_item nuh;
919 +    char *s = node->data;
920 +
921 +    if (EmptyString(s))
922 +      continue;
923  
924 <    nuh.nuhmask  = node->data;
924 >    nuh.nuhmask  = s;
925      nuh.nickptr  = NULL;
926      nuh.userptr  = block_state.user.buf;
927      nuh.hostptr  = block_state.host.buf;
928 +
929      nuh.nicksize = 0;
930      nuh.usersize = sizeof(block_state.user.buf);
931      nuh.hostsize = sizeof(block_state.host.buf);
932 +
933      split_nuh(&nuh);
934  
935 <    conf         = conf_make(CONF_OPER);
936 <    conf->name   = xstrdup(block_state.name.buf);
937 <    conf->user   = xstrdup(block_state.user.buf);
938 <    conf->host   = xstrdup(block_state.host.buf);
935 >    struct MaskItem *conf = conf_make(CONF_OPER);
936 >    conf->addr = xcalloc(sizeof(*conf->addr));
937 >    conf->name = xstrdup(block_state.name.buf);
938 >    conf->user = xstrdup(block_state.user.buf);
939 >    conf->host = xstrdup(block_state.host.buf);
940  
941      if (block_state.cert.buf[0])
942        conf->certfp = xstrdup(block_state.cert.buf);
# Line 1072 | Line 950 | oper_entry: OPERATOR
950      conf->flags = block_state.flags.value;
951      conf->modes = block_state.modes.value;
952      conf->port  = block_state.port.value;
953 <    conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
953 >    conf->htype = parse_netmask(conf->host, conf->addr, &conf->bits);
954  
955      conf_add_class_to_conf(conf, block_state.class.buf);
956    }
# Line 1244 | Line 1122 | oper_umodes_item:  T_BOTS
1122   {
1123    if (conf_parser_ctx.pass == 2)
1124      block_state.modes.value |= UMODE_FARCONNECT;
1125 + } | EXPIRATION
1126 + {
1127 +  if (conf_parser_ctx.pass == 2)
1128 +    block_state.modes.value |= UMODE_EXPIRATION;
1129   };
1130  
1131   oper_flags: IRCD_FLAGS
# Line 1389 | Line 1271 | class_entry: CLASS
1271    block_state.max_recvq.value = DEFAULT_RECVQ;
1272   } '{' class_items '}' ';'
1273   {
1392  struct ClassItem *class = NULL;
1393
1274    if (conf_parser_ctx.pass != 1)
1275      break;
1276  
1277    if (!block_state.class.buf[0])
1278      break;
1279  
1280 <  if (!(class = class_find(block_state.class.buf, 0)))
1280 >  struct ClassItem *class = class_find(block_state.class.buf, false);
1281 >  if (class == NULL)
1282      class = class_make();
1283  
1284 <  class->active = 1;
1284 >  class->active = true;
1285    xfree(class->name);
1286    class->name = xstrdup(block_state.class.buf);
1287    class->ping_freq = block_state.ping_freq.value;
1288 <  class->max_perip = block_state.max_perip.value;
1288 >  class->max_perip_local = block_state.max_perip_local.value;
1289 >  class->max_perip_global = block_state.max_perip_global.value;
1290    class->con_freq = block_state.con_freq.value;
1291    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;
1292    class->max_sendq = block_state.max_sendq.value;
1293    class->max_recvq = block_state.max_recvq.value;
1294    class->max_channels = block_state.max_channels.value;
# Line 1425 | Line 1304 | class_entry: CLASS
1304    class->min_idle = block_state.min_idle.value;
1305    class->max_idle = block_state.max_idle.value;
1306  
1307 <  rebuild_cidr_list(class);
1308 <
1307 >  bool diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value ||
1308 >               class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value);
1309    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1310    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1311    class->number_per_cidr = block_state.number_per_cidr.value;
1312 +
1313 +  if (diff)
1314 +    class_ip_limit_rebuild(class);
1315   };
1316  
1317   class_items:    class_items class_item | class_item;
# Line 1438 | Line 1320 | class_item:     class_name |
1320                  class_cidr_bitlen_ipv6 |
1321                  class_ping_time |
1322                  class_number_per_cidr |
1323 <                class_number_per_ip |
1323 >                class_number_per_ip_local |
1324 >                class_number_per_ip_global |
1325                  class_connectfreq |
1326                  class_max_channels |
1327                  class_max_number |
1328 <                class_max_global |
1329 <                class_max_local |
1447 <                class_max_ident |
1448 <                class_sendq | class_recvq |
1328 >                class_sendq |
1329 >                class_recvq |
1330                  class_min_idle |
1331                  class_max_idle |
1332                  class_flags |
# Line 1463 | Line 1344 | class_ping_time: PING_TIME '=' timespec
1344      block_state.ping_freq.value = $3;
1345   };
1346  
1347 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1347 > class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1348   {
1349    if (conf_parser_ctx.pass == 1)
1350 <    block_state.max_perip.value = $3;
1350 >    block_state.max_perip_local.value = $3;
1351 > };
1352 >
1353 > class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1354 > {
1355 >  if (conf_parser_ctx.pass == 1)
1356 >    block_state.max_perip_global.value = $3;
1357   };
1358  
1359   class_connectfreq: CONNECTFREQ '=' timespec ';'
# Line 1487 | Line 1374 | class_max_number: MAX_NUMBER '=' NUMBER
1374      block_state.max_total.value = $3;
1375   };
1376  
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
1377   class_sendq: SENDQ '=' sizespec ';'
1378   {
1379    if (conf_parser_ctx.pass == 1)
# Line 1667 | Line 1536 | auth_entry: IRCD_AUTH
1536  
1537    DLINK_FOREACH(node, block_state.mask.list.head)
1538    {
1670    struct MaskItem *conf = NULL;
1539      struct split_nuh_item nuh;
1540 +    char *s = node->data;
1541 +
1542 +    if (EmptyString(s))
1543 +      continue;
1544  
1545 <    nuh.nuhmask  = node->data;
1545 >    nuh.nuhmask  = s;
1546      nuh.nickptr  = NULL;
1547      nuh.userptr  = block_state.user.buf;
1548      nuh.hostptr  = block_state.host.buf;
1549 +
1550      nuh.nicksize = 0;
1551      nuh.usersize = sizeof(block_state.user.buf);
1552      nuh.hostsize = sizeof(block_state.host.buf);
1553 +
1554      split_nuh(&nuh);
1555  
1556 <    conf        = conf_make(CONF_CLIENT);
1557 <    conf->user  = xstrdup(block_state.user.buf);
1558 <    conf->host  = xstrdup(block_state.host.buf);
1556 >    struct MaskItem *conf = conf_make(CONF_CLIENT);
1557 >    conf->user = xstrdup(block_state.user.buf);
1558 >    conf->host = xstrdup(block_state.host.buf);
1559  
1560      if (block_state.rpass.buf[0])
1561        conf->passwd = xstrdup(block_state.rpass.buf);
# Line 1740 | Line 1614 | auth_flags: IRCD_FLAGS
1614   {
1615    if (conf_parser_ctx.pass == 2)
1616      block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1617 < } '='  auth_flags_items ';';
1617 > } '=' auth_flags_items ';';
1618  
1619   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1620   auth_flags_item: SPOOF_NOTICE
# Line 1871 | Line 1745 | service_name: NAME '=' QSTRING ';'
1745    if (conf_parser_ctx.pass != 2)
1746      break;
1747  
1748 <  if (valid_servname(yylval.string))
1748 >  if (server_valid_name(yylval.string) == true)
1749    {
1750      struct ServiceItem *service = service_make();
1751      service->name = xstrdup(yylval.string);
# Line 2078 | Line 1952 | connect_entry: CONNECT
1952    block_state.port.value = PORTNUM;
1953   } '{' connect_items '}' ';'
1954   {
2081  struct MaskItem *conf = NULL;
1955    struct addrinfo hints, *res;
1956  
1957    if (conf_parser_ctx.pass != 2)
# Line 2092 | Line 1965 | connect_entry: CONNECT
1965        !block_state.spass.buf[0])
1966      break;
1967  
1968 +  if (server_valid_name(block_state.name.buf) == false)
1969 +    break;
1970 +
1971    if (has_wildcards(block_state.name.buf) ||
1972        has_wildcards(block_state.host.buf))
1973      break;
1974  
1975 <  conf = conf_make(CONF_SERVER);
1975 >  struct MaskItem *conf = conf_make(CONF_SERVER);
1976 >  conf->addr = xcalloc(sizeof(*conf->addr));
1977    conf->port = block_state.port.value;
1978    conf->flags = block_state.flags.value;
1979    conf->aftype = block_state.aftype.value;
# Line 2123 | Line 2000 | connect_entry: CONNECT
2000      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2001  
2002      if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2003 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2003 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server bind(%s)", block_state.bind.buf);
2004      else
2005      {
2006        assert(res);
2007  
2008 <      memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2009 <      conf->bind.ss.ss_family = res->ai_family;
2010 <      conf->bind.ss_len = res->ai_addrlen;
2008 >      conf->bind = xcalloc(sizeof(*conf->bind));
2009 >
2010 >      memcpy(conf->bind, res->ai_addr, res->ai_addrlen);
2011 >      conf->bind->ss_len = res->ai_addrlen;
2012        freeaddrinfo(res);
2013      }
2014    }
# Line 2142 | Line 2020 | connect_entry: CONNECT
2020   connect_items:  connect_items connect_item | connect_item;
2021   connect_item:   connect_name |
2022                  connect_host |
2023 <                connect_vhost |
2023 >                connect_bind |
2024                  connect_send_password |
2025                  connect_accept_password |
2026                  connect_ssl_certificate_fingerprint |
# Line 2168 | Line 2046 | connect_host: HOST '=' QSTRING ';'
2046      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2047   };
2048  
2049 < connect_vhost: VHOST '=' QSTRING ';'
2049 > connect_bind: T_BIND '=' QSTRING ';'
2050   {
2051    if (conf_parser_ctx.pass == 2)
2052      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
# Line 2179 | Line 2057 | connect_send_password: SEND_PASSWORD '='
2057    if (conf_parser_ctx.pass != 2)
2058      break;
2059  
2060 <  if ($3[0] == ':')
2060 >  if (*yylval.string == ':')
2061      conf_error_report("Server passwords cannot begin with a colon");
2062 <  else if (strchr($3, ' '))
2062 >  else if (strchr(yylval.string, ' '))
2063      conf_error_report("Server passwords cannot contain spaces");
2064    else
2065      strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
# Line 2192 | Line 2070 | connect_accept_password: ACCEPT_PASSWORD
2070    if (conf_parser_ctx.pass != 2)
2071      break;
2072  
2073 <  if ($3[0] == ':')
2073 >  if (*yylval.string == ':')
2074      conf_error_report("Server passwords cannot begin with a colon");
2075 <  else if (strchr($3, ' '))
2075 >  else if (strchr(yylval.string, ' '))
2076      conf_error_report("Server passwords cannot contain spaces");
2077    else
2078      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2225 | Line 2103 | connect_aftype: AFTYPE '=' T_IPV4 ';'
2103   connect_flags: IRCD_FLAGS
2104   {
2105    block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2106 < } '='  connect_flags_items ';';
2106 > } '=' connect_flags_items ';';
2107  
2108   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2109   connect_flags_item: AUTOCONN
# Line 2288 | Line 2166 | kill_entry: KILL
2166      reset_block_state();
2167   } '{' kill_items '}' ';'
2168   {
2291  struct MaskItem *conf = NULL;
2292
2169    if (conf_parser_ctx.pass != 2)
2170      break;
2171  
# Line 2297 | Line 2173 | kill_entry: KILL
2173        !block_state.host.buf[0])
2174      break;
2175  
2176 <  conf = conf_make(CONF_KLINE);
2176 >  struct MaskItem *conf = conf_make(CONF_KLINE);
2177    conf->user = xstrdup(block_state.user.buf);
2178    conf->host = xstrdup(block_state.host.buf);
2179  
# Line 2347 | Line 2223 | deny_entry: DENY
2223      reset_block_state();
2224   } '{' deny_items '}' ';'
2225   {
2350  struct MaskItem *conf = NULL;
2351
2226    if (conf_parser_ctx.pass != 2)
2227      break;
2228  
# Line 2357 | Line 2231 | deny_entry: DENY
2231  
2232    if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2233    {
2234 <    conf = conf_make(CONF_DLINE);
2234 >    struct MaskItem *conf = conf_make(CONF_DLINE);
2235      conf->host = xstrdup(block_state.addr.buf);
2236  
2237      if (block_state.rpass.buf[0])
# Line 2415 | Line 2289 | gecos_entry: GECOS
2289      reset_block_state();
2290   } '{' gecos_items '}' ';'
2291   {
2418  struct MaskItem *conf = NULL;
2419
2292    if (conf_parser_ctx.pass != 2)
2293      break;
2294  
2295    if (!block_state.name.buf[0])
2296      break;
2297  
2298 <  conf = conf_make(CONF_XLINE);
2299 <  conf->name = xstrdup(block_state.name.buf);
2298 >  struct GecosItem *gecos = gecos_make();
2299 >  gecos->mask = xstrdup(block_state.name.buf);
2300  
2301    if (block_state.rpass.buf[0])
2302 <    conf->reason = xstrdup(block_state.rpass.buf);
2302 >    gecos->reason = xstrdup(block_state.rpass.buf);
2303    else
2304 <    conf->reason = xstrdup(CONF_NOREASON);
2304 >    gecos->reason = xstrdup(CONF_NOREASON);
2305   };
2306  
2307   gecos_items: gecos_items gecos_item | gecos_item;
# Line 2456 | Line 2328 | general_entry: GENERAL '{' general_items
2328   general_items:      general_items general_item | general_item;
2329   general_item:       general_away_count |
2330                      general_away_time |
2459                    general_ignore_bogus_ts |
2331                      general_failed_oper_notice |
2332                      general_anti_nick_flood |
2333                      general_max_nick_time |
2334                      general_max_nick_changes |
2335                      general_max_accept |
2336 +                    general_whowas_history_length |
2337                      general_anti_spam_exit_message_time |
2338                      general_ts_warn_delta |
2339                      general_ts_max_delta |
# Line 2485 | Line 2357 | general_item:       general_away_count |
2357                      general_caller_id_wait |
2358                      general_opers_bypass_callerid |
2359                      general_default_floodcount |
2360 +                    general_default_floodtime |
2361                      general_min_nonwildcard |
2362                      general_min_nonwildcard_simple |
2363                      general_throttle_count |
2364                      general_throttle_time |
2365                      general_ping_cookie |
2366                      general_disable_auth |
2494                    general_tkline_expire_notices |
2367                      general_dline_min_cidr |
2368                      general_dline_min_cidr6 |
2369                      general_kline_min_cidr |
# Line 2517 | Line 2389 | general_max_watch: MAX_WATCH '=' NUMBER
2389    ConfigGeneral.max_watch = $3;
2390   };
2391  
2392 + general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2393 + {
2394 +  ConfigGeneral.whowas_history_length = $3;
2395 + };
2396 +
2397   general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2398   {
2399 <  if (conf_parser_ctx.pass == 2)
2523 <    ConfigGeneral.cycle_on_host_change = yylval.number;
2399 >  ConfigGeneral.cycle_on_host_change = yylval.number;
2400   };
2401  
2402   general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
# Line 2543 | Line 2419 | general_kline_min_cidr6: KLINE_MIN_CIDR6
2419    ConfigGeneral.kline_min_cidr6 = $3;
2420   };
2421  
2546 general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2547 {
2548  ConfigGeneral.tkline_expire_notices = yylval.number;
2549 };
2550
2422   general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2423   {
2424    ConfigGeneral.kill_chase_time_limit = $3;
2425   };
2426  
2556 general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2557 {
2558  ConfigGeneral.ignore_bogus_ts = yylval.number;
2559 };
2560
2427   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2428   {
2429    ConfigGeneral.failed_oper_notice = yylval.number;
# Line 2595 | Line 2461 | general_ts_warn_delta: TS_WARN_DELTA '='
2461  
2462   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2463   {
2464 <  if (conf_parser_ctx.pass == 2)
2599 <    ConfigGeneral.ts_max_delta = $3;
2464 >  ConfigGeneral.ts_max_delta = $3;
2465   };
2466  
2467   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
# Line 2713 | Line 2578 | general_throttle_time: THROTTLE_TIME '='
2578   general_oper_umodes: OPER_UMODES
2579   {
2580    ConfigGeneral.oper_umodes = 0;
2581 < } '='  umode_oitems ';' ;
2581 > } '=' umode_oitems ';' ;
2582  
2583   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2584   umode_oitem:     T_BOTS
# Line 2782 | Line 2647 | umode_oitem:     T_BOTS
2647   } | T_FARCONNECT
2648   {
2649    ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2650 + } | EXPIRATION
2651 + {
2652 +  ConfigGeneral.oper_umodes |= UMODE_EXPIRATION;
2653   };
2654  
2655   general_oper_only_umodes: OPER_ONLY_UMODES
2656   {
2657    ConfigGeneral.oper_only_umodes = 0;
2658 < } '='  umode_items ';' ;
2658 > } '=' umode_items ';' ;
2659  
2660   umode_items:  umode_items ',' umode_item | umode_item;
2661   umode_item:   T_BOTS
# Line 2850 | Line 2718 | umode_item:   T_BOTS
2718   } | T_FARCONNECT
2719   {
2720    ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2721 + } | EXPIRATION
2722 + {
2723 +  ConfigGeneral.oper_only_umodes |= UMODE_EXPIRATION;
2724   };
2725  
2726   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
# Line 2867 | Line 2738 | general_default_floodcount: DEFAULT_FLOO
2738    ConfigGeneral.default_floodcount = $3;
2739   };
2740  
2741 + general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2742 + {
2743 +  ConfigGeneral.default_floodtime = $3;
2744 + };
2745 +
2746  
2747   /***************************************************************************
2748   * channel {} section
# Line 2875 | Line 2751 | channel_entry: CHANNEL '{' channel_items
2751  
2752   channel_items:      channel_items channel_item | channel_item;
2753   channel_item:       channel_max_bans |
2754 +                    channel_max_bans_large |
2755                      channel_invite_client_count |
2756                      channel_invite_client_time |
2757                      channel_invite_delay_channel |
2758 +                    channel_invite_expire_time |
2759                      channel_knock_client_count |
2760                      channel_knock_client_time |
2761                      channel_knock_delay_channel |
2762                      channel_max_channels |
2763 +                    channel_max_invites |
2764                      channel_default_join_flood_count |
2765                      channel_default_join_flood_time |
2766                      channel_disable_fake_channels |
# Line 2907 | Line 2786 | channel_invite_delay_channel: INVITE_DEL
2786    ConfigChannel.invite_delay_channel = $3;
2787   };
2788  
2789 + channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2790 + {
2791 +  ConfigChannel.invite_expire_time = $3;
2792 + };
2793 +
2794   channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2795   {
2796    ConfigChannel.knock_client_count = $3;
# Line 2927 | Line 2811 | channel_max_channels: MAX_CHANNELS '=' N
2811    ConfigChannel.max_channels = $3;
2812   };
2813  
2814 + channel_max_invites: MAX_INVITES '=' NUMBER ';'
2815 + {
2816 +  ConfigChannel.max_invites = $3;
2817 + };
2818 +
2819   channel_max_bans: MAX_BANS '=' NUMBER ';'
2820   {
2821    ConfigChannel.max_bans = $3;
2822   };
2823  
2824 + channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2825 + {
2826 +  ConfigChannel.max_bans_large = $3;
2827 + };
2828 +
2829   channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2830   {
2831    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 8963 by michael, Sat May 11 21:06:49 2019 UTC

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

Diff Legend

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