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 5004 by michael, Tue Dec 9 14:17:18 2014 UTC vs.
Revision 7282 by michael, Sun Feb 7 18:04:26 2016 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 2000-2014 ircd-hybrid development team
4 > *  Copyright (c) 2000-2016 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 #define YY_NO_UNPUT
31 #include <sys/types.h>
32 #include <string.h>
33
30   #include "config.h"
31   #include "stdinc.h"
32   #include "ircd.h"
33   #include "list.h"
34   #include "conf.h"
35   #include "conf_class.h"
36 + #include "conf_cluster.h"
37   #include "conf_pseudo.h"
38 + #include "conf_resv.h"
39 + #include "conf_service.h"
40 + #include "conf_shared.h"
41   #include "event.h"
42 + #include "id.h"
43   #include "log.h"
43 #include "client.h"     /* for UMODE_ALL only */
44   #include "irc_string.h"
45   #include "memory.h"
46   #include "modules.h"
47   #include "server.h"
48   #include "hostmask.h"
49 #include "send.h"
49   #include "listener.h"
51 #include "resv.h"
52 #include "numeric.h"
50   #include "user.h"
51   #include "motd.h"
52  
56 #ifdef HAVE_LIBCRYPTO
57 #include <openssl/rsa.h>
58 #include <openssl/bio.h>
59 #include <openssl/pem.h>
60 #include <openssl/dh.h>
61 #endif
62
63 #include "rsa.h"
64
53   int yylex(void);
54  
55   static struct
# Line 87 | Line 75 | static struct
75      cert,
76      rpass,
77      spass,
78 +    whois,
79      class,
80      target,
81      prepend,
# Line 125 | Line 114 | reset_block_state(void)
114  
115    DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head)
116    {
117 <    MyFree(node->data);
117 >    xfree(node->data);
118      dlinkDelete(node, &block_state.mask.list);
119      free_dlink_node(node);
120    }
121  
122    DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head)
123    {
124 <    MyFree(node->data);
124 >    xfree(node->data);
125      dlinkDelete(node, &block_state.leaf.list);
126      free_dlink_node(node);
127    }
128  
129    DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head)
130    {
131 <    MyFree(node->data);
131 >    xfree(node->data);
132      dlinkDelete(node, &block_state.hub.list);
133      free_dlink_node(node);
134    }
# Line 166 | Line 155 | reset_block_state(void)
155   %token  CALLER_ID_WAIT
156   %token  CAN_FLOOD
157   %token  CHANNEL
158 + %token  CHECK_CACHE
159   %token  CIDR_BITLEN_IPV4
160   %token  CIDR_BITLEN_IPV6
161   %token  CLASS
162 + %token  CLOSE
163   %token  CONNECT
164   %token  CONNECTFREQ
165   %token  CYCLE_ON_HOST_CHANGE
166   %token  DEFAULT_FLOODCOUNT
167 < %token  DEFAULT_SPLIT_SERVER_COUNT
168 < %token  DEFAULT_SPLIT_USER_COUNT
167 > %token  DEFAULT_JOIN_FLOOD_COUNT
168 > %token  DEFAULT_JOIN_FLOOD_TIME
169 > %token  DEFAULT_MAX_CLIENTS
170   %token  DENY
171   %token  DESCRIPTION
172   %token  DIE
173   %token  DISABLE_AUTH
174   %token  DISABLE_FAKE_CHANNELS
175   %token  DISABLE_REMOTE_COMMANDS
176 + %token  DLINE_MIN_CIDR
177 + %token  DLINE_MIN_CIDR6
178   %token  DOTS_IN_IDENT
185 %token  EGDPOOL_PATH
179   %token  EMAIL
180   %token  ENCRYPTED
181   %token  EXCEED_LIMIT
182   %token  EXEMPT
183   %token  FAILED_OPER_NOTICE
184   %token  FLATTEN_LINKS
185 + %token  FLATTEN_LINKS_DELAY
186 + %token  FLATTEN_LINKS_FILE
187   %token  GECOS
188   %token  GENERAL
194 %token  GLINE
195 %token  GLINE_DURATION
196 %token  GLINE_ENABLE
197 %token  GLINE_EXEMPT
198 %token  GLINE_MIN_CIDR
199 %token  GLINE_MIN_CIDR6
200 %token  GLINE_REQUEST_DURATION
201 %token  GLOBAL_KILL
202 %token  HAVENT_READ_CONF
189   %token  HIDDEN
190   %token  HIDDEN_NAME
191   %token  HIDE_CHANS
# Line 208 | Line 194 | reset_block_state(void)
194   %token  HIDE_SERVER_IPS
195   %token  HIDE_SERVERS
196   %token  HIDE_SERVICES
211 %token  HIDE_SPOOF_IPS
197   %token  HOST
198   %token  HUB
199   %token  HUB_MASK
# Line 216 | Line 201 | reset_block_state(void)
201   %token  INVISIBLE_ON_CONNECT
202   %token  INVITE_CLIENT_COUNT
203   %token  INVITE_CLIENT_TIME
204 + %token  INVITE_DELAY_CHANNEL
205   %token  IP
206   %token  IRCD_AUTH
207   %token  IRCD_FLAGS
208   %token  IRCD_SID
209 < %token  JOIN_FLOOD_COUNT
224 < %token  JOIN_FLOOD_TIME
209 > %token  JOIN
210   %token  KILL
211   %token  KILL_CHASE_TIME_LIMIT
212   %token  KLINE
213   %token  KLINE_EXEMPT
214 + %token  KLINE_MIN_CIDR
215 + %token  KLINE_MIN_CIDR6
216   %token  KNOCK_CLIENT_COUNT
217   %token  KNOCK_CLIENT_TIME
218   %token  KNOCK_DELAY_CHANNEL
219   %token  LEAF_MASK
220 < %token  LINKS_DELAY
220 > %token  LIBGEOIP_DATABASE_OPTIONS
221 > %token  LIBGEOIP_IPV4_DATABASE_FILE
222 > %token  LIBGEOIP_IPV6_DATABASE_FILE
223   %token  LISTEN
224   %token  MASK
225   %token  MAX_ACCEPT
# Line 247 | Line 236 | reset_block_state(void)
236   %token  MAX_TARGETS
237   %token  MAX_TOPIC_LENGTH
238   %token  MAX_WATCH
239 + %token  MEMORY_CACHE
240   %token  MIN_IDLE
241   %token  MIN_NONWILDCARD
242   %token  MIN_NONWILDCARD_SIMPLE
243 + %token  MMAP_CACHE
244   %token  MODULE
245   %token  MODULES
246   %token  MOTD
# Line 259 | Line 250 | reset_block_state(void)
250   %token  NETWORK_DESC
251   %token  NETWORK_NAME
252   %token  NICK
262 %token  NO_CREATE_ON_SPLIT
263 %token  NO_JOIN_ON_SPLIT
253   %token  NO_OPER_FLOOD
254   %token  NO_TILDE
255   %token  NUMBER
256   %token  NUMBER_PER_CIDR
257   %token  NUMBER_PER_IP
258   %token  OPER_ONLY_UMODES
270 %token  OPER_PASS_RESV
259   %token  OPER_UMODES
260   %token  OPERATOR
261   %token  OPERS_BYPASS_CALLERID
# Line 289 | Line 277 | reset_block_state(void)
277   %token  RESV
278   %token  RESV_EXEMPT
279   %token  RSA_PRIVATE_KEY_FILE
292 %token  RSA_PUBLIC_KEY_FILE
280   %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
281   %token  SEND_PASSWORD
282   %token  SENDQ
# Line 305 | Line 292 | reset_block_state(void)
292   %token  SSL_DH_ELLIPTIC_CURVE
293   %token  SSL_DH_PARAM_FILE
294   %token  SSL_MESSAGE_DIGEST_ALGORITHM
295 + %token  STANDARD
296   %token  STATS_E_DISABLED
297   %token  STATS_I_OPER_ONLY
298   %token  STATS_K_OPER_ONLY
299 + %token  STATS_M_OPER_ONLY
300   %token  STATS_O_OPER_ONLY
301   %token  STATS_P_OPER_ONLY
302   %token  STATS_U_OPER_ONLY
# Line 330 | Line 319 | reset_block_state(void)
319   %token  T_IPV6
320   %token  T_LOCOPS
321   %token  T_LOG
333 %token  T_MAX_CLIENTS
322   %token  T_NCHANGE
323   %token  T_NONONREG
324   %token  T_OPME
# Line 370 | Line 358 | reset_block_state(void)
358   %token  TWODOTS
359   %token  TYPE
360   %token  UNKLINE
373 %token  USE_EGD
361   %token  USE_LOGGING
362   %token  USER
363   %token  VHOST
364   %token  VHOST6
365   %token  WARN_NO_CONNECT_BLOCK
366 + %token  WHOIS
367   %token  XLINE
368 + %token  XLINE_EXEMPT
369  
370   %type  <string> QSTRING
371   %type  <number> NUMBER
# Line 437 | Line 426 | sizespec:   NUMBER sizespec_ { $$ = $1 +
426  
427  
428   /***************************************************************************
429 < *  section modules
429 > * modules {} section
430   ***************************************************************************/
431 < modules_entry: MODULES
443 <  '{' modules_items '}' ';';
431 > modules_entry: MODULES '{' modules_items '}' ';';
432  
433   modules_items:  modules_items modules_item | modules_item;
434   modules_item:   modules_module | modules_path | error ';' ;
# Line 458 | Line 446 | modules_path: PATH '=' QSTRING ';'
446   };
447  
448  
449 + /***************************************************************************
450 + * serverinfo {}  section
451 + ***************************************************************************/
452   serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
453  
454   serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
# Line 467 | Line 458 | serverinfo_item:        serverinfo_name
458                          serverinfo_description |
459                          serverinfo_network_name |
460                          serverinfo_network_desc |
461 <                        serverinfo_max_clients |
461 >                        serverinfo_default_max_clients |
462                          serverinfo_max_nick_length |
463                          serverinfo_max_topic_length |
464                          serverinfo_ssl_dh_param_file |
# Line 478 | Line 469 | serverinfo_item:        serverinfo_name
469                          serverinfo_ssl_certificate_file |
470                          serverinfo_ssl_cipher_list |
471                          serverinfo_ssl_message_digest_algorithm |
472 +                        serverinfo_libgeoip_database_options |
473 +                        serverinfo_libgeoip_ipv4_database_file |
474 +                        serverinfo_libgeoip_ipv6_database_file |
475                          error ';' ;
476  
477  
478   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
479   {
486 #ifdef HAVE_LIBCRYPTO
480    if (conf_parser_ctx.pass == 2)
481    {
482 <    if (!ConfigServerInfo.rsa_private_key_file)
483 <    {
491 <      conf_error_report("No rsa_private_key_file specified, SSL disabled");
492 <      break;
493 <    }
494 <
495 <    if (SSL_CTX_use_certificate_chain_file(ConfigServerInfo.server_ctx, yylval.string) <= 0 ||
496 <        SSL_CTX_use_certificate_chain_file(ConfigServerInfo.client_ctx, yylval.string) <= 0)
497 <    {
498 <      report_crypto_errors();
499 <      conf_error_report("Could not open/read certificate file");
500 <      break;
501 <    }
502 <
503 <    if (SSL_CTX_use_PrivateKey_file(ConfigServerInfo.server_ctx, ConfigServerInfo.rsa_private_key_file,
504 <                                    SSL_FILETYPE_PEM) <= 0 ||
505 <        SSL_CTX_use_PrivateKey_file(ConfigServerInfo.client_ctx, ConfigServerInfo.rsa_private_key_file,
506 <                                    SSL_FILETYPE_PEM) <= 0)
507 <    {
508 <      report_crypto_errors();
509 <      conf_error_report("Could not read RSA private key");
510 <      break;
511 <    }
512 <
513 <    if (!SSL_CTX_check_private_key(ConfigServerInfo.server_ctx) ||
514 <        !SSL_CTX_check_private_key(ConfigServerInfo.client_ctx))
515 <    {
516 <      report_crypto_errors();
517 <      conf_error_report("Could not read RSA private key");
518 <      break;
519 <    }
482 >    xfree(ConfigServerInfo.ssl_certificate_file);
483 >    ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string);
484    }
521 #endif
485   };
486  
487   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
488   {
489 < #ifdef HAVE_LIBCRYPTO
527 <  BIO *file = NULL;
528 <
529 <  if (conf_parser_ctx.pass != 1)
530 <    break;
531 <
532 <  if (ConfigServerInfo.rsa_private_key)
533 <  {
534 <    RSA_free(ConfigServerInfo.rsa_private_key);
535 <    ConfigServerInfo.rsa_private_key = NULL;
536 <  }
537 <
538 <  if (ConfigServerInfo.rsa_private_key_file)
489 >  if (conf_parser_ctx.pass == 2)
490    {
491 <    MyFree(ConfigServerInfo.rsa_private_key_file);
492 <    ConfigServerInfo.rsa_private_key_file = NULL;
491 >    xfree(ConfigServerInfo.rsa_private_key_file);
492 >    ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
493    }
494 + };
495  
496 <  ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
497 <
498 <  if ((file = BIO_new_file(yylval.string, "r")) == NULL)
496 > serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
497 > {
498 >  if (conf_parser_ctx.pass == 2)
499    {
500 <    conf_error_report("File open failed, ignoring");
501 <    break;
500 >    xfree(ConfigServerInfo.ssl_dh_param_file);
501 >    ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string);
502    }
503 + };
504  
505 <  ConfigServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
506 <
507 <  BIO_set_close(file, BIO_CLOSE);
555 <  BIO_free(file);
556 <
557 <  if (ConfigServerInfo.rsa_private_key == NULL)
505 > serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
506 > {
507 >  if (conf_parser_ctx.pass == 2)
508    {
509 <    conf_error_report("Couldn't extract key, ignoring");
510 <    break;
509 >    xfree(ConfigServerInfo.ssl_cipher_list);
510 >    ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string);
511    }
512 + };
513  
514 <  if (!RSA_check_key(ConfigServerInfo.rsa_private_key))
514 > serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
515 > {
516 >  if (conf_parser_ctx.pass == 2)
517    {
518 <    RSA_free(ConfigServerInfo.rsa_private_key);
519 <    ConfigServerInfo.rsa_private_key = NULL;
567 <
568 <    conf_error_report("Invalid key, ignoring");
569 <    break;
518 >    xfree(ConfigServerInfo.ssl_message_digest_algorithm);
519 >    ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string);
520    }
521 + }
522  
523 <  if (RSA_size(ConfigServerInfo.rsa_private_key) < 128)
523 > serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';'
524 > {
525 >  if (conf_parser_ctx.pass == 2)
526    {
527 <    RSA_free(ConfigServerInfo.rsa_private_key);
528 <    ConfigServerInfo.rsa_private_key = NULL;
576 <
577 <    conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size");
527 >    xfree(ConfigServerInfo.ssl_dh_elliptic_curve);
528 >    ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string);
529    }
579 #endif
530   };
531  
532 < serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
532 > serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS
533   {
534 < #ifdef HAVE_LIBCRYPTO
535 <  if (conf_parser_ctx.pass == 2)
536 <  {
587 <    BIO *file = BIO_new_file(yylval.string, "r");
588 <
589 <    if (file)
590 <    {
591 <      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
592 <
593 <      BIO_free(file);
594 <
595 <      if (dh)
596 <      {
597 <        if (DH_size(dh) < 128)
598 <          conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
599 <        else
600 <          SSL_CTX_set_tmp_dh(ConfigServerInfo.server_ctx, dh);
534 >  if (conf_parser_ctx.pass == 1)
535 >    ConfigServerInfo.libgeoip_database_options = 0;
536 > } '='  options_items ';';
537  
538 <        DH_free(dh);
539 <      }
540 <    }
541 <    else
542 <      conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- could not open/read Diffie-Hellman parameter file");
543 <  }
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 < };
610 <
611 < serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
545 > } | MEMORY_CACHE
546   {
547 < #ifdef HAVE_LIBCRYPTO
548 <  if (conf_parser_ctx.pass == 2)
549 <    SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, yylval.string);
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_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
565 > serverinfo_libgeoip_ipv4_database_file:  LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';'
566   {
621 #ifdef HAVE_LIBCRYPTO
567    if (conf_parser_ctx.pass == 2)
568    {
569 <    if ((ConfigServerInfo.message_digest_algorithm = EVP_get_digestbyname(yylval.string)) == NULL)
570 <    {
571 <      ConfigServerInfo.message_digest_algorithm = EVP_sha256();
572 <      conf_error_report("Ignoring serverinfo::ssl_message_digest_algorithm -- unknown message digest algorithm");
573 <    }
574 <  }
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 < }
577 >  }
578 > };
579  
580 < serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';'
580 > serverinfo_libgeoip_ipv6_database_file:  LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';'
581   {
635 #ifdef HAVE_LIBCRYPTO
636 #if OPENSSL_VERSION_NUMBER >= 0x009080FFL && !defined(OPENSSL_NO_ECDH)
637  int nid = 0;
638  EC_KEY *key = NULL;
639
582    if (conf_parser_ctx.pass == 2)
583    {
584 <    if ((nid = OBJ_sn2nid(yylval.string)) == 0)
585 <    {
644 <        conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- unknown curve name");
645 <        break;
646 <    }
647 <
648 <    if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
649 <    {
650 <      conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- could not create curve");
651 <      break;
652 <    }
584 >    xfree(ConfigServerInfo.libgeoip_ipv6_database_file);
585 >    ConfigServerInfo.libgeoip_ipv6_database_file = xstrdup(yylval.string);
586  
587 <    SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key);
588 <    EC_KEY_free(key);
589 < }
590 < #endif
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  
595   serverinfo_name: NAME '=' QSTRING ';'
596   {
597 <  /* this isn't rehashable */
597 >  /* This isn't rehashable */
598    if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
599    {
600      if (valid_servname(yylval.string))
# Line 668 | Line 602 | serverinfo_name: NAME '=' QSTRING ';'
602      else
603      {
604        conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
605 <      exit(0);
605 >      exit(EXIT_FAILURE);
606      }
607    }
608   };
609  
610   serverinfo_sid: IRCD_SID '=' QSTRING ';'
611   {
612 <  /* this isn't rehashable */
612 >  /* This isn't rehashable */
613    if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
614    {
615      if (valid_sid(yylval.string))
# Line 683 | Line 617 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
617      else
618      {
619        conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
620 <      exit(0);
620 >      exit(EXIT_FAILURE);
621      }
622    }
623   };
# Line 692 | Line 626 | serverinfo_description: DESCRIPTION '='
626   {
627    if (conf_parser_ctx.pass == 2)
628    {
629 <    MyFree(ConfigServerInfo.description);
629 >    xfree(ConfigServerInfo.description);
630      ConfigServerInfo.description = xstrdup(yylval.string);
631      strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
632    }
# Line 707 | Line 641 | serverinfo_network_name: NETWORK_NAME '=
641      if ((p = strchr(yylval.string, ' ')))
642        *p = '\0';
643  
644 <    MyFree(ConfigServerInfo.network_name);
644 >    xfree(ConfigServerInfo.network_name);
645      ConfigServerInfo.network_name = xstrdup(yylval.string);
646    }
647   };
# Line 717 | Line 651 | serverinfo_network_desc: NETWORK_DESC '=
651    if (conf_parser_ctx.pass != 2)
652      break;
653  
654 <  MyFree(ConfigServerInfo.network_desc);
654 >  xfree(ConfigServerInfo.network_desc);
655    ConfigServerInfo.network_desc = xstrdup(yylval.string);
656   };
657  
# Line 777 | Line 711 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
711    }
712   };
713  
714 < serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
714 > serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
715   {
716    if (conf_parser_ctx.pass != 2)
717      break;
# Line 788 | Line 722 | serverinfo_max_clients: T_MAX_CLIENTS '=
722  
723      snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
724      conf_error_report(buf);
725 <    ConfigServerInfo.max_clients = MAXCLIENTS_MIN;
725 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN;
726    }
727    else if ($3 > MAXCLIENTS_MAX)
728    {
# Line 796 | Line 730 | serverinfo_max_clients: T_MAX_CLIENTS '=
730  
731      snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
732      conf_error_report(buf);
733 <    ConfigServerInfo.max_clients = MAXCLIENTS_MAX;
733 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
734    }
735    else
736 <    ConfigServerInfo.max_clients = $3;
736 >    ConfigServerInfo.default_max_clients = $3;
737   };
738  
739   serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
# Line 852 | Line 786 | serverinfo_hub: HUB '=' TBOOL ';'
786      ConfigServerInfo.hub = yylval.number;
787   };
788  
789 +
790   /***************************************************************************
791 < * admin section
791 > * admin {} section
792   ***************************************************************************/
793   admin_entry: ADMIN  '{' admin_items '}' ';' ;
794  
# Line 868 | Line 803 | admin_name: NAME '=' QSTRING ';'
803    if (conf_parser_ctx.pass != 2)
804      break;
805  
806 <  MyFree(ConfigAdminInfo.name);
806 >  xfree(ConfigAdminInfo.name);
807    ConfigAdminInfo.name = xstrdup(yylval.string);
808   };
809  
# Line 877 | Line 812 | admin_email: EMAIL '=' QSTRING ';'
812    if (conf_parser_ctx.pass != 2)
813      break;
814  
815 <  MyFree(ConfigAdminInfo.email);
815 >  xfree(ConfigAdminInfo.email);
816    ConfigAdminInfo.email = xstrdup(yylval.string);
817   };
818  
# Line 886 | Line 821 | admin_description: DESCRIPTION '=' QSTRI
821    if (conf_parser_ctx.pass != 2)
822      break;
823  
824 <  MyFree(ConfigAdminInfo.description);
824 >  xfree(ConfigAdminInfo.description);
825    ConfigAdminInfo.description = xstrdup(yylval.string);
826   };
827  
828 +
829   /***************************************************************************
830 < * motd section
830 > * motd {} section
831   ***************************************************************************/
832   motd_entry: MOTD
833   {
# Line 926 | Line 862 | motd_file: T_FILE '=' QSTRING ';'
862      strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
863   };
864  
865 +
866   /***************************************************************************
867 < * pseudo section
867 > * pseudo {} section
868   ***************************************************************************/
869   pseudo_entry: T_PSEUDO
870   {
# Line 977 | Line 914 | pseudo_target: T_TARGET '=' QSTRING ';'
914  
915      nuh.nuhmask  = yylval.string;
916      nuh.nickptr  = NULL;
917 <    nuh.userptr  = block_state.user.buf;
917 >    nuh.userptr  = block_state.nick.buf;
918      nuh.hostptr  = block_state.host.buf;
919      nuh.nicksize = 0;
920      nuh.usersize = sizeof(block_state.nick.buf);
921      nuh.hostsize = sizeof(block_state.host.buf);
985    split_nuh(&nuh);
922  
923 <    strlcpy(block_state.nick.buf, nuh.userptr, sizeof(block_state.nick.buf));
988 <    strlcpy(block_state.host.buf, nuh.hostptr, sizeof(block_state.host.buf));
923 >    split_nuh(&nuh);
924    }
925   };
926  
927 +
928   /***************************************************************************
929 < *  section logging
929 > * log {} section
930   ***************************************************************************/
931   logging_entry:          T_LOG  '{' logging_items '}' ';' ;
932   logging_items:          logging_items logging_item | logging_item ;
# Line 1055 | Line 991 | logging_file_type_item:  USER
991   {
992    if (conf_parser_ctx.pass == 2)
993      block_state.type.value = LOG_TYPE_OPER;
1058 } | GLINE
1059 {
1060  if (conf_parser_ctx.pass == 2)
1061    block_state.type.value = LOG_TYPE_GLINE;
994   } | XLINE
995   {
996    if (conf_parser_ctx.pass == 2)
# Line 1087 | Line 1019 | logging_file_type_item:  USER
1019  
1020  
1021   /***************************************************************************
1022 < * section oper
1022 > * operator {} section
1023   ***************************************************************************/
1024   oper_entry: OPERATOR
1025   {
# Line 1105 | Line 1037 | oper_entry: OPERATOR
1037  
1038    if (!block_state.name.buf[0])
1039      break;
1040 < #ifdef HAVE_LIBCRYPTO
1109 <  if (!block_state.file.buf[0] &&
1110 <      !block_state.rpass.buf[0])
1111 <    break;
1112 < #else
1040 >
1041    if (!block_state.rpass.buf[0])
1042      break;
1115 #endif
1043  
1044    DLINK_FOREACH(node, block_state.mask.list.head)
1045    {
# Line 1139 | Line 1066 | oper_entry: OPERATOR
1066      if (block_state.rpass.buf[0])
1067        conf->passwd = xstrdup(block_state.rpass.buf);
1068  
1069 +    if (block_state.whois.buf[0])
1070 +      conf->whois = xstrdup(block_state.whois.buf);
1071 +
1072      conf->flags = block_state.flags.value;
1073      conf->modes = block_state.modes.value;
1074      conf->port  = block_state.port.value;
1075      conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
1076  
1077      conf_add_class_to_conf(conf, block_state.class.buf);
1148
1149 #ifdef HAVE_LIBCRYPTO
1150    if (block_state.file.buf[0])
1151    {
1152      BIO *file = NULL;
1153      RSA *pkey = NULL;
1154
1155      if ((file = BIO_new_file(block_state.file.buf, "r")) == NULL)
1156      {
1157        ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- file doesn't exist");
1158        break;
1159      }
1160
1161      if ((pkey = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL)) == NULL)
1162        ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key invalid; check key syntax");
1163      else
1164      {
1165        if (RSA_size(pkey) > 128)
1166          ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key size must be 1024 or below");
1167        else
1168          conf->rsa_public_key = pkey;
1169      }
1170
1171      BIO_set_close(file, BIO_CLOSE);
1172      BIO_free(file);
1173    }
1174 #endif /* HAVE_LIBCRYPTO */
1078    }
1079   };
1080  
# Line 1179 | Line 1082 | oper_items:     oper_items oper_item | o
1082   oper_item:      oper_name |
1083                  oper_user |
1084                  oper_password |
1085 +                oper_whois |
1086                  oper_umodes |
1087                  oper_class |
1088                  oper_encrypted |
1185                oper_rsa_public_key_file |
1089                  oper_ssl_certificate_fingerprint |
1090                  oper_ssl_connection_required |
1091                  oper_flags |
# Line 1206 | Line 1109 | oper_password: PASSWORD '=' QSTRING ';'
1109      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1110   };
1111  
1112 + oper_whois: WHOIS '=' QSTRING ';'
1113 + {
1114 +  if (conf_parser_ctx.pass == 2)
1115 +    strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
1116 + };
1117 +
1118   oper_encrypted: ENCRYPTED '=' TBOOL ';'
1119   {
1120    if (conf_parser_ctx.pass != 2)
# Line 1217 | Line 1126 | oper_encrypted: ENCRYPTED '=' TBOOL ';'
1126      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1127   };
1128  
1220 oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1221 {
1222  if (conf_parser_ctx.pass == 2)
1223    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1224 };
1225
1129   oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1130   {
1131    if (conf_parser_ctx.pass == 2)
# Line 1398 | Line 1301 | oper_flags_item: KILL ':' REMOTE
1301   {
1302    if (conf_parser_ctx.pass == 2)
1303      block_state.port.value |= OPER_FLAG_UNXLINE;
1401 } | GLINE
1402 {
1403  if (conf_parser_ctx.pass == 2)
1404    block_state.port.value |= OPER_FLAG_GLINE;
1304   } | DIE
1305   {
1306    if (conf_parser_ctx.pass == 2)
# Line 1410 | Line 1309 | oper_flags_item: KILL ':' REMOTE
1309   {
1310    if (conf_parser_ctx.pass == 2)
1311      block_state.port.value |= OPER_FLAG_RESTART;
1312 + } | REHASH ':' REMOTE
1313 + {
1314 +  if (conf_parser_ctx.pass == 2)
1315 +    block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1316   } | REHASH
1317   {
1318    if (conf_parser_ctx.pass == 2)
# Line 1446 | Line 1349 | oper_flags_item: KILL ':' REMOTE
1349   {
1350    if (conf_parser_ctx.pass == 2)
1351      block_state.port.value |= OPER_FLAG_OPME;
1352 + } | NICK ':' RESV
1353 + {
1354 +  if (conf_parser_ctx.pass == 2)
1355 +    block_state.port.value |= OPER_FLAG_NICK_RESV;
1356 + } | JOIN ':' RESV
1357 + {
1358 +  if (conf_parser_ctx.pass == 2)
1359 +    block_state.port.value |= OPER_FLAG_JOIN_RESV;
1360 + } | RESV
1361 + {
1362 +  if (conf_parser_ctx.pass == 2)
1363 +    block_state.port.value |= OPER_FLAG_RESV;
1364 + } | T_UNRESV
1365 + {
1366 +  if (conf_parser_ctx.pass == 2)
1367 +    block_state.port.value |= OPER_FLAG_UNRESV;
1368 + } | CLOSE
1369 + {
1370 +  if (conf_parser_ctx.pass == 2)
1371 +    block_state.port.value |= OPER_FLAG_CLOSE;
1372   };
1373  
1374  
1375   /***************************************************************************
1376 < *  section class
1376 > * class {} section
1377   ***************************************************************************/
1378   class_entry: CLASS
1379   {
# Line 1478 | Line 1401 | class_entry: CLASS
1401      class = class_make();
1402  
1403    class->active = 1;
1404 <  MyFree(class->name);
1404 >  xfree(class->name);
1405    class->name = xstrdup(block_state.class.buf);
1406    class->ping_freq = block_state.ping_freq.value;
1407    class->max_perip = block_state.max_perip.value;
# Line 1502 | Line 1425 | class_entry: CLASS
1425    class->min_idle = block_state.min_idle.value;
1426    class->max_idle = block_state.max_idle.value;
1427  
1428 <  if (class->number_per_cidr && block_state.number_per_cidr.value)
1506 <    if ((class->cidr_bitlen_ipv4 && block_state.cidr_bitlen_ipv4.value) ||
1507 <        (class->cidr_bitlen_ipv6 && block_state.cidr_bitlen_ipv6.value))
1508 <      if ((class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value) ||
1509 <          (class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value))
1510 <        rebuild_cidr_list(class);
1428 >  rebuild_cidr_list(class);
1429  
1430    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1431    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
# Line 1655 | Line 1573 | class_flags_item: RANDOM_IDLE
1573  
1574  
1575   /***************************************************************************
1576 < *  section listen
1576 > * listen {} section
1577   ***************************************************************************/
1578   listen_entry: LISTEN
1579   {
# Line 1694 | Line 1612 | port_item: NUMBER
1612   {
1613    if (conf_parser_ctx.pass == 2)
1614    {
1615 < #ifndef HAVE_LIBCRYPTO
1615 > #ifndef HAVE_TLS
1616      if (block_state.flags.value & LISTENER_SSL)
1617      {
1618 <      conf_error_report("SSL not available - port closed");
1618 >      conf_error_report("TLS not available - port closed");
1619        break;
1620      }
1621   #endif
1622 <    add_listener($1, block_state.addr.buf, block_state.flags.value);
1622 >    listener_add($1, block_state.addr.buf, block_state.flags.value);
1623    }
1624   } | NUMBER TWODOTS NUMBER
1625   {
1626    if (conf_parser_ctx.pass == 2)
1627    {
1628 < #ifndef HAVE_LIBCRYPTO
1628 > #ifndef HAVE_TLS
1629      if (block_state.flags.value & LISTENER_SSL)
1630      {
1631 <      conf_error_report("SSL not available - port closed");
1631 >      conf_error_report("TLS not available - port closed");
1632        break;
1633      }
1634   #endif
1635  
1636      for (int i = $1; i <= $3; ++i)
1637 <      add_listener(i, block_state.addr.buf, block_state.flags.value);
1637 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1638    }
1639   };
1640  
# Line 1732 | Line 1650 | listen_host: HOST '=' QSTRING ';'
1650      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1651   };
1652  
1653 +
1654   /***************************************************************************
1655 < *  section auth
1655 > * auth {} section
1656   ***************************************************************************/
1657   auth_entry: IRCD_AUTH
1658   {
# Line 1836 | Line 1755 | auth_flags_item: SPOOF_NOTICE
1755   {
1756    if (conf_parser_ctx.pass == 2)
1757      block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1758 + } | XLINE_EXEMPT
1759 + {
1760 +  if (conf_parser_ctx.pass == 2)
1761 +    block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1762   } | NEED_IDENT
1763   {
1764    if (conf_parser_ctx.pass == 2)
# Line 1848 | Line 1771 | auth_flags_item: SPOOF_NOTICE
1771   {
1772    if (conf_parser_ctx.pass == 2)
1773      block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1851 } | GLINE_EXEMPT
1852 {
1853  if (conf_parser_ctx.pass == 2)
1854    block_state.flags.value |= CONF_FLAGS_EXEMPTGLINE;
1774   } | RESV_EXEMPT
1775   {
1776    if (conf_parser_ctx.pass == 2)
# Line 1900 | Line 1819 | auth_redir_port: REDIRPORT '=' NUMBER ';
1819  
1820  
1821   /***************************************************************************
1822 < *  section resv
1822 > * resv {} section
1823   ***************************************************************************/
1824   resv_entry: RESV
1825   {
# Line 1914 | Line 1833 | resv_entry: RESV
1833    if (conf_parser_ctx.pass != 2)
1834      break;
1835  
1836 <  create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1836 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1837   };
1838  
1839   resv_items:     resv_items resv_item | resv_item;
# Line 1940 | Line 1859 | resv_exempt: EXEMPT '=' QSTRING ';'
1859  
1860  
1861   /***************************************************************************
1862 < *  section service
1862 > * service {} section
1863   ***************************************************************************/
1864   service_entry: T_SERVICE '{' service_items '}' ';';
1865  
# Line 1954 | Line 1873 | service_name: NAME '=' QSTRING ';'
1873  
1874    if (valid_servname(yylval.string))
1875    {
1876 <    struct MaskItem *conf = conf_make(CONF_SERVICE);
1877 <    conf->name = xstrdup(yylval.string);
1876 >    struct ServiceItem *service = service_make();
1877 >    service->name = xstrdup(yylval.string);
1878    }
1879   };
1880  
1881 +
1882   /***************************************************************************
1883 < *  section shared, for sharing remote klines etc.
1883 > * shared {} section, for sharing remote klines etc.
1884   ***************************************************************************/
1885   shared_entry: T_SHARED
1886   {
# Line 1975 | Line 1895 | shared_entry: T_SHARED
1895    block_state.flags.value = SHARED_ALL;
1896   } '{' shared_items '}' ';'
1897   {
1978  struct MaskItem *conf = NULL;
1979
1898    if (conf_parser_ctx.pass != 2)
1899      break;
1900  
1901 <  conf = conf_make(CONF_ULINE);
1902 <  conf->flags = block_state.flags.value;
1903 <  conf->name = xstrdup(block_state.name.buf);
1904 <  conf->user = xstrdup(block_state.user.buf);
1905 <  conf->host = xstrdup(block_state.host.buf);
1901 >  struct SharedItem *shared = shared_make();
1902 >  shared->type = block_state.flags.value;
1903 >  shared->server = xstrdup(block_state.name.buf);
1904 >  shared->user = xstrdup(block_state.user.buf);
1905 >  shared->host = xstrdup(block_state.host.buf);
1906   };
1907  
1908   shared_items: shared_items shared_item | shared_item;
# Line 2064 | Line 1982 | shared_type_item: KLINE
1982      block_state.flags.value = SHARED_ALL;
1983   };
1984  
1985 +
1986   /***************************************************************************
1987 < *  section cluster
1987 > * cluster {} section
1988   ***************************************************************************/
1989   cluster_entry: T_CLUSTER
1990   {
# Line 2075 | Line 1994 | cluster_entry: T_CLUSTER
1994    reset_block_state();
1995  
1996    strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1997 <  block_state.flags.value = SHARED_ALL;
1997 >  block_state.flags.value = CLUSTER_ALL;
1998   } '{' cluster_items '}' ';'
1999   {
2081  struct MaskItem *conf = NULL;
2082
2000    if (conf_parser_ctx.pass != 2)
2001      break;
2002  
2003 <  conf = conf_make(CONF_CLUSTER);
2004 <  conf->flags = block_state.flags.value;
2005 <  conf->name = xstrdup(block_state.name.buf);
2003 >  struct ClusterItem *cluster = cluster_make();
2004 >  cluster->type = block_state.flags.value;
2005 >  cluster->server = xstrdup(block_state.name.buf);
2006   };
2007  
2008   cluster_items:  cluster_items cluster_item | cluster_item;
# Line 2107 | Line 2024 | cluster_types:  cluster_types ',' cluste
2024   cluster_type_item: KLINE
2025   {
2026    if (conf_parser_ctx.pass == 2)
2027 <    block_state.flags.value |= SHARED_KLINE;
2027 >    block_state.flags.value |= CLUSTER_KLINE;
2028   } | UNKLINE
2029   {
2030    if (conf_parser_ctx.pass == 2)
2031 <    block_state.flags.value |= SHARED_UNKLINE;
2031 >    block_state.flags.value |= CLUSTER_UNKLINE;
2032   } | T_DLINE
2033   {
2034    if (conf_parser_ctx.pass == 2)
2035 <    block_state.flags.value |= SHARED_DLINE;
2035 >    block_state.flags.value |= CLUSTER_DLINE;
2036   } | T_UNDLINE
2037   {
2038    if (conf_parser_ctx.pass == 2)
2039 <    block_state.flags.value |= SHARED_UNDLINE;
2039 >    block_state.flags.value |= CLUSTER_UNDLINE;
2040   } | XLINE
2041   {
2042    if (conf_parser_ctx.pass == 2)
2043 <    block_state.flags.value |= SHARED_XLINE;
2043 >    block_state.flags.value |= CLUSTER_XLINE;
2044   } | T_UNXLINE
2045   {
2046    if (conf_parser_ctx.pass == 2)
2047 <    block_state.flags.value |= SHARED_UNXLINE;
2047 >    block_state.flags.value |= CLUSTER_UNXLINE;
2048   } | RESV
2049   {
2050    if (conf_parser_ctx.pass == 2)
2051 <    block_state.flags.value |= SHARED_RESV;
2051 >    block_state.flags.value |= CLUSTER_RESV;
2052   } | T_UNRESV
2053   {
2054    if (conf_parser_ctx.pass == 2)
2055 <    block_state.flags.value |= SHARED_UNRESV;
2055 >    block_state.flags.value |= CLUSTER_UNRESV;
2056   } | T_LOCOPS
2057   {
2058    if (conf_parser_ctx.pass == 2)
2059 <    block_state.flags.value |= SHARED_LOCOPS;
2059 >    block_state.flags.value |= CLUSTER_LOCOPS;
2060   } | T_ALL
2061   {
2062    if (conf_parser_ctx.pass == 2)
2063 <    block_state.flags.value = SHARED_ALL;
2063 >    block_state.flags.value = CLUSTER_ALL;
2064   };
2065  
2066 +
2067   /***************************************************************************
2068 < *  section connect
2068 > * connect {}  section
2069   ***************************************************************************/
2070   connect_entry: CONNECT
2071   {
# Line 2351 | Line 2269 | connect_class: CLASS '=' QSTRING ';'
2269  
2270   connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2271   {
2272 < #ifdef HAVE_LIBCRYPTO
2272 > #ifdef HAVE_TLS
2273    if (conf_parser_ctx.pass == 2)
2274      strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2275   #else
2276    if (conf_parser_ctx.pass == 2)
2277 <    conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2277 >    conf_error_report("Ignoring connect::ciphers -- no TLS support");
2278   #endif
2279   };
2280  
2281  
2282   /***************************************************************************
2283 < *  section kill
2283 > * kill {} section
2284   ***************************************************************************/
2285   kill_entry: KILL
2286   {
# Line 2419 | Line 2337 | kill_reason: REASON '=' QSTRING ';'
2337      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2338   };
2339  
2340 +
2341   /***************************************************************************
2342 < *  section deny
2342 > * deny {} section
2343   ***************************************************************************/
2344   deny_entry: DENY
2345   {
# Line 2464 | Line 2383 | deny_reason: REASON '=' QSTRING ';'
2383      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2384   };
2385  
2386 +
2387   /***************************************************************************
2388 < *  section exempt
2388 > * exempt {} section
2389   ***************************************************************************/
2390   exempt_entry: EXEMPT '{' exempt_items '}' ';';
2391  
2392 < exempt_items:     exempt_items exempt_item | exempt_item;
2393 < exempt_item:      exempt_ip | error;
2392 > exempt_items: exempt_items exempt_item | exempt_item;
2393 > exempt_item:  exempt_ip | error;
2394  
2395   exempt_ip: IP '=' QSTRING ';'
2396   {
2397    if (conf_parser_ctx.pass == 2)
2398    {
2399 <    if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2399 >    if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2400      {
2401        struct MaskItem *conf = conf_make(CONF_EXEMPT);
2402        conf->host = xstrdup(yylval.string);
# Line 2487 | Line 2407 | exempt_ip: IP '=' QSTRING ';'
2407   };
2408  
2409   /***************************************************************************
2410 < *  section gecos
2410 > * gecos {} section
2411   ***************************************************************************/
2412   gecos_entry: GECOS
2413   {
# Line 2527 | Line 2447 | gecos_reason: REASON '=' QSTRING ';'
2447      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2448   };
2449  
2450 +
2451   /***************************************************************************
2452 < *  section general
2452 > * general {} section
2453   ***************************************************************************/
2454 < general_entry: GENERAL
2534 <  '{' general_items '}' ';';
2454 > general_entry: GENERAL '{' general_items '}' ';';
2455  
2456   general_items:      general_items general_item | general_item;
2457   general_item:       general_away_count |
# Line 2549 | Line 2469 | general_item:       general_away_count |
2469                      general_invisible_on_connect |
2470                      general_warn_no_connect_block |
2471                      general_dots_in_ident |
2552                    general_stats_o_oper_only |
2553                    general_stats_k_oper_only |
2554                    general_pace_wait |
2472                      general_stats_i_oper_only |
2473 <                    general_pace_wait_simple |
2473 >                    general_stats_k_oper_only |
2474 >                    general_stats_m_oper_only |
2475 >                    general_stats_o_oper_only |
2476                      general_stats_P_oper_only |
2477                      general_stats_u_oper_only |
2478 +                    general_pace_wait |
2479 +                    general_pace_wait_simple |
2480                      general_short_motd |
2481                      general_no_oper_flood |
2561                    general_oper_pass_resv |
2482                      general_oper_only_umodes |
2483                      general_max_targets |
2484                      general_oper_umodes |
# Line 2569 | Line 2489 | general_item:       general_away_count |
2489                      general_min_nonwildcard_simple |
2490                      general_throttle_count |
2491                      general_throttle_time |
2572                    general_havent_read_conf |
2492                      general_ping_cookie |
2493                      general_disable_auth |
2494                      general_tkline_expire_notices |
2495 <                    general_gline_enable |
2496 <                    general_gline_duration |
2497 <                    general_gline_request_duration |
2498 <                    general_gline_min_cidr |
2580 <                    general_gline_min_cidr6 |
2495 >                    general_dline_min_cidr |
2496 >                    general_dline_min_cidr6 |
2497 >                    general_kline_min_cidr |
2498 >                    general_kline_min_cidr6 |
2499                      general_stats_e_disabled |
2500                      general_max_watch |
2501                      general_cycle_on_host_change |
# Line 2605 | Line 2523 | general_cycle_on_host_change: CYCLE_ON_H
2523      ConfigGeneral.cycle_on_host_change = yylval.number;
2524   };
2525  
2526 < general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2609 < {
2610 <  if (conf_parser_ctx.pass == 2)
2611 <    ConfigGeneral.glines = yylval.number;
2612 < };
2613 <
2614 < general_gline_duration: GLINE_DURATION '=' timespec ';'
2526 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2527   {
2528 <  if (conf_parser_ctx.pass == 2)
2617 <    ConfigGeneral.gline_time = $3;
2528 >  ConfigGeneral.dline_min_cidr = $3;
2529   };
2530  
2531 < general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2531 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2532   {
2533 <  if (conf_parser_ctx.pass == 2)
2623 <    ConfigGeneral.gline_request_time = $3;
2533 >  ConfigGeneral.dline_min_cidr6 = $3;
2534   };
2535  
2536 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2536 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2537   {
2538 <  ConfigGeneral.gline_min_cidr = $3;
2538 >  ConfigGeneral.kline_min_cidr = $3;
2539   };
2540  
2541 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2541 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2542   {
2543 <  ConfigGeneral.gline_min_cidr6 = $3;
2543 >  ConfigGeneral.kline_min_cidr6 = $3;
2544   };
2545  
2546   general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
# Line 2689 | Line 2599 | general_ts_max_delta: TS_MAX_DELTA '=' t
2599      ConfigGeneral.ts_max_delta = $3;
2600   };
2601  
2692 general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2693 {
2694  if (($3 > 0) && conf_parser_ctx.pass == 1)
2695  {
2696    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2697    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2698    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2699    exit(0);
2700  }
2701 };
2702
2602   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2603   {
2604    ConfigGeneral.invisible_on_connect = yylval.number;
# Line 2715 | Line 2614 | general_stats_e_disabled: STATS_E_DISABL
2614    ConfigGeneral.stats_e_disabled = yylval.number;
2615   };
2616  
2617 + general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2618 + {
2619 +  ConfigGeneral.stats_m_oper_only = yylval.number;
2620 + };
2621 +
2622   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2623   {
2624    ConfigGeneral.stats_o_oper_only = yylval.number;
# Line 2776 | Line 2680 | general_no_oper_flood: NO_OPER_FLOOD '='
2680    ConfigGeneral.no_oper_flood = yylval.number;
2681   };
2682  
2779 general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2780 {
2781  ConfigGeneral.oper_pass_resv = yylval.number;
2782 };
2783
2683   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2684   {
2685    ConfigGeneral.dots_in_ident = $3;
# Line 2970 | Line 2869 | general_default_floodcount: DEFAULT_FLOO
2869  
2870  
2871   /***************************************************************************
2872 < *  section channel
2872 > * channel {} section
2873   ***************************************************************************/
2874 < channel_entry: CHANNEL
2976 <  '{' channel_items '}' ';';
2874 > channel_entry: CHANNEL '{' channel_items '}' ';';
2875  
2876   channel_items:      channel_items channel_item | channel_item;
2877   channel_item:       channel_max_bans |
2878                      channel_invite_client_count |
2879                      channel_invite_client_time |
2880 +                    channel_invite_delay_channel |
2881                      channel_knock_client_count |
2882                      channel_knock_client_time |
2883                      channel_knock_delay_channel |
2884                      channel_max_channels |
2885 <                    channel_default_split_user_count |
2886 <                    channel_default_split_server_count |
2988 <                    channel_no_create_on_split |
2989 <                    channel_no_join_on_split |
2990 <                    channel_jflood_count |
2991 <                    channel_jflood_time |
2885 >                    channel_default_join_flood_count |
2886 >                    channel_default_join_flood_time |
2887                      channel_disable_fake_channels |
2888                      error;
2889  
# Line 3007 | Line 2902 | channel_invite_client_time: INVITE_CLIEN
2902    ConfigChannel.invite_client_time = $3;
2903   };
2904  
2905 + channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2906 + {
2907 +  ConfigChannel.invite_delay_channel = $3;
2908 + };
2909 +
2910   channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2911   {
2912    ConfigChannel.knock_client_count = $3;
# Line 3032 | Line 2932 | channel_max_bans: MAX_BANS '=' NUMBER ';
2932    ConfigChannel.max_bans = $3;
2933   };
2934  
2935 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
3036 < {
3037 <  ConfigChannel.default_split_user_count = $3;
3038 < };
3039 <
3040 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
3041 < {
3042 <  ConfigChannel.default_split_server_count = $3;
3043 < };
3044 <
3045 < channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
3046 < {
3047 <  ConfigChannel.no_create_on_split = yylval.number;
3048 < };
3049 <
3050 < channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2935 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2936   {
2937 <  ConfigChannel.no_join_on_split = yylval.number;
2937 >  ConfigChannel.default_join_flood_count = yylval.number;
2938   };
2939  
2940 < channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2940 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2941   {
2942 <  GlobalSetOptions.joinfloodcount = yylval.number;
2942 >  ConfigChannel.default_join_flood_time = $3;
2943   };
2944  
3060 channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
3061 {
3062  GlobalSetOptions.joinfloodtime = $3;
3063 };
2945  
2946   /***************************************************************************
2947 < *  section serverhide
2947 > * serverhide {} section
2948   ***************************************************************************/
2949 < serverhide_entry: SERVERHIDE
3069 <  '{' serverhide_items '}' ';';
2949 > serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2950  
2951   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2952   serverhide_item:    serverhide_flatten_links |
2953 +                    serverhide_flatten_links_delay |
2954 +                    serverhide_flatten_links_file |
2955                      serverhide_disable_remote_commands |
2956                      serverhide_hide_servers |
2957                      serverhide_hide_services |
3076                    serverhide_links_delay |
2958                      serverhide_hidden |
2959                      serverhide_hidden_name |
2960                      serverhide_hide_server_ips |
# Line 3085 | Line 2966 | serverhide_flatten_links: FLATTEN_LINKS
2966      ConfigServerHide.flatten_links = yylval.number;
2967   };
2968  
2969 + serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2970 + {
2971 +  if (conf_parser_ctx.pass == 2)
2972 +  {
2973 +    if ($3 > 0)
2974 +    {
2975 +      event_write_links_file.when = $3;
2976 +      event_add(&event_write_links_file, NULL);
2977 +    }
2978 +    else
2979 +     event_delete(&event_write_links_file);
2980 +
2981 +    ConfigServerHide.flatten_links_delay = $3;
2982 +  }
2983 + };
2984 +
2985 + serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2986 + {
2987 +  if (conf_parser_ctx.pass == 2)
2988 +  {
2989 +    xfree(ConfigServerHide.flatten_links_file);
2990 +    ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2991 +  }
2992 + };
2993 +
2994   serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2995   {
2996    if (conf_parser_ctx.pass == 2)
# Line 3107 | Line 3013 | serverhide_hidden_name: HIDDEN_NAME '='
3013   {
3014    if (conf_parser_ctx.pass == 2)
3015    {
3016 <    MyFree(ConfigServerHide.hidden_name);
3016 >    xfree(ConfigServerHide.hidden_name);
3017      ConfigServerHide.hidden_name = xstrdup(yylval.string);
3018    }
3019   };
3020  
3115 serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3116 {
3117  if (conf_parser_ctx.pass == 2)
3118  {
3119    if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3120    {
3121      event_write_links_file.when = $3;
3122      event_addish(&event_write_links_file, NULL);
3123      ConfigServerHide.links_disabled = 0;
3124    }
3125
3126    ConfigServerHide.links_delay = $3;
3127  }
3128 };
3129
3021   serverhide_hidden: HIDDEN '=' TBOOL ';'
3022   {
3023    if (conf_parser_ctx.pass == 2)

Diff Legend

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