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 4499 by michael, Sat Aug 16 18:29:23 2014 UTC vs.
Revision 8877 by michael, Sat Feb 16 22:42:59 2019 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-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 15 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# 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 "parse.h"
35   #include "conf.h"
36   #include "conf_class.h"
37 + #include "conf_cluster.h"
38 + #include "conf_gecos.h"
39 + #include "conf_pseudo.h"
40 + #include "conf_resv.h"
41 + #include "conf_service.h"
42 + #include "conf_shared.h"
43   #include "event.h"
44 + #include "id.h"
45   #include "log.h"
42 #include "client.h"     /* for UMODE_ALL only */
46   #include "irc_string.h"
47   #include "memory.h"
48   #include "modules.h"
49   #include "server.h"
50   #include "hostmask.h"
48 #include "send.h"
51   #include "listener.h"
50 #include "resv.h"
51 #include "numeric.h"
52   #include "user.h"
53   #include "motd.h"
54  
55 #ifdef HAVE_LIBCRYPTO
56 #include <openssl/rsa.h>
57 #include <openssl/bio.h>
58 #include <openssl/pem.h>
59 #include <openssl/dh.h>
60 #endif
61
62 #include "rsa.h"
63
55   int yylex(void);
56  
57   static struct
# Line 76 | Line 67 | static struct
67    {
68      char buf[IRCD_BUFSIZE];
69    } name,
70 +    nick,
71      user,
72      host,
73      addr,
# Line 85 | Line 77 | static struct
77      cert,
78      rpass,
79      spass,
80 <    class;
80 >    whois,
81 >    class,
82 >    target,
83 >    prepend,
84 >    command;
85  
86    struct
87    {
# Line 97 | 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,
105    max_global,
106    max_local,
107    max_ident,
102      max_sendq,
103      max_recvq,
104      max_channels,
# Line 116 | Line 110 | static struct
110   static void
111   reset_block_state(void)
112   {
113 <  dlink_node *ptr = NULL, *ptr_next = NULL;
113 >  dlink_node *node = NULL, *node_next = NULL;
114  
115 <  DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.mask.list.head)
115 >  DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head)
116    {
117 <    MyFree(ptr->data);
118 <    dlinkDelete(ptr, &block_state.mask.list);
119 <    free_dlink_node(ptr);
117 >    xfree(node->data);
118 >    dlinkDelete(node, &block_state.mask.list);
119 >    free_dlink_node(node);
120    }
121  
122 <  DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.leaf.list.head)
122 >  DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head)
123    {
124 <    MyFree(ptr->data);
125 <    dlinkDelete(ptr, &block_state.leaf.list);
126 <    free_dlink_node(ptr);
124 >    xfree(node->data);
125 >    dlinkDelete(node, &block_state.leaf.list);
126 >    free_dlink_node(node);
127    }
128  
129 <  DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.hub.list.head)
129 >  DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head)
130    {
131 <    MyFree(ptr->data);
132 <    dlinkDelete(ptr, &block_state.hub.list);
133 <    free_dlink_node(ptr);
131 >    xfree(node->data);
132 >    dlinkDelete(node, &block_state.hub.list);
133 >    free_dlink_node(node);
134    }
135  
136    memset(&block_state, 0, sizeof(block_state));
# Line 164 | Line 158 | reset_block_state(void)
158   %token  CIDR_BITLEN_IPV4
159   %token  CIDR_BITLEN_IPV6
160   %token  CLASS
161 + %token  CLOSE
162   %token  CONNECT
163   %token  CONNECTFREQ
164   %token  CYCLE_ON_HOST_CHANGE
165   %token  DEFAULT_FLOODCOUNT
166 < %token  DEFAULT_SPLIT_SERVER_COUNT
167 < %token  DEFAULT_SPLIT_USER_COUNT
166 > %token  DEFAULT_FLOODTIME
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
180 %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
189 %token  GLINE
190 %token  GLINE_DURATION
191 %token  GLINE_ENABLE
192 %token  GLINE_EXEMPT
193 %token  GLINE_MIN_CIDR
194 %token  GLINE_MIN_CIDR6
195 %token  GLINE_REQUEST_DURATION
196 %token  GLOBAL_KILL
197 %token  HAVENT_READ_CONF
189   %token  HIDDEN
190   %token  HIDDEN_NAME
191   %token  HIDE_CHANS
# Line 203 | Line 194 | reset_block_state(void)
194   %token  HIDE_SERVER_IPS
195   %token  HIDE_SERVERS
196   %token  HIDE_SERVICES
206 %token  HIDE_SPOOF_IPS
197   %token  HOST
198   %token  HUB
199   %token  HUB_MASK
210 %token  IGNORE_BOGUS_TS
200   %token  INVISIBLE_ON_CONNECT
201   %token  INVITE_CLIENT_COUNT
202   %token  INVITE_CLIENT_TIME
203 + %token  INVITE_DELAY_CHANNEL
204 + %token  INVITE_EXPIRE_TIME
205   %token  IP
206   %token  IRCD_AUTH
207   %token  IRCD_FLAGS
208   %token  IRCD_SID
209 < %token  JOIN_FLOOD_COUNT
219 < %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
228 %token  LINKS_DELAY
220   %token  LISTEN
221   %token  MASK
222   %token  MAX_ACCEPT
223   %token  MAX_BANS
224 + %token  MAX_BANS_LARGE
225   %token  MAX_CHANNELS
234 %token  MAX_GLOBAL
235 %token  MAX_IDENT
226   %token  MAX_IDLE
227 < %token  MAX_LOCAL
227 > %token  MAX_INVITES
228   %token  MAX_NICK_CHANGES
229   %token  MAX_NICK_LENGTH
230   %token  MAX_NICK_TIME
# Line 254 | Line 244 | reset_block_state(void)
244   %token  NETWORK_DESC
245   %token  NETWORK_NAME
246   %token  NICK
257 %token  NO_CREATE_ON_SPLIT
258 %token  NO_JOIN_ON_SPLIT
247   %token  NO_OPER_FLOOD
248   %token  NO_TILDE
249   %token  NUMBER
250   %token  NUMBER_PER_CIDR
251 < %token  NUMBER_PER_IP
251 > %token  NUMBER_PER_IP_GLOBAL
252 > %token  NUMBER_PER_IP_LOCAL
253   %token  OPER_ONLY_UMODES
265 %token  OPER_PASS_RESV
254   %token  OPER_UMODES
255   %token  OPERATOR
256   %token  OPERS_BYPASS_CALLERID
# Line 284 | Line 272 | reset_block_state(void)
272   %token  RESV
273   %token  RESV_EXEMPT
274   %token  RSA_PRIVATE_KEY_FILE
287 %token  RSA_PUBLIC_KEY_FILE
275   %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
276   %token  SEND_PASSWORD
277   %token  SENDQ
# Line 303 | Line 290 | reset_block_state(void)
290   %token  STATS_E_DISABLED
291   %token  STATS_I_OPER_ONLY
292   %token  STATS_K_OPER_ONLY
293 + %token  STATS_M_OPER_ONLY
294   %token  STATS_O_OPER_ONLY
295   %token  STATS_P_OPER_ONLY
296   %token  STATS_U_OPER_ONLY
297   %token  T_ALL
298 + %token  T_BIND
299   %token  T_BOTS
300   %token  T_CALLERID
301   %token  T_CCONN
302 + %token  T_COMMAND
303   %token  T_CLUSTER
304   %token  T_DEAF
305   %token  T_DEBUG
# Line 324 | Line 314 | reset_block_state(void)
314   %token  T_IPV6
315   %token  T_LOCOPS
316   %token  T_LOG
327 %token  T_MAX_CLIENTS
317   %token  T_NCHANGE
318   %token  T_NONONREG
319 + %token  T_OPME
320 + %token  T_PREPEND
321 + %token  T_PSEUDO
322   %token  T_RECVQ
323   %token  T_REJ
324   %token  T_RESTART
325   %token  T_SERVER
326   %token  T_SERVICE
335 %token  T_SERVICES_NAME
327   %token  T_SERVNOTICE
328   %token  T_SET
329   %token  T_SHARED
# Line 342 | Line 333 | reset_block_state(void)
333   %token  T_SPY
334   %token  T_SSL
335   %token  T_SSL_CIPHER_LIST
336 + %token  T_TARGET
337   %token  T_UMODES
338   %token  T_UNAUTH
339   %token  T_UNDLINE
# Line 356 | Line 348 | reset_block_state(void)
348   %token  THROTTLE_TIME
349   %token  TKLINE_EXPIRE_NOTICES
350   %token  TMASKED
359 %token  TRUE_NO_OPER_FLOOD
351   %token  TS_MAX_DELTA
352   %token  TS_WARN_DELTA
353   %token  TWODOTS
354   %token  TYPE
355   %token  UNKLINE
365 %token  USE_EGD
356   %token  USE_LOGGING
357   %token  USER
358   %token  VHOST
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  
366   %type  <string> QSTRING
367   %type  <number> NUMBER
# Line 403 | Line 396 | conf_item:        admin_entry
396                  | gecos_entry
397                  | modules_entry
398                  | motd_entry
399 +                | pseudo_entry
400                  | error ';'
401                  | error '}'
402          ;
# Line 428 | Line 422 | sizespec:   NUMBER sizespec_ { $$ = $1 +
422  
423  
424   /***************************************************************************
425 < *  section modules
425 > * modules {} section
426   ***************************************************************************/
427 < modules_entry: MODULES
434 <  '{' modules_items '}' ';';
427 > modules_entry: MODULES '{' modules_items '}' ';';
428  
429   modules_items:  modules_items modules_item | modules_item;
430   modules_item:   modules_module | modules_path | error ';' ;
# Line 449 | Line 442 | modules_path: PATH '=' QSTRING ';'
442   };
443  
444  
445 + /***************************************************************************
446 + * serverinfo {}  section
447 + ***************************************************************************/
448   serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
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 |
455                          serverinfo_network_desc |
456 <                        serverinfo_max_clients |
456 >                        serverinfo_default_max_clients |
457                          serverinfo_max_nick_length |
458                          serverinfo_max_topic_length |
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 |
# Line 474 | Line 468 | serverinfo_item:        serverinfo_name
468  
469   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
470   {
477 #ifdef HAVE_LIBCRYPTO
471    if (conf_parser_ctx.pass == 2)
472    {
473 <    if (!ConfigServerInfo.rsa_private_key_file)
474 <    {
482 <      conf_error_report("No rsa_private_key_file specified, SSL disabled");
483 <      break;
484 <    }
485 <
486 <    if (SSL_CTX_use_certificate_file(ConfigServerInfo.server_ctx, yylval.string,
487 <                                     SSL_FILETYPE_PEM) <= 0 ||
488 <        SSL_CTX_use_certificate_file(ConfigServerInfo.client_ctx, yylval.string,
489 <                                     SSL_FILETYPE_PEM) <= 0)
490 <    {
491 <      report_crypto_errors();
492 <      conf_error_report("Could not open/read certificate file");
493 <      break;
494 <    }
495 <
496 <    if (SSL_CTX_use_PrivateKey_file(ConfigServerInfo.server_ctx, ConfigServerInfo.rsa_private_key_file,
497 <                                    SSL_FILETYPE_PEM) <= 0 ||
498 <        SSL_CTX_use_PrivateKey_file(ConfigServerInfo.client_ctx, ConfigServerInfo.rsa_private_key_file,
499 <                                    SSL_FILETYPE_PEM) <= 0)
500 <    {
501 <      report_crypto_errors();
502 <      conf_error_report("Could not read RSA private key");
503 <      break;
504 <    }
505 <
506 <    if (!SSL_CTX_check_private_key(ConfigServerInfo.server_ctx) ||
507 <        !SSL_CTX_check_private_key(ConfigServerInfo.client_ctx))
508 <    {
509 <      report_crypto_errors();
510 <      conf_error_report("Could not read RSA private key");
511 <      break;
512 <    }
473 >    xfree(ConfigServerInfo.ssl_certificate_file);
474 >    ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string);
475    }
514 #endif
476   };
477  
478   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
479   {
480 < #ifdef HAVE_LIBCRYPTO
520 <  BIO *file = NULL;
521 <
522 <  if (conf_parser_ctx.pass != 1)
523 <    break;
524 <
525 <  if (ConfigServerInfo.rsa_private_key)
526 <  {
527 <    RSA_free(ConfigServerInfo.rsa_private_key);
528 <    ConfigServerInfo.rsa_private_key = NULL;
529 <  }
530 <
531 <  if (ConfigServerInfo.rsa_private_key_file)
532 <  {
533 <    MyFree(ConfigServerInfo.rsa_private_key_file);
534 <    ConfigServerInfo.rsa_private_key_file = NULL;
535 <  }
536 <
537 <  ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
538 <
539 <  if ((file = BIO_new_file(yylval.string, "r")) == NULL)
540 <  {
541 <    conf_error_report("File open failed, ignoring");
542 <    break;
543 <  }
544 <
545 <  ConfigServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
546 <
547 <  BIO_set_close(file, BIO_CLOSE);
548 <  BIO_free(file);
549 <
550 <  if (ConfigServerInfo.rsa_private_key == NULL)
551 <  {
552 <    conf_error_report("Couldn't extract key, ignoring");
553 <    break;
554 <  }
555 <
556 <  if (!RSA_check_key(ConfigServerInfo.rsa_private_key))
557 <  {
558 <    RSA_free(ConfigServerInfo.rsa_private_key);
559 <    ConfigServerInfo.rsa_private_key = NULL;
560 <
561 <    conf_error_report("Invalid key, ignoring");
562 <    break;
563 <  }
564 <
565 <  if (RSA_size(ConfigServerInfo.rsa_private_key) < 128)
480 >  if (conf_parser_ctx.pass == 2)
481    {
482 <    RSA_free(ConfigServerInfo.rsa_private_key);
483 <    ConfigServerInfo.rsa_private_key = NULL;
569 <
570 <    conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size");
482 >    xfree(ConfigServerInfo.rsa_private_key_file);
483 >    ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
484    }
572 #endif
485   };
486  
487   serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
488   {
577 #ifdef HAVE_LIBCRYPTO
489    if (conf_parser_ctx.pass == 2)
490    {
491 <    BIO *file = BIO_new_file(yylval.string, "r");
492 <
582 <    if (file)
583 <    {
584 <      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
585 <
586 <      BIO_free(file);
587 <
588 <      if (dh)
589 <      {
590 <        if (DH_size(dh) < 128)
591 <          conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
592 <        else
593 <          SSL_CTX_set_tmp_dh(ConfigServerInfo.server_ctx, dh);
594 <
595 <        DH_free(dh);
596 <      }
597 <    }
598 <    else
599 <      conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- could not open/read Diffie-Hellman parameter file");
491 >    xfree(ConfigServerInfo.ssl_dh_param_file);
492 >    ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string);
493    }
601 #endif
494   };
495  
496   serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
497   {
606 #ifdef HAVE_LIBCRYPTO
498    if (conf_parser_ctx.pass == 2)
499 <    SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, yylval.string);
500 < #endif
499 >  {
500 >    xfree(ConfigServerInfo.ssl_cipher_list);
501 >    ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string);
502 >  }
503   };
504  
505   serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
506   {
614 #ifdef HAVE_LIBCRYPTO
507    if (conf_parser_ctx.pass == 2)
508    {
509 <    if ((ConfigServerInfo.message_digest_algorithm = EVP_get_digestbyname(yylval.string)) == NULL)
510 <    {
619 <      ConfigServerInfo.message_digest_algorithm = EVP_sha256();
620 <      conf_error_report("Ignoring serverinfo::ssl_message_digest_algorithm -- unknown message digest algorithm");
621 <    }
509 >    xfree(ConfigServerInfo.ssl_message_digest_algorithm);
510 >    ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string);
511    }
623 #endif
512   }
513  
514   serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';'
515   {
628 #ifdef HAVE_LIBCRYPTO
629 #if OPENSSL_VERSION_NUMBER >= 0x1000005FL && !defined(OPENSSL_NO_ECDH)
630  int nid = 0;
631  EC_KEY *key = NULL;
632
516    if (conf_parser_ctx.pass == 2)
517    {
518 <    if ((nid = OBJ_sn2nid(yylval.string)) == 0)
519 <    {
520 <        conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- unknown curve name");
638 <        break;
639 <    }
640 <
641 <    if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
642 <    {
643 <      conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- could not create curve");
644 <      break;
645 <    }
646 <
647 <    SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key);
648 <    EC_KEY_free(key);
649 < }
650 < #endif
651 < #endif
518 >    xfree(ConfigServerInfo.ssl_dh_elliptic_curve);
519 >    ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string);
520 >  }
521   };
522  
523   serverinfo_name: NAME '=' QSTRING ';'
524   {
525 <  /* this isn't rehashable */
526 <  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
525 >  /* This isn't rehashable */
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      {
532        conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
533 <      exit(0);
533 >      exit(EXIT_FAILURE);
534      }
535    }
536   };
537  
538   serverinfo_sid: IRCD_SID '=' QSTRING ';'
539   {
540 <  /* this isn't rehashable */
541 <  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
540 >  /* This isn't rehashable */
541 >  if (conf_parser_ctx.pass == 2 && ConfigServerInfo.sid == NULL)
542    {
543      if (valid_sid(yylval.string))
544        ConfigServerInfo.sid = xstrdup(yylval.string);
545      else
546      {
547        conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
548 <      exit(0);
548 >      exit(EXIT_FAILURE);
549      }
550    }
551   };
# Line 685 | Line 554 | serverinfo_description: DESCRIPTION '='
554   {
555    if (conf_parser_ctx.pass == 2)
556    {
557 <    MyFree(ConfigServerInfo.description);
557 >    xfree(ConfigServerInfo.description);
558      ConfigServerInfo.description = xstrdup(yylval.string);
559 +    strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
560    }
561   };
562  
# Line 699 | Line 569 | serverinfo_network_name: NETWORK_NAME '=
569      if ((p = strchr(yylval.string, ' ')))
570        *p = '\0';
571  
572 <    MyFree(ConfigServerInfo.network_name);
572 >    xfree(ConfigServerInfo.network_name);
573      ConfigServerInfo.network_name = xstrdup(yylval.string);
574    }
575   };
# Line 709 | Line 579 | serverinfo_network_desc: NETWORK_DESC '=
579    if (conf_parser_ctx.pass != 2)
580      break;
581  
582 <  MyFree(ConfigServerInfo.network_desc);
582 >  xfree(ConfigServerInfo.network_desc);
583    ConfigServerInfo.network_desc = xstrdup(yylval.string);
584   };
585  
586 < serverinfo_vhost: VHOST '=' QSTRING ';'
717 < {
718 <  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
719 <  {
720 <    struct addrinfo hints, *res;
721 <
722 <    memset(&hints, 0, sizeof(hints));
723 <
724 <    hints.ai_family   = AF_UNSPEC;
725 <    hints.ai_socktype = SOCK_STREAM;
726 <    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
727 <
728 <    if (getaddrinfo(yylval.string, NULL, &hints, &res))
729 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
730 <    else
731 <    {
732 <      assert(res);
733 <
734 <      memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen);
735 <      ConfigServerInfo.ip.ss.ss_family = res->ai_family;
736 <      ConfigServerInfo.ip.ss_len = res->ai_addrlen;
737 <      freeaddrinfo(res);
738 <
739 <      ConfigServerInfo.specific_ipv4_vhost = 1;
740 <    }
741 <  }
742 < };
743 <
744 < serverinfo_vhost6: VHOST6 '=' QSTRING ';'
745 < {
746 <  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
747 <  {
748 <    struct addrinfo hints, *res;
749 <
750 <    memset(&hints, 0, sizeof(hints));
751 <
752 <    hints.ai_family   = AF_UNSPEC;
753 <    hints.ai_socktype = SOCK_STREAM;
754 <    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
755 <
756 <    if (getaddrinfo(yylval.string, NULL, &hints, &res))
757 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
758 <    else
759 <    {
760 <      assert(res);
761 <
762 <      memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen);
763 <      ConfigServerInfo.ip6.ss.ss_family = res->ai_family;
764 <      ConfigServerInfo.ip6.ss_len = res->ai_addrlen;
765 <      freeaddrinfo(res);
766 <
767 <      ConfigServerInfo.specific_ipv6_vhost = 1;
768 <    }
769 <  }
770 < };
771 <
772 < serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
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 <
781 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
782 <    conf_error_report(buf);
783 <    ConfigServerInfo.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 <    ConfigServerInfo.max_clients = MAXCLIENTS_MAX;
602 >
603 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
604    }
605    else
606 <    ConfigServerInfo.max_clients = $3;
606 >    ConfigServerInfo.default_max_clients = $3;
607   };
608  
609   serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
# Line 810 | 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 832 | 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 844 | Line 658 | serverinfo_hub: HUB '=' TBOOL ';'
658      ConfigServerInfo.hub = yylval.number;
659   };
660  
661 +
662   /***************************************************************************
663 < * admin section
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 860 | Line 675 | admin_name: NAME '=' QSTRING ';'
675    if (conf_parser_ctx.pass != 2)
676      break;
677  
678 <  MyFree(ConfigAdminInfo.name);
678 >  xfree(ConfigAdminInfo.name);
679    ConfigAdminInfo.name = xstrdup(yylval.string);
680   };
681  
# Line 869 | Line 684 | admin_email: EMAIL '=' QSTRING ';'
684    if (conf_parser_ctx.pass != 2)
685      break;
686  
687 <  MyFree(ConfigAdminInfo.email);
687 >  xfree(ConfigAdminInfo.email);
688    ConfigAdminInfo.email = xstrdup(yylval.string);
689   };
690  
# Line 878 | Line 693 | admin_description: DESCRIPTION '=' QSTRI
693    if (conf_parser_ctx.pass != 2)
694      break;
695  
696 <  MyFree(ConfigAdminInfo.description);
696 >  xfree(ConfigAdminInfo.description);
697    ConfigAdminInfo.description = xstrdup(yylval.string);
698   };
699  
700 +
701   /***************************************************************************
702 < * motd section
702 > * motd {} section
703   ***************************************************************************/
704   motd_entry: MOTD
705   {
# Line 891 | Line 707 | motd_entry: MOTD
707      reset_block_state();
708   } '{' motd_items '}' ';'
709   {
710 <  dlink_node *ptr = NULL;
710 >  dlink_node *node = NULL;
711  
712    if (conf_parser_ctx.pass != 2)
713      break;
# Line 899 | Line 715 | motd_entry: MOTD
715    if (!block_state.file.buf[0])
716      break;
717  
718 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
719 <    motd_add(ptr->data, block_state.file.buf);
718 >  DLINK_FOREACH(node, block_state.mask.list.head)
719 >    motd_add(node->data, block_state.file.buf);
720   };
721  
722   motd_items: motd_items motd_item | motd_item;
# Line 918 | Line 734 | motd_file: T_FILE '=' QSTRING ';'
734      strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
735   };
736  
737 +
738   /***************************************************************************
739 < *  section logging
739 > * pseudo {} section
740 > ***************************************************************************/
741 > pseudo_entry: T_PSEUDO
742 > {
743 >  if (conf_parser_ctx.pass == 2)
744 >    reset_block_state();
745 > } '{' pseudo_items '}' ';'
746 > {
747 >  if (conf_parser_ctx.pass != 2)
748 >    break;
749 >
750 >  if (!block_state.command.buf[0] ||
751 >      !block_state.name.buf[0] ||
752 >      !block_state.nick.buf[0] ||
753 >      !block_state.host.buf[0])
754 >    break;
755 >
756 >  pseudo_register(block_state.name.buf, block_state.nick.buf, block_state.host.buf,
757 >                  block_state.prepend.buf, block_state.command.buf);
758 > };
759 >
760 > pseudo_items: pseudo_items pseudo_item | pseudo_item;
761 > pseudo_item:  pseudo_command | pseudo_prepend | pseudo_name | pseudo_target | error ';' ;
762 >
763 > pseudo_command: T_COMMAND '=' QSTRING ';'
764 > {
765 >  if (conf_parser_ctx.pass == 2)
766 >    strlcpy(block_state.command.buf, yylval.string, sizeof(block_state.command.buf));
767 > };
768 >
769 > pseudo_name: NAME '=' QSTRING ';'
770 > {
771 >  if (conf_parser_ctx.pass == 2)
772 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
773 > };
774 >
775 > pseudo_prepend: T_PREPEND '=' QSTRING ';'
776 > {
777 >  if (conf_parser_ctx.pass == 2)
778 >    strlcpy(block_state.prepend.buf, yylval.string, sizeof(block_state.prepend.buf));
779 > };
780 >
781 > pseudo_target: T_TARGET '=' QSTRING ';'
782 > {
783 >  if (conf_parser_ctx.pass == 2)
784 >  {
785 >    struct split_nuh_item nuh;
786 >
787 >    nuh.nuhmask  = yylval.string;
788 >    nuh.nickptr  = NULL;
789 >    nuh.userptr  = block_state.nick.buf;
790 >    nuh.hostptr  = block_state.host.buf;
791 >    nuh.nicksize = 0;
792 >    nuh.usersize = sizeof(block_state.nick.buf);
793 >    nuh.hostsize = sizeof(block_state.host.buf);
794 >
795 >    split_nuh(&nuh);
796 >  }
797 > };
798 >
799 >
800 > /***************************************************************************
801 > * log {} section
802   ***************************************************************************/
803   logging_entry:          T_LOG  '{' logging_items '}' ';' ;
804   logging_items:          logging_items logging_item | logging_item ;
# Line 984 | Line 863 | logging_file_type_item:  USER
863   {
864    if (conf_parser_ctx.pass == 2)
865      block_state.type.value = LOG_TYPE_OPER;
987 } | GLINE
988 {
989  if (conf_parser_ctx.pass == 2)
990    block_state.type.value = LOG_TYPE_GLINE;
866   } | XLINE
867   {
868    if (conf_parser_ctx.pass == 2)
# Line 1016 | Line 891 | logging_file_type_item:  USER
891  
892  
893   /***************************************************************************
894 < * section oper
894 > * operator {} section
895   ***************************************************************************/
896   oper_entry: OPERATOR
897   {
# Line 1027 | Line 902 | oper_entry: OPERATOR
902    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
903   } '{' oper_items '}' ';'
904   {
905 <  dlink_node *ptr = NULL;
905 >  dlink_node *node = NULL;
906  
907    if (conf_parser_ctx.pass != 2)
908      break;
909  
910    if (!block_state.name.buf[0])
911      break;
912 < #ifdef HAVE_LIBCRYPTO
1038 <  if (!block_state.file.buf[0] &&
1039 <      !block_state.rpass.buf[0])
1040 <    break;
1041 < #else
912 >
913    if (!block_state.rpass.buf[0])
914      break;
1044 #endif
915  
916 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
916 >  DLINK_FOREACH(node, block_state.mask.list.head)
917    {
1048    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  = ptr->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 1068 | Line 944 | oper_entry: OPERATOR
944      if (block_state.rpass.buf[0])
945        conf->passwd = xstrdup(block_state.rpass.buf);
946  
947 +    if (block_state.whois.buf[0])
948 +      conf->whois = xstrdup(block_state.whois.buf);
949 +
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);
1077
1078 #ifdef HAVE_LIBCRYPTO
1079    if (block_state.file.buf[0])
1080    {
1081      BIO *file = NULL;
1082      RSA *pkey = NULL;
1083
1084      if ((file = BIO_new_file(block_state.file.buf, "r")) == NULL)
1085      {
1086        ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- file doesn't exist");
1087        break;
1088      }
1089
1090      if ((pkey = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL)) == NULL)
1091        ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key invalid; check key syntax");
1092      else
1093      {
1094        if (RSA_size(pkey) > 128)
1095          ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key size must be 1024 or below");
1096        else
1097          conf->rsa_public_key = pkey;
1098      }
1099
1100      BIO_set_close(file, BIO_CLOSE);
1101      BIO_free(file);
1102    }
1103 #endif /* HAVE_LIBCRYPTO */
956    }
957   };
958  
# Line 1108 | Line 960 | oper_items:     oper_items oper_item | o
960   oper_item:      oper_name |
961                  oper_user |
962                  oper_password |
963 +                oper_whois |
964                  oper_umodes |
965                  oper_class |
966                  oper_encrypted |
1114                oper_rsa_public_key_file |
967                  oper_ssl_certificate_fingerprint |
968                  oper_ssl_connection_required |
969                  oper_flags |
# Line 1135 | Line 987 | oper_password: PASSWORD '=' QSTRING ';'
987      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
988   };
989  
990 + oper_whois: WHOIS '=' QSTRING ';'
991 + {
992 +  if (conf_parser_ctx.pass == 2)
993 +    strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
994 + };
995 +
996   oper_encrypted: ENCRYPTED '=' TBOOL ';'
997   {
998    if (conf_parser_ctx.pass != 2)
# Line 1146 | Line 1004 | oper_encrypted: ENCRYPTED '=' TBOOL ';'
1004      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1005   };
1006  
1149 oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1150 {
1151  if (conf_parser_ctx.pass == 2)
1152    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1153 };
1154
1007   oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1008   {
1009    if (conf_parser_ctx.pass == 2)
# Line 1327 | Line 1179 | oper_flags_item: KILL ':' REMOTE
1179   {
1180    if (conf_parser_ctx.pass == 2)
1181      block_state.port.value |= OPER_FLAG_UNXLINE;
1330 } | GLINE
1331 {
1332  if (conf_parser_ctx.pass == 2)
1333    block_state.port.value |= OPER_FLAG_GLINE;
1182   } | DIE
1183   {
1184    if (conf_parser_ctx.pass == 2)
# Line 1339 | Line 1187 | oper_flags_item: KILL ':' REMOTE
1187   {
1188    if (conf_parser_ctx.pass == 2)
1189      block_state.port.value |= OPER_FLAG_RESTART;
1190 + } | REHASH ':' REMOTE
1191 + {
1192 +  if (conf_parser_ctx.pass == 2)
1193 +    block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1194   } | REHASH
1195   {
1196    if (conf_parser_ctx.pass == 2)
# Line 1371 | Line 1223 | oper_flags_item: KILL ':' REMOTE
1223   {
1224    if (conf_parser_ctx.pass == 2)
1225      block_state.port.value |= OPER_FLAG_MODULE;
1226 + } | T_OPME
1227 + {
1228 +  if (conf_parser_ctx.pass == 2)
1229 +    block_state.port.value |= OPER_FLAG_OPME;
1230 + } | NICK ':' RESV
1231 + {
1232 +  if (conf_parser_ctx.pass == 2)
1233 +    block_state.port.value |= OPER_FLAG_NICK_RESV;
1234 + } | JOIN ':' RESV
1235 + {
1236 +  if (conf_parser_ctx.pass == 2)
1237 +    block_state.port.value |= OPER_FLAG_JOIN_RESV;
1238 + } | RESV
1239 + {
1240 +  if (conf_parser_ctx.pass == 2)
1241 +    block_state.port.value |= OPER_FLAG_RESV;
1242 + } | T_UNRESV
1243 + {
1244 +  if (conf_parser_ctx.pass == 2)
1245 +    block_state.port.value |= OPER_FLAG_UNRESV;
1246 + } | CLOSE
1247 + {
1248 +  if (conf_parser_ctx.pass == 2)
1249 +    block_state.port.value |= OPER_FLAG_CLOSE;
1250   };
1251  
1252  
1253   /***************************************************************************
1254 < *  section class
1254 > * class {} section
1255   ***************************************************************************/
1256   class_entry: CLASS
1257   {
# Line 1391 | Line 1267 | class_entry: CLASS
1267    block_state.max_recvq.value = DEFAULT_RECVQ;
1268   } '{' class_items '}' ';'
1269   {
1394  struct ClassItem *class = NULL;
1395
1270    if (conf_parser_ctx.pass != 1)
1271      break;
1272  
1273    if (!block_state.class.buf[0])
1274      break;
1275  
1276 <  if (!(class = class_find(block_state.class.buf, 0)))
1276 >  struct ClassItem *class = class_find(block_state.class.buf, false);
1277 >  if (class == NULL)
1278      class = class_make();
1279  
1280 <  class->active = 1;
1281 <  MyFree(class->name);
1280 >  class->active = true;
1281 >  xfree(class->name);
1282    class->name = xstrdup(block_state.class.buf);
1283    class->ping_freq = block_state.ping_freq.value;
1284 <  class->max_perip = block_state.max_perip.value;
1284 >  class->max_perip_local = block_state.max_perip_local.value;
1285 >  class->max_perip_global = block_state.max_perip_global.value;
1286    class->con_freq = block_state.con_freq.value;
1287    class->max_total = block_state.max_total.value;
1412  class->max_global = block_state.max_global.value;
1413  class->max_local = block_state.max_local.value;
1414  class->max_ident = block_state.max_ident.value;
1288    class->max_sendq = block_state.max_sendq.value;
1289    class->max_recvq = block_state.max_recvq.value;
1290    class->max_channels = block_state.max_channels.value;
# Line 1427 | Line 1300 | class_entry: CLASS
1300    class->min_idle = block_state.min_idle.value;
1301    class->max_idle = block_state.max_idle.value;
1302  
1303 <  if (class->number_per_cidr && block_state.number_per_cidr.value)
1304 <    if ((class->cidr_bitlen_ipv4 && block_state.cidr_bitlen_ipv4.value) ||
1432 <        (class->cidr_bitlen_ipv6 && block_state.cidr_bitlen_ipv6.value))
1433 <      if ((class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value) ||
1434 <          (class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value))
1435 <        rebuild_cidr_list(class);
1436 <
1303 >  bool diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value ||
1304 >               class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value);
1305    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1306    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1307    class->number_per_cidr = block_state.number_per_cidr.value;
1308 +
1309 +  if (diff)
1310 +    class_ip_limit_rebuild(class);
1311   };
1312  
1313   class_items:    class_items class_item | class_item;
# Line 1445 | Line 1316 | class_item:     class_name |
1316                  class_cidr_bitlen_ipv6 |
1317                  class_ping_time |
1318                  class_number_per_cidr |
1319 <                class_number_per_ip |
1319 >                class_number_per_ip_local |
1320 >                class_number_per_ip_global |
1321                  class_connectfreq |
1322                  class_max_channels |
1323                  class_max_number |
1324 <                class_max_global |
1325 <                class_max_local |
1454 <                class_max_ident |
1455 <                class_sendq | class_recvq |
1324 >                class_sendq |
1325 >                class_recvq |
1326                  class_min_idle |
1327                  class_max_idle |
1328                  class_flags |
# Line 1470 | Line 1340 | class_ping_time: PING_TIME '=' timespec
1340      block_state.ping_freq.value = $3;
1341   };
1342  
1343 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1343 > class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1344 > {
1345 >  if (conf_parser_ctx.pass == 1)
1346 >    block_state.max_perip_local.value = $3;
1347 > };
1348 >
1349 > class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1350   {
1351    if (conf_parser_ctx.pass == 1)
1352 <    block_state.max_perip.value = $3;
1352 >    block_state.max_perip_global.value = $3;
1353   };
1354  
1355   class_connectfreq: CONNECTFREQ '=' timespec ';'
# Line 1494 | Line 1370 | class_max_number: MAX_NUMBER '=' NUMBER
1370      block_state.max_total.value = $3;
1371   };
1372  
1497 class_max_global: MAX_GLOBAL '=' NUMBER ';'
1498 {
1499  if (conf_parser_ctx.pass == 1)
1500    block_state.max_global.value = $3;
1501 };
1502
1503 class_max_local: MAX_LOCAL '=' NUMBER ';'
1504 {
1505  if (conf_parser_ctx.pass == 1)
1506    block_state.max_local.value = $3;
1507 };
1508
1509 class_max_ident: MAX_IDENT '=' NUMBER ';'
1510 {
1511  if (conf_parser_ctx.pass == 1)
1512    block_state.max_ident.value = $3;
1513 };
1514
1373   class_sendq: SENDQ '=' sizespec ';'
1374   {
1375    if (conf_parser_ctx.pass == 1)
# Line 1580 | Line 1438 | class_flags_item: RANDOM_IDLE
1438  
1439  
1440   /***************************************************************************
1441 < *  section listen
1441 > * listen {} section
1442   ***************************************************************************/
1443   listen_entry: LISTEN
1444   {
# Line 1619 | Line 1477 | port_item: NUMBER
1477   {
1478    if (conf_parser_ctx.pass == 2)
1479    {
1480 < #ifndef HAVE_LIBCRYPTO
1480 > #ifndef HAVE_TLS
1481      if (block_state.flags.value & LISTENER_SSL)
1482      {
1483 <      conf_error_report("SSL not available - port closed");
1483 >      conf_error_report("TLS not available - port closed");
1484        break;
1485      }
1486   #endif
1487 <    add_listener($1, block_state.addr.buf, block_state.flags.value);
1487 >    listener_add($1, block_state.addr.buf, block_state.flags.value);
1488    }
1489   } | NUMBER TWODOTS NUMBER
1490   {
1491    if (conf_parser_ctx.pass == 2)
1492    {
1493 < #ifndef HAVE_LIBCRYPTO
1493 > #ifndef HAVE_TLS
1494      if (block_state.flags.value & LISTENER_SSL)
1495      {
1496 <      conf_error_report("SSL not available - port closed");
1496 >      conf_error_report("TLS not available - port closed");
1497        break;
1498      }
1499   #endif
1500  
1501      for (int i = $1; i <= $3; ++i)
1502 <      add_listener(i, block_state.addr.buf, block_state.flags.value);
1502 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1503    }
1504   };
1505  
# Line 1657 | Line 1515 | listen_host: HOST '=' QSTRING ';'
1515      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1516   };
1517  
1518 +
1519   /***************************************************************************
1520 < *  section auth
1520 > * auth {} section
1521   ***************************************************************************/
1522   auth_entry: IRCD_AUTH
1523   {
# Line 1666 | Line 1525 | auth_entry: IRCD_AUTH
1525      reset_block_state();
1526   } '{' auth_items '}' ';'
1527   {
1528 <  dlink_node *ptr = NULL;
1528 >  dlink_node *node = NULL;
1529  
1530    if (conf_parser_ctx.pass != 2)
1531      break;
1532  
1533 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
1533 >  DLINK_FOREACH(node, block_state.mask.list.head)
1534    {
1676    struct MaskItem *conf = NULL;
1535      struct split_nuh_item nuh;
1536 +    char *s = node->data;
1537 +
1538 +    if (EmptyString(s))
1539 +      continue;
1540  
1541 <    nuh.nuhmask  = ptr->data;
1541 >    nuh.nuhmask  = s;
1542      nuh.nickptr  = NULL;
1543      nuh.userptr  = block_state.user.buf;
1544      nuh.hostptr  = block_state.host.buf;
1545 +
1546      nuh.nicksize = 0;
1547      nuh.usersize = sizeof(block_state.user.buf);
1548      nuh.hostsize = sizeof(block_state.host.buf);
1549 +
1550      split_nuh(&nuh);
1551  
1552 <    conf        = conf_make(CONF_CLIENT);
1553 <    conf->user  = xstrdup(block_state.user.buf);
1554 <    conf->host  = xstrdup(block_state.host.buf);
1552 >    struct MaskItem *conf = conf_make(CONF_CLIENT);
1553 >    conf->user = xstrdup(block_state.user.buf);
1554 >    conf->host = xstrdup(block_state.host.buf);
1555  
1556      if (block_state.rpass.buf[0])
1557        conf->passwd = xstrdup(block_state.rpass.buf);
# Line 1746 | Line 1610 | auth_flags: IRCD_FLAGS
1610   {
1611    if (conf_parser_ctx.pass == 2)
1612      block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1613 < } '='  auth_flags_items ';';
1613 > } '=' auth_flags_items ';';
1614  
1615   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1616   auth_flags_item: SPOOF_NOTICE
# Line 1761 | Line 1625 | auth_flags_item: SPOOF_NOTICE
1625   {
1626    if (conf_parser_ctx.pass == 2)
1627      block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1628 + } | XLINE_EXEMPT
1629 + {
1630 +  if (conf_parser_ctx.pass == 2)
1631 +    block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1632   } | NEED_IDENT
1633   {
1634    if (conf_parser_ctx.pass == 2)
# Line 1773 | Line 1641 | auth_flags_item: SPOOF_NOTICE
1641   {
1642    if (conf_parser_ctx.pass == 2)
1643      block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1776 } | GLINE_EXEMPT
1777 {
1778  if (conf_parser_ctx.pass == 2)
1779    block_state.flags.value |= CONF_FLAGS_EXEMPTGLINE;
1644   } | RESV_EXEMPT
1645   {
1646    if (conf_parser_ctx.pass == 2)
# Line 1825 | Line 1689 | auth_redir_port: REDIRPORT '=' NUMBER ';
1689  
1690  
1691   /***************************************************************************
1692 < *  section resv
1692 > * resv {} section
1693   ***************************************************************************/
1694   resv_entry: RESV
1695   {
# Line 1839 | Line 1703 | resv_entry: RESV
1703    if (conf_parser_ctx.pass != 2)
1704      break;
1705  
1706 <  create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1706 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1707   };
1708  
1709   resv_items:     resv_items resv_item | resv_item;
# Line 1865 | Line 1729 | resv_exempt: EXEMPT '=' QSTRING ';'
1729  
1730  
1731   /***************************************************************************
1732 < *  section service
1732 > * service {} section
1733   ***************************************************************************/
1734   service_entry: T_SERVICE '{' service_items '}' ';';
1735  
# Line 1877 | Line 1741 | service_name: NAME '=' QSTRING ';'
1741    if (conf_parser_ctx.pass != 2)
1742      break;
1743  
1744 <  if (valid_servname(yylval.string))
1744 >  if (server_valid_name(yylval.string) == true)
1745    {
1746 <    struct MaskItem *conf = conf_make(CONF_SERVICE);
1747 <    conf->name = xstrdup(yylval.string);
1746 >    struct ServiceItem *service = service_make();
1747 >    service->name = xstrdup(yylval.string);
1748    }
1749   };
1750  
1751 +
1752   /***************************************************************************
1753 < *  section shared, for sharing remote klines etc.
1753 > * shared {} section, for sharing remote klines etc.
1754   ***************************************************************************/
1755   shared_entry: T_SHARED
1756   {
# Line 1900 | Line 1765 | shared_entry: T_SHARED
1765    block_state.flags.value = SHARED_ALL;
1766   } '{' shared_items '}' ';'
1767   {
1903  struct MaskItem *conf = NULL;
1904
1768    if (conf_parser_ctx.pass != 2)
1769      break;
1770  
1771 <  conf = conf_make(CONF_ULINE);
1772 <  conf->flags = block_state.flags.value;
1773 <  conf->name = xstrdup(block_state.name.buf);
1774 <  conf->user = xstrdup(block_state.user.buf);
1775 <  conf->host = xstrdup(block_state.host.buf);
1771 >  struct SharedItem *shared = shared_make();
1772 >  shared->type = block_state.flags.value;
1773 >  shared->server = xstrdup(block_state.name.buf);
1774 >  shared->user = xstrdup(block_state.user.buf);
1775 >  shared->host = xstrdup(block_state.host.buf);
1776   };
1777  
1778   shared_items: shared_items shared_item | shared_item;
# Line 1989 | Line 1852 | shared_type_item: KLINE
1852      block_state.flags.value = SHARED_ALL;
1853   };
1854  
1855 +
1856   /***************************************************************************
1857 < *  section cluster
1857 > * cluster {} section
1858   ***************************************************************************/
1859   cluster_entry: T_CLUSTER
1860   {
# Line 2000 | Line 1864 | cluster_entry: T_CLUSTER
1864    reset_block_state();
1865  
1866    strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1867 <  block_state.flags.value = SHARED_ALL;
1867 >  block_state.flags.value = CLUSTER_ALL;
1868   } '{' cluster_items '}' ';'
1869   {
2006  struct MaskItem *conf = NULL;
2007
1870    if (conf_parser_ctx.pass != 2)
1871      break;
1872  
1873 <  conf = conf_make(CONF_CLUSTER);
1874 <  conf->flags = block_state.flags.value;
1875 <  conf->name = xstrdup(block_state.name.buf);
1873 >  struct ClusterItem *cluster = cluster_make();
1874 >  cluster->type = block_state.flags.value;
1875 >  cluster->server = xstrdup(block_state.name.buf);
1876   };
1877  
1878   cluster_items:  cluster_items cluster_item | cluster_item;
# Line 2032 | Line 1894 | cluster_types:  cluster_types ',' cluste
1894   cluster_type_item: KLINE
1895   {
1896    if (conf_parser_ctx.pass == 2)
1897 <    block_state.flags.value |= SHARED_KLINE;
1897 >    block_state.flags.value |= CLUSTER_KLINE;
1898   } | UNKLINE
1899   {
1900    if (conf_parser_ctx.pass == 2)
1901 <    block_state.flags.value |= SHARED_UNKLINE;
1901 >    block_state.flags.value |= CLUSTER_UNKLINE;
1902   } | T_DLINE
1903   {
1904    if (conf_parser_ctx.pass == 2)
1905 <    block_state.flags.value |= SHARED_DLINE;
1905 >    block_state.flags.value |= CLUSTER_DLINE;
1906   } | T_UNDLINE
1907   {
1908    if (conf_parser_ctx.pass == 2)
1909 <    block_state.flags.value |= SHARED_UNDLINE;
1909 >    block_state.flags.value |= CLUSTER_UNDLINE;
1910   } | XLINE
1911   {
1912    if (conf_parser_ctx.pass == 2)
1913 <    block_state.flags.value |= SHARED_XLINE;
1913 >    block_state.flags.value |= CLUSTER_XLINE;
1914   } | T_UNXLINE
1915   {
1916    if (conf_parser_ctx.pass == 2)
1917 <    block_state.flags.value |= SHARED_UNXLINE;
1917 >    block_state.flags.value |= CLUSTER_UNXLINE;
1918   } | RESV
1919   {
1920    if (conf_parser_ctx.pass == 2)
1921 <    block_state.flags.value |= SHARED_RESV;
1921 >    block_state.flags.value |= CLUSTER_RESV;
1922   } | T_UNRESV
1923   {
1924    if (conf_parser_ctx.pass == 2)
1925 <    block_state.flags.value |= SHARED_UNRESV;
1925 >    block_state.flags.value |= CLUSTER_UNRESV;
1926   } | T_LOCOPS
1927   {
1928    if (conf_parser_ctx.pass == 2)
1929 <    block_state.flags.value |= SHARED_LOCOPS;
1929 >    block_state.flags.value |= CLUSTER_LOCOPS;
1930   } | T_ALL
1931   {
1932    if (conf_parser_ctx.pass == 2)
1933 <    block_state.flags.value = SHARED_ALL;
1933 >    block_state.flags.value = CLUSTER_ALL;
1934   };
1935  
1936 +
1937   /***************************************************************************
1938 < *  section connect
1938 > * connect {}  section
1939   ***************************************************************************/
1940   connect_entry: CONNECT
1941   {
# Line 2085 | Line 1948 | connect_entry: CONNECT
1948    block_state.port.value = PORTNUM;
1949   } '{' connect_items '}' ';'
1950   {
2088  struct MaskItem *conf = NULL;
1951    struct addrinfo hints, *res;
1952  
1953    if (conf_parser_ctx.pass != 2)
# Line 2099 | Line 1961 | connect_entry: CONNECT
1961        !block_state.spass.buf[0])
1962      break;
1963  
1964 +  if (server_valid_name(block_state.name.buf) == false)
1965 +    break;
1966 +
1967    if (has_wildcards(block_state.name.buf) ||
1968        has_wildcards(block_state.host.buf))
1969      break;
1970  
1971 <  conf = conf_make(CONF_SERVER);
1971 >  struct MaskItem *conf = conf_make(CONF_SERVER);
1972 >  conf->addr = xcalloc(sizeof(*conf->addr));
1973    conf->port = block_state.port.value;
1974    conf->flags = block_state.flags.value;
1975    conf->aftype = block_state.aftype.value;
# Line 2130 | Line 1996 | connect_entry: CONNECT
1996      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
1997  
1998      if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
1999 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
1999 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server bind(%s)", block_state.bind.buf);
2000      else
2001      {
2002        assert(res);
2003  
2004 <      memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2005 <      conf->bind.ss.ss_family = res->ai_family;
2006 <      conf->bind.ss_len = res->ai_addrlen;
2004 >      conf->bind = xcalloc(sizeof(*conf->bind));
2005 >
2006 >      memcpy(conf->bind, res->ai_addr, res->ai_addrlen);
2007 >      conf->bind->ss_len = res->ai_addrlen;
2008        freeaddrinfo(res);
2009      }
2010    }
# Line 2149 | Line 2016 | connect_entry: CONNECT
2016   connect_items:  connect_items connect_item | connect_item;
2017   connect_item:   connect_name |
2018                  connect_host |
2019 <                connect_vhost |
2019 >                connect_bind |
2020                  connect_send_password |
2021                  connect_accept_password |
2022                  connect_ssl_certificate_fingerprint |
# Line 2175 | Line 2042 | connect_host: HOST '=' QSTRING ';'
2042      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2043   };
2044  
2045 < connect_vhost: VHOST '=' QSTRING ';'
2045 > connect_bind: T_BIND '=' QSTRING ';'
2046   {
2047    if (conf_parser_ctx.pass == 2)
2048      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
# Line 2186 | Line 2053 | connect_send_password: SEND_PASSWORD '='
2053    if (conf_parser_ctx.pass != 2)
2054      break;
2055  
2056 <  if ($3[0] == ':')
2056 >  if (*yylval.string == ':')
2057      conf_error_report("Server passwords cannot begin with a colon");
2058 <  else if (strchr($3, ' '))
2058 >  else if (strchr(yylval.string, ' '))
2059      conf_error_report("Server passwords cannot contain spaces");
2060    else
2061      strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
# Line 2199 | Line 2066 | connect_accept_password: ACCEPT_PASSWORD
2066    if (conf_parser_ctx.pass != 2)
2067      break;
2068  
2069 <  if ($3[0] == ':')
2069 >  if (*yylval.string == ':')
2070      conf_error_report("Server passwords cannot begin with a colon");
2071 <  else if (strchr($3, ' '))
2071 >  else if (strchr(yylval.string, ' '))
2072      conf_error_report("Server passwords cannot contain spaces");
2073    else
2074      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2232 | Line 2099 | connect_aftype: AFTYPE '=' T_IPV4 ';'
2099   connect_flags: IRCD_FLAGS
2100   {
2101    block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2102 < } '='  connect_flags_items ';';
2102 > } '=' connect_flags_items ';';
2103  
2104   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2105   connect_flags_item: AUTOCONN
# Line 2276 | Line 2143 | connect_class: CLASS '=' QSTRING ';'
2143  
2144   connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2145   {
2146 < #ifdef HAVE_LIBCRYPTO
2146 > #ifdef HAVE_TLS
2147    if (conf_parser_ctx.pass == 2)
2148      strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2149   #else
2150    if (conf_parser_ctx.pass == 2)
2151 <    conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2151 >    conf_error_report("Ignoring connect::ciphers -- no TLS support");
2152   #endif
2153   };
2154  
2155  
2156   /***************************************************************************
2157 < *  section kill
2157 > * kill {} section
2158   ***************************************************************************/
2159   kill_entry: KILL
2160   {
# Line 2295 | Line 2162 | kill_entry: KILL
2162      reset_block_state();
2163   } '{' kill_items '}' ';'
2164   {
2298  struct MaskItem *conf = NULL;
2299
2165    if (conf_parser_ctx.pass != 2)
2166      break;
2167  
# Line 2304 | Line 2169 | kill_entry: KILL
2169        !block_state.host.buf[0])
2170      break;
2171  
2172 <  conf = conf_make(CONF_KLINE);
2172 >  struct MaskItem *conf = conf_make(CONF_KLINE);
2173    conf->user = xstrdup(block_state.user.buf);
2174    conf->host = xstrdup(block_state.host.buf);
2175  
# Line 2344 | Line 2209 | kill_reason: REASON '=' QSTRING ';'
2209      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2210   };
2211  
2212 +
2213   /***************************************************************************
2214 < *  section deny
2214 > * deny {} section
2215   ***************************************************************************/
2216   deny_entry: DENY
2217   {
# Line 2353 | Line 2219 | deny_entry: DENY
2219      reset_block_state();
2220   } '{' deny_items '}' ';'
2221   {
2356  struct MaskItem *conf = NULL;
2357
2222    if (conf_parser_ctx.pass != 2)
2223      break;
2224  
# Line 2363 | Line 2227 | deny_entry: DENY
2227  
2228    if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2229    {
2230 <    conf = conf_make(CONF_DLINE);
2230 >    struct MaskItem *conf = conf_make(CONF_DLINE);
2231      conf->host = xstrdup(block_state.addr.buf);
2232  
2233      if (block_state.rpass.buf[0])
# Line 2389 | Line 2253 | deny_reason: REASON '=' QSTRING ';'
2253      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2254   };
2255  
2256 +
2257   /***************************************************************************
2258 < *  section exempt
2258 > * exempt {} section
2259   ***************************************************************************/
2260   exempt_entry: EXEMPT '{' exempt_items '}' ';';
2261  
2262 < exempt_items:     exempt_items exempt_item | exempt_item;
2263 < exempt_item:      exempt_ip | error;
2262 > exempt_items: exempt_items exempt_item | exempt_item;
2263 > exempt_item:  exempt_ip | error;
2264  
2265   exempt_ip: IP '=' QSTRING ';'
2266   {
2267    if (conf_parser_ctx.pass == 2)
2268    {
2269 <    if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2269 >    if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2270      {
2271        struct MaskItem *conf = conf_make(CONF_EXEMPT);
2272        conf->host = xstrdup(yylval.string);
# Line 2412 | Line 2277 | exempt_ip: IP '=' QSTRING ';'
2277   };
2278  
2279   /***************************************************************************
2280 < *  section gecos
2280 > * gecos {} section
2281   ***************************************************************************/
2282   gecos_entry: GECOS
2283   {
# Line 2420 | Line 2285 | gecos_entry: GECOS
2285      reset_block_state();
2286   } '{' gecos_items '}' ';'
2287   {
2423  struct MaskItem *conf = NULL;
2424
2288    if (conf_parser_ctx.pass != 2)
2289      break;
2290  
2291    if (!block_state.name.buf[0])
2292      break;
2293  
2294 <  conf = conf_make(CONF_XLINE);
2295 <  conf->name = xstrdup(block_state.name.buf);
2294 >  struct GecosItem *gecos = gecos_make();
2295 >  gecos->mask = xstrdup(block_state.name.buf);
2296  
2297    if (block_state.rpass.buf[0])
2298 <    conf->reason = xstrdup(block_state.rpass.buf);
2298 >    gecos->reason = xstrdup(block_state.rpass.buf);
2299    else
2300 <    conf->reason = xstrdup(CONF_NOREASON);
2300 >    gecos->reason = xstrdup(CONF_NOREASON);
2301   };
2302  
2303   gecos_items: gecos_items gecos_item | gecos_item;
# Line 2452 | Line 2315 | gecos_reason: REASON '=' QSTRING ';'
2315      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2316   };
2317  
2318 +
2319   /***************************************************************************
2320 < *  section general
2320 > * general {} section
2321   ***************************************************************************/
2322 < general_entry: GENERAL
2459 <  '{' general_items '}' ';';
2322 > general_entry: GENERAL '{' general_items '}' ';';
2323  
2324   general_items:      general_items general_item | general_item;
2325   general_item:       general_away_count |
2326                      general_away_time |
2464                    general_hide_spoof_ips |
2465                    general_ignore_bogus_ts |
2327                      general_failed_oper_notice |
2328                      general_anti_nick_flood |
2329                      general_max_nick_time |
2330                      general_max_nick_changes |
2331                      general_max_accept |
2332 +                    general_whowas_history_length |
2333                      general_anti_spam_exit_message_time |
2334                      general_ts_warn_delta |
2335                      general_ts_max_delta |
# Line 2475 | Line 2337 | general_item:       general_away_count |
2337                      general_invisible_on_connect |
2338                      general_warn_no_connect_block |
2339                      general_dots_in_ident |
2478                    general_stats_o_oper_only |
2479                    general_stats_k_oper_only |
2480                    general_pace_wait |
2340                      general_stats_i_oper_only |
2341 <                    general_pace_wait_simple |
2341 >                    general_stats_k_oper_only |
2342 >                    general_stats_m_oper_only |
2343 >                    general_stats_o_oper_only |
2344                      general_stats_P_oper_only |
2345                      general_stats_u_oper_only |
2346 +                    general_pace_wait |
2347 +                    general_pace_wait_simple |
2348                      general_short_motd |
2349                      general_no_oper_flood |
2487                    general_true_no_oper_flood |
2488                    general_oper_pass_resv |
2350                      general_oper_only_umodes |
2351                      general_max_targets |
2352                      general_oper_umodes |
2353                      general_caller_id_wait |
2354                      general_opers_bypass_callerid |
2355                      general_default_floodcount |
2356 +                    general_default_floodtime |
2357                      general_min_nonwildcard |
2358                      general_min_nonwildcard_simple |
2359                      general_throttle_count |
2360                      general_throttle_time |
2499                    general_havent_read_conf |
2361                      general_ping_cookie |
2362                      general_disable_auth |
2363                      general_tkline_expire_notices |
2364 <                    general_gline_enable |
2365 <                    general_gline_duration |
2366 <                    general_gline_request_duration |
2367 <                    general_gline_min_cidr |
2507 <                    general_gline_min_cidr6 |
2364 >                    general_dline_min_cidr |
2365 >                    general_dline_min_cidr6 |
2366 >                    general_kline_min_cidr |
2367 >                    general_kline_min_cidr6 |
2368                      general_stats_e_disabled |
2369                      general_max_watch |
2510                    general_services_name |
2370                      general_cycle_on_host_change |
2371                      error;
2372  
# Line 2527 | Line 2386 | general_max_watch: MAX_WATCH '=' NUMBER
2386    ConfigGeneral.max_watch = $3;
2387   };
2388  
2389 < general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2389 > general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2390   {
2391 <  if (conf_parser_ctx.pass == 2)
2533 <    ConfigGeneral.cycle_on_host_change = yylval.number;
2391 >  ConfigGeneral.whowas_history_length = $3;
2392   };
2393  
2394 < general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2394 > general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2395   {
2396 <  if (conf_parser_ctx.pass == 2)
2539 <    ConfigGeneral.glines = yylval.number;
2396 >  ConfigGeneral.cycle_on_host_change = yylval.number;
2397   };
2398  
2399 < general_gline_duration: GLINE_DURATION '=' timespec ';'
2399 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2400   {
2401 <  if (conf_parser_ctx.pass == 2)
2545 <    ConfigGeneral.gline_time = $3;
2401 >  ConfigGeneral.dline_min_cidr = $3;
2402   };
2403  
2404 < general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2404 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2405   {
2406 <  if (conf_parser_ctx.pass == 2)
2551 <    ConfigGeneral.gline_request_time = $3;
2406 >  ConfigGeneral.dline_min_cidr6 = $3;
2407   };
2408  
2409 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2409 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2410   {
2411 <  ConfigGeneral.gline_min_cidr = $3;
2411 >  ConfigGeneral.kline_min_cidr = $3;
2412   };
2413  
2414 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2414 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2415   {
2416 <  ConfigGeneral.gline_min_cidr6 = $3;
2416 >  ConfigGeneral.kline_min_cidr6 = $3;
2417   };
2418  
2419   general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
# Line 2571 | Line 2426 | general_kill_chase_time_limit: KILL_CHAS
2426    ConfigGeneral.kill_chase_time_limit = $3;
2427   };
2428  
2574 general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2575 {
2576  ConfigGeneral.hide_spoof_ips = yylval.number;
2577 };
2578
2579 general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2580 {
2581  ConfigGeneral.ignore_bogus_ts = yylval.number;
2582 };
2583
2429   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2430   {
2431    ConfigGeneral.failed_oper_notice = yylval.number;
# Line 2618 | Line 2463 | general_ts_warn_delta: TS_WARN_DELTA '='
2463  
2464   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2465   {
2466 <  if (conf_parser_ctx.pass == 2)
2622 <    ConfigGeneral.ts_max_delta = $3;
2623 < };
2624 <
2625 < general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2626 < {
2627 <  if (($3 > 0) && conf_parser_ctx.pass == 1)
2628 <  {
2629 <    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2630 <    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2631 <    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2632 <    exit(0);
2633 <  }
2466 >  ConfigGeneral.ts_max_delta = $3;
2467   };
2468  
2469   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
# Line 2648 | Line 2481 | general_stats_e_disabled: STATS_E_DISABL
2481    ConfigGeneral.stats_e_disabled = yylval.number;
2482   };
2483  
2484 + general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2485 + {
2486 +  ConfigGeneral.stats_m_oper_only = yylval.number;
2487 + };
2488 +
2489   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2490   {
2491    ConfigGeneral.stats_o_oper_only = yylval.number;
# Line 2709 | Line 2547 | general_no_oper_flood: NO_OPER_FLOOD '='
2547    ConfigGeneral.no_oper_flood = yylval.number;
2548   };
2549  
2712 general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2713 {
2714  ConfigGeneral.true_no_oper_flood = yylval.number;
2715 };
2716
2717 general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2718 {
2719  ConfigGeneral.oper_pass_resv = yylval.number;
2720 };
2721
2550   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2551   {
2552    ConfigGeneral.dots_in_ident = $3;
# Line 2729 | Line 2557 | general_max_targets: MAX_TARGETS '=' NUM
2557    ConfigGeneral.max_targets = $3;
2558   };
2559  
2732 general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2733 {
2734  if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2735  {
2736    MyFree(ConfigGeneral.service_name);
2737    ConfigGeneral.service_name = xstrdup(yylval.string);
2738  }
2739 };
2740
2560   general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2561   {
2562    ConfigGeneral.ping_cookie = yylval.number;
# Line 2761 | Line 2580 | general_throttle_time: THROTTLE_TIME '='
2580   general_oper_umodes: OPER_UMODES
2581   {
2582    ConfigGeneral.oper_umodes = 0;
2583 < } '='  umode_oitems ';' ;
2583 > } '=' umode_oitems ';' ;
2584  
2585   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2586   umode_oitem:     T_BOTS
# Line 2835 | Line 2654 | umode_oitem:     T_BOTS
2654   general_oper_only_umodes: OPER_ONLY_UMODES
2655   {
2656    ConfigGeneral.oper_only_umodes = 0;
2657 < } '='  umode_items ';' ;
2657 > } '=' umode_items ';' ;
2658  
2659   umode_items:  umode_items ',' umode_item | umode_item;
2660   umode_item:   T_BOTS
# Line 2915 | Line 2734 | general_default_floodcount: DEFAULT_FLOO
2734    ConfigGeneral.default_floodcount = $3;
2735   };
2736  
2737 + general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2738 + {
2739 +  ConfigGeneral.default_floodtime = $3;
2740 + };
2741 +
2742  
2743   /***************************************************************************
2744 < *  section channel
2744 > * channel {} section
2745   ***************************************************************************/
2746 < channel_entry: CHANNEL
2923 <  '{' channel_items '}' ';';
2746 > channel_entry: CHANNEL '{' channel_items '}' ';';
2747  
2748   channel_items:      channel_items channel_item | channel_item;
2749   channel_item:       channel_max_bans |
2750 +                    channel_max_bans_large |
2751                      channel_invite_client_count |
2752                      channel_invite_client_time |
2753 +                    channel_invite_delay_channel |
2754 +                    channel_invite_expire_time |
2755                      channel_knock_client_count |
2756                      channel_knock_client_time |
2757                      channel_knock_delay_channel |
2758                      channel_max_channels |
2759 <                    channel_default_split_user_count |
2760 <                    channel_default_split_server_count |
2761 <                    channel_no_create_on_split |
2936 <                    channel_no_join_on_split |
2937 <                    channel_jflood_count |
2938 <                    channel_jflood_time |
2759 >                    channel_max_invites |
2760 >                    channel_default_join_flood_count |
2761 >                    channel_default_join_flood_time |
2762                      channel_disable_fake_channels |
2763                      error;
2764  
# Line 2954 | Line 2777 | channel_invite_client_time: INVITE_CLIEN
2777    ConfigChannel.invite_client_time = $3;
2778   };
2779  
2780 + channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2781 + {
2782 +  ConfigChannel.invite_delay_channel = $3;
2783 + };
2784 +
2785 + channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2786 + {
2787 +  ConfigChannel.invite_expire_time = $3;
2788 + };
2789 +
2790   channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2791   {
2792    ConfigChannel.knock_client_count = $3;
# Line 2974 | Line 2807 | channel_max_channels: MAX_CHANNELS '=' N
2807    ConfigChannel.max_channels = $3;
2808   };
2809  
2810 < channel_max_bans: MAX_BANS '=' NUMBER ';'
2978 < {
2979 <  ConfigChannel.max_bans = $3;
2980 < };
2981 <
2982 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2810 > channel_max_invites: MAX_INVITES '=' NUMBER ';'
2811   {
2812 <  ConfigChannel.default_split_user_count = $3;
2812 >  ConfigChannel.max_invites = $3;
2813   };
2814  
2815 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2815 > channel_max_bans: MAX_BANS '=' NUMBER ';'
2816   {
2817 <  ConfigChannel.default_split_server_count = $3;
2817 >  ConfigChannel.max_bans = $3;
2818   };
2819  
2820 < channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
2820 > channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2821   {
2822 <  ConfigChannel.no_create_on_split = yylval.number;
2822 >  ConfigChannel.max_bans_large = $3;
2823   };
2824  
2825 < channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2825 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2826   {
2827 <  ConfigChannel.no_join_on_split = yylval.number;
2827 >  ConfigChannel.default_join_flood_count = yylval.number;
2828   };
2829  
2830 < channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2830 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2831   {
2832 <  GlobalSetOptions.joinfloodcount = yylval.number;
2832 >  ConfigChannel.default_join_flood_time = $3;
2833   };
2834  
3007 channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
3008 {
3009  GlobalSetOptions.joinfloodtime = $3;
3010 };
2835  
2836   /***************************************************************************
2837 < *  section serverhide
2837 > * serverhide {} section
2838   ***************************************************************************/
2839 < serverhide_entry: SERVERHIDE
3016 <  '{' serverhide_items '}' ';';
2839 > serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2840  
2841   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2842   serverhide_item:    serverhide_flatten_links |
2843 +                    serverhide_flatten_links_delay |
2844 +                    serverhide_flatten_links_file |
2845                      serverhide_disable_remote_commands |
2846                      serverhide_hide_servers |
2847                      serverhide_hide_services |
3023                    serverhide_links_delay |
2848                      serverhide_hidden |
2849                      serverhide_hidden_name |
2850                      serverhide_hide_server_ips |
# Line 3032 | Line 2856 | serverhide_flatten_links: FLATTEN_LINKS
2856      ConfigServerHide.flatten_links = yylval.number;
2857   };
2858  
2859 + serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2860 + {
2861 +  if (conf_parser_ctx.pass == 2)
2862 +  {
2863 +    if ($3 > 0)
2864 +    {
2865 +      event_write_links_file.when = $3;
2866 +      event_add(&event_write_links_file, NULL);
2867 +    }
2868 +    else
2869 +     event_delete(&event_write_links_file);
2870 +
2871 +    ConfigServerHide.flatten_links_delay = $3;
2872 +  }
2873 + };
2874 +
2875 + serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2876 + {
2877 +  if (conf_parser_ctx.pass == 2)
2878 +  {
2879 +    xfree(ConfigServerHide.flatten_links_file);
2880 +    ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2881 +  }
2882 + };
2883 +
2884   serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2885   {
2886    if (conf_parser_ctx.pass == 2)
# Line 3054 | Line 2903 | serverhide_hidden_name: HIDDEN_NAME '='
2903   {
2904    if (conf_parser_ctx.pass == 2)
2905    {
2906 <    MyFree(ConfigServerHide.hidden_name);
2906 >    xfree(ConfigServerHide.hidden_name);
2907      ConfigServerHide.hidden_name = xstrdup(yylval.string);
2908    }
2909   };
2910  
3062 serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3063 {
3064  if (conf_parser_ctx.pass == 2)
3065  {
3066    if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3067    {
3068      event_write_links_file.when = $3;
3069      event_addish(&event_write_links_file, NULL);
3070      ConfigServerHide.links_disabled = 0;
3071    }
3072
3073    ConfigServerHide.links_delay = $3;
3074  }
3075 };
3076
2911   serverhide_hidden: HIDDEN '=' TBOOL ';'
2912   {
2913    if (conf_parser_ctx.pass == 2)

Comparing ircd-hybrid/trunk/src/conf_parser.y (property svn:keywords):
Revision 4499 by michael, Sat Aug 16 18:29:23 2014 UTC vs.
Revision 8877 by michael, Sat Feb 16 22:42:59 2019 UTC

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

Diff Legend

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