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 8963 by michael, Sat May 11 21:06:49 2019 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 2000-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  EXPIRATION
184   %token  FAILED_OPER_NOTICE
185   %token  FLATTEN_LINKS
186 + %token  FLATTEN_LINKS_DELAY
187 + %token  FLATTEN_LINKS_FILE
188   %token  GECOS
189   %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
190   %token  HIDDEN
191   %token  HIDDEN_NAME
192   %token  HIDE_CHANS
# Line 203 | Line 195 | reset_block_state(void)
195   %token  HIDE_SERVER_IPS
196   %token  HIDE_SERVERS
197   %token  HIDE_SERVICES
206 %token  HIDE_SPOOF_IPS
198   %token  HOST
199   %token  HUB
200   %token  HUB_MASK
210 %token  IGNORE_BOGUS_TS
201   %token  INVISIBLE_ON_CONNECT
202   %token  INVITE_CLIENT_COUNT
203   %token  INVITE_CLIENT_TIME
204 + %token  INVITE_DELAY_CHANNEL
205 + %token  INVITE_EXPIRE_TIME
206   %token  IP
207   %token  IRCD_AUTH
208   %token  IRCD_FLAGS
209   %token  IRCD_SID
210 < %token  JOIN_FLOOD_COUNT
219 < %token  JOIN_FLOOD_TIME
210 > %token  JOIN
211   %token  KILL
212   %token  KILL_CHASE_TIME_LIMIT
213   %token  KLINE
214   %token  KLINE_EXEMPT
215 + %token  KLINE_MIN_CIDR
216 + %token  KLINE_MIN_CIDR6
217   %token  KNOCK_CLIENT_COUNT
218   %token  KNOCK_CLIENT_TIME
219   %token  KNOCK_DELAY_CHANNEL
220   %token  LEAF_MASK
228 %token  LINKS_DELAY
221   %token  LISTEN
222   %token  MASK
223   %token  MAX_ACCEPT
224   %token  MAX_BANS
225 + %token  MAX_BANS_LARGE
226   %token  MAX_CHANNELS
234 %token  MAX_GLOBAL
235 %token  MAX_IDENT
227   %token  MAX_IDLE
228 < %token  MAX_LOCAL
228 > %token  MAX_INVITES
229   %token  MAX_NICK_CHANGES
230   %token  MAX_NICK_LENGTH
231   %token  MAX_NICK_TIME
# Line 254 | Line 245 | reset_block_state(void)
245   %token  NETWORK_DESC
246   %token  NETWORK_NAME
247   %token  NICK
257 %token  NO_CREATE_ON_SPLIT
258 %token  NO_JOIN_ON_SPLIT
248   %token  NO_OPER_FLOOD
249   %token  NO_TILDE
250   %token  NUMBER
251   %token  NUMBER_PER_CIDR
252 < %token  NUMBER_PER_IP
252 > %token  NUMBER_PER_IP_GLOBAL
253 > %token  NUMBER_PER_IP_LOCAL
254   %token  OPER_ONLY_UMODES
265 %token  OPER_PASS_RESV
255   %token  OPER_UMODES
256   %token  OPERATOR
257   %token  OPERS_BYPASS_CALLERID
# Line 284 | Line 273 | reset_block_state(void)
273   %token  RESV
274   %token  RESV_EXEMPT
275   %token  RSA_PRIVATE_KEY_FILE
287 %token  RSA_PUBLIC_KEY_FILE
276   %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
277   %token  SEND_PASSWORD
278   %token  SENDQ
# Line 303 | Line 291 | reset_block_state(void)
291   %token  STATS_E_DISABLED
292   %token  STATS_I_OPER_ONLY
293   %token  STATS_K_OPER_ONLY
294 + %token  STATS_M_OPER_ONLY
295   %token  STATS_O_OPER_ONLY
296   %token  STATS_P_OPER_ONLY
297   %token  STATS_U_OPER_ONLY
298   %token  T_ALL
299 + %token  T_BIND
300   %token  T_BOTS
301   %token  T_CALLERID
302   %token  T_CCONN
303 + %token  T_COMMAND
304   %token  T_CLUSTER
305   %token  T_DEAF
306   %token  T_DEBUG
# Line 324 | Line 315 | reset_block_state(void)
315   %token  T_IPV6
316   %token  T_LOCOPS
317   %token  T_LOG
327 %token  T_MAX_CLIENTS
318   %token  T_NCHANGE
319   %token  T_NONONREG
320 + %token  T_OPME
321 + %token  T_PREPEND
322 + %token  T_PSEUDO
323   %token  T_RECVQ
324   %token  T_REJ
325   %token  T_RESTART
326   %token  T_SERVER
327   %token  T_SERVICE
335 %token  T_SERVICES_NAME
328   %token  T_SERVNOTICE
329   %token  T_SET
330   %token  T_SHARED
# Line 342 | Line 334 | reset_block_state(void)
334   %token  T_SPY
335   %token  T_SSL
336   %token  T_SSL_CIPHER_LIST
337 + %token  T_TARGET
338   %token  T_UMODES
339   %token  T_UNAUTH
340   %token  T_UNDLINE
# Line 354 | Line 347 | reset_block_state(void)
347   %token  TBOOL
348   %token  THROTTLE_COUNT
349   %token  THROTTLE_TIME
357 %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 <    nuh.nuhmask  = ptr->data;
921 >    if (EmptyString(s))
922 >      continue;
923 >
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 1270 | Line 1122 | oper_umodes_item:  T_BOTS
1122   {
1123    if (conf_parser_ctx.pass == 2)
1124      block_state.modes.value |= UMODE_FARCONNECT;
1125 + } | EXPIRATION
1126 + {
1127 +  if (conf_parser_ctx.pass == 2)
1128 +    block_state.modes.value |= UMODE_EXPIRATION;
1129   };
1130  
1131   oper_flags: IRCD_FLAGS
# Line 1327 | Line 1183 | oper_flags_item: KILL ':' REMOTE
1183   {
1184    if (conf_parser_ctx.pass == 2)
1185      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;
1186   } | DIE
1187   {
1188    if (conf_parser_ctx.pass == 2)
# Line 1339 | Line 1191 | oper_flags_item: KILL ':' REMOTE
1191   {
1192    if (conf_parser_ctx.pass == 2)
1193      block_state.port.value |= OPER_FLAG_RESTART;
1194 + } | REHASH ':' REMOTE
1195 + {
1196 +  if (conf_parser_ctx.pass == 2)
1197 +    block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1198   } | REHASH
1199   {
1200    if (conf_parser_ctx.pass == 2)
# Line 1371 | Line 1227 | oper_flags_item: KILL ':' REMOTE
1227   {
1228    if (conf_parser_ctx.pass == 2)
1229      block_state.port.value |= OPER_FLAG_MODULE;
1230 + } | T_OPME
1231 + {
1232 +  if (conf_parser_ctx.pass == 2)
1233 +    block_state.port.value |= OPER_FLAG_OPME;
1234 + } | NICK ':' RESV
1235 + {
1236 +  if (conf_parser_ctx.pass == 2)
1237 +    block_state.port.value |= OPER_FLAG_NICK_RESV;
1238 + } | JOIN ':' RESV
1239 + {
1240 +  if (conf_parser_ctx.pass == 2)
1241 +    block_state.port.value |= OPER_FLAG_JOIN_RESV;
1242 + } | RESV
1243 + {
1244 +  if (conf_parser_ctx.pass == 2)
1245 +    block_state.port.value |= OPER_FLAG_RESV;
1246 + } | T_UNRESV
1247 + {
1248 +  if (conf_parser_ctx.pass == 2)
1249 +    block_state.port.value |= OPER_FLAG_UNRESV;
1250 + } | CLOSE
1251 + {
1252 +  if (conf_parser_ctx.pass == 2)
1253 +    block_state.port.value |= OPER_FLAG_CLOSE;
1254   };
1255  
1256  
1257   /***************************************************************************
1258 < *  section class
1258 > * class {} section
1259   ***************************************************************************/
1260   class_entry: CLASS
1261   {
# Line 1391 | Line 1271 | class_entry: CLASS
1271    block_state.max_recvq.value = DEFAULT_RECVQ;
1272   } '{' class_items '}' ';'
1273   {
1394  struct ClassItem *class = NULL;
1395
1274    if (conf_parser_ctx.pass != 1)
1275      break;
1276  
1277    if (!block_state.class.buf[0])
1278      break;
1279  
1280 <  if (!(class = class_find(block_state.class.buf, 0)))
1280 >  struct ClassItem *class = class_find(block_state.class.buf, false);
1281 >  if (class == NULL)
1282      class = class_make();
1283  
1284 <  class->active = 1;
1285 <  MyFree(class->name);
1284 >  class->active = true;
1285 >  xfree(class->name);
1286    class->name = xstrdup(block_state.class.buf);
1287    class->ping_freq = block_state.ping_freq.value;
1288 <  class->max_perip = block_state.max_perip.value;
1288 >  class->max_perip_local = block_state.max_perip_local.value;
1289 >  class->max_perip_global = block_state.max_perip_global.value;
1290    class->con_freq = block_state.con_freq.value;
1291    class->max_total = block_state.max_total.value;
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;
1292    class->max_sendq = block_state.max_sendq.value;
1293    class->max_recvq = block_state.max_recvq.value;
1294    class->max_channels = block_state.max_channels.value;
# Line 1427 | Line 1304 | class_entry: CLASS
1304    class->min_idle = block_state.min_idle.value;
1305    class->max_idle = block_state.max_idle.value;
1306  
1307 <  if (class->number_per_cidr && block_state.number_per_cidr.value)
1308 <    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 <
1307 >  bool diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value ||
1308 >               class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value);
1309    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1310    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1311    class->number_per_cidr = block_state.number_per_cidr.value;
1312 +
1313 +  if (diff)
1314 +    class_ip_limit_rebuild(class);
1315   };
1316  
1317   class_items:    class_items class_item | class_item;
# Line 1445 | Line 1320 | class_item:     class_name |
1320                  class_cidr_bitlen_ipv6 |
1321                  class_ping_time |
1322                  class_number_per_cidr |
1323 <                class_number_per_ip |
1323 >                class_number_per_ip_local |
1324 >                class_number_per_ip_global |
1325                  class_connectfreq |
1326                  class_max_channels |
1327                  class_max_number |
1328 <                class_max_global |
1329 <                class_max_local |
1454 <                class_max_ident |
1455 <                class_sendq | class_recvq |
1328 >                class_sendq |
1329 >                class_recvq |
1330                  class_min_idle |
1331                  class_max_idle |
1332                  class_flags |
# Line 1470 | Line 1344 | class_ping_time: PING_TIME '=' timespec
1344      block_state.ping_freq.value = $3;
1345   };
1346  
1347 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1347 > class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1348   {
1349    if (conf_parser_ctx.pass == 1)
1350 <    block_state.max_perip.value = $3;
1350 >    block_state.max_perip_local.value = $3;
1351 > };
1352 >
1353 > class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1354 > {
1355 >  if (conf_parser_ctx.pass == 1)
1356 >    block_state.max_perip_global.value = $3;
1357   };
1358  
1359   class_connectfreq: CONNECTFREQ '=' timespec ';'
# Line 1494 | Line 1374 | class_max_number: MAX_NUMBER '=' NUMBER
1374      block_state.max_total.value = $3;
1375   };
1376  
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
1377   class_sendq: SENDQ '=' sizespec ';'
1378   {
1379    if (conf_parser_ctx.pass == 1)
# Line 1580 | Line 1442 | class_flags_item: RANDOM_IDLE
1442  
1443  
1444   /***************************************************************************
1445 < *  section listen
1445 > * listen {} section
1446   ***************************************************************************/
1447   listen_entry: LISTEN
1448   {
# Line 1619 | Line 1481 | port_item: NUMBER
1481   {
1482    if (conf_parser_ctx.pass == 2)
1483    {
1484 < #ifndef HAVE_LIBCRYPTO
1484 > #ifndef HAVE_TLS
1485      if (block_state.flags.value & LISTENER_SSL)
1486      {
1487 <      conf_error_report("SSL not available - port closed");
1487 >      conf_error_report("TLS not available - port closed");
1488        break;
1489      }
1490   #endif
1491 <    add_listener($1, block_state.addr.buf, block_state.flags.value);
1491 >    listener_add($1, block_state.addr.buf, block_state.flags.value);
1492    }
1493   } | NUMBER TWODOTS NUMBER
1494   {
1495    if (conf_parser_ctx.pass == 2)
1496    {
1497 < #ifndef HAVE_LIBCRYPTO
1497 > #ifndef HAVE_TLS
1498      if (block_state.flags.value & LISTENER_SSL)
1499      {
1500 <      conf_error_report("SSL not available - port closed");
1500 >      conf_error_report("TLS not available - port closed");
1501        break;
1502      }
1503   #endif
1504  
1505      for (int i = $1; i <= $3; ++i)
1506 <      add_listener(i, block_state.addr.buf, block_state.flags.value);
1506 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1507    }
1508   };
1509  
# Line 1657 | Line 1519 | listen_host: HOST '=' QSTRING ';'
1519      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1520   };
1521  
1522 +
1523   /***************************************************************************
1524 < *  section auth
1524 > * auth {} section
1525   ***************************************************************************/
1526   auth_entry: IRCD_AUTH
1527   {
# Line 1666 | Line 1529 | auth_entry: IRCD_AUTH
1529      reset_block_state();
1530   } '{' auth_items '}' ';'
1531   {
1532 <  dlink_node *ptr = NULL;
1532 >  dlink_node *node = NULL;
1533  
1534    if (conf_parser_ctx.pass != 2)
1535      break;
1536  
1537 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
1537 >  DLINK_FOREACH(node, block_state.mask.list.head)
1538    {
1676    struct MaskItem *conf = NULL;
1539      struct split_nuh_item nuh;
1540 +    char *s = node->data;
1541 +
1542 +    if (EmptyString(s))
1543 +      continue;
1544  
1545 <    nuh.nuhmask  = ptr->data;
1545 >    nuh.nuhmask  = s;
1546      nuh.nickptr  = NULL;
1547      nuh.userptr  = block_state.user.buf;
1548      nuh.hostptr  = block_state.host.buf;
1549 +
1550      nuh.nicksize = 0;
1551      nuh.usersize = sizeof(block_state.user.buf);
1552      nuh.hostsize = sizeof(block_state.host.buf);
1553 +
1554      split_nuh(&nuh);
1555  
1556 <    conf        = conf_make(CONF_CLIENT);
1557 <    conf->user  = xstrdup(block_state.user.buf);
1558 <    conf->host  = xstrdup(block_state.host.buf);
1556 >    struct MaskItem *conf = conf_make(CONF_CLIENT);
1557 >    conf->user = xstrdup(block_state.user.buf);
1558 >    conf->host = xstrdup(block_state.host.buf);
1559  
1560      if (block_state.rpass.buf[0])
1561        conf->passwd = xstrdup(block_state.rpass.buf);
# Line 1746 | Line 1614 | auth_flags: IRCD_FLAGS
1614   {
1615    if (conf_parser_ctx.pass == 2)
1616      block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1617 < } '='  auth_flags_items ';';
1617 > } '=' auth_flags_items ';';
1618  
1619   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1620   auth_flags_item: SPOOF_NOTICE
# Line 1761 | Line 1629 | auth_flags_item: SPOOF_NOTICE
1629   {
1630    if (conf_parser_ctx.pass == 2)
1631      block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1632 + } | XLINE_EXEMPT
1633 + {
1634 +  if (conf_parser_ctx.pass == 2)
1635 +    block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1636   } | NEED_IDENT
1637   {
1638    if (conf_parser_ctx.pass == 2)
# Line 1773 | Line 1645 | auth_flags_item: SPOOF_NOTICE
1645   {
1646    if (conf_parser_ctx.pass == 2)
1647      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;
1648   } | RESV_EXEMPT
1649   {
1650    if (conf_parser_ctx.pass == 2)
# Line 1825 | Line 1693 | auth_redir_port: REDIRPORT '=' NUMBER ';
1693  
1694  
1695   /***************************************************************************
1696 < *  section resv
1696 > * resv {} section
1697   ***************************************************************************/
1698   resv_entry: RESV
1699   {
# Line 1839 | Line 1707 | resv_entry: RESV
1707    if (conf_parser_ctx.pass != 2)
1708      break;
1709  
1710 <  create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1710 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1711   };
1712  
1713   resv_items:     resv_items resv_item | resv_item;
# Line 1865 | Line 1733 | resv_exempt: EXEMPT '=' QSTRING ';'
1733  
1734  
1735   /***************************************************************************
1736 < *  section service
1736 > * service {} section
1737   ***************************************************************************/
1738   service_entry: T_SERVICE '{' service_items '}' ';';
1739  
# Line 1877 | Line 1745 | service_name: NAME '=' QSTRING ';'
1745    if (conf_parser_ctx.pass != 2)
1746      break;
1747  
1748 <  if (valid_servname(yylval.string))
1748 >  if (server_valid_name(yylval.string) == true)
1749    {
1750 <    struct MaskItem *conf = conf_make(CONF_SERVICE);
1751 <    conf->name = xstrdup(yylval.string);
1750 >    struct ServiceItem *service = service_make();
1751 >    service->name = xstrdup(yylval.string);
1752    }
1753   };
1754  
1755 +
1756   /***************************************************************************
1757 < *  section shared, for sharing remote klines etc.
1757 > * shared {} section, for sharing remote klines etc.
1758   ***************************************************************************/
1759   shared_entry: T_SHARED
1760   {
# Line 1900 | Line 1769 | shared_entry: T_SHARED
1769    block_state.flags.value = SHARED_ALL;
1770   } '{' shared_items '}' ';'
1771   {
1903  struct MaskItem *conf = NULL;
1904
1772    if (conf_parser_ctx.pass != 2)
1773      break;
1774  
1775 <  conf = conf_make(CONF_ULINE);
1776 <  conf->flags = block_state.flags.value;
1777 <  conf->name = xstrdup(block_state.name.buf);
1778 <  conf->user = xstrdup(block_state.user.buf);
1779 <  conf->host = xstrdup(block_state.host.buf);
1775 >  struct SharedItem *shared = shared_make();
1776 >  shared->type = block_state.flags.value;
1777 >  shared->server = xstrdup(block_state.name.buf);
1778 >  shared->user = xstrdup(block_state.user.buf);
1779 >  shared->host = xstrdup(block_state.host.buf);
1780   };
1781  
1782   shared_items: shared_items shared_item | shared_item;
# Line 1989 | Line 1856 | shared_type_item: KLINE
1856      block_state.flags.value = SHARED_ALL;
1857   };
1858  
1859 +
1860   /***************************************************************************
1861 < *  section cluster
1861 > * cluster {} section
1862   ***************************************************************************/
1863   cluster_entry: T_CLUSTER
1864   {
# Line 2000 | Line 1868 | cluster_entry: T_CLUSTER
1868    reset_block_state();
1869  
1870    strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1871 <  block_state.flags.value = SHARED_ALL;
1871 >  block_state.flags.value = CLUSTER_ALL;
1872   } '{' cluster_items '}' ';'
1873   {
2006  struct MaskItem *conf = NULL;
2007
1874    if (conf_parser_ctx.pass != 2)
1875      break;
1876  
1877 <  conf = conf_make(CONF_CLUSTER);
1878 <  conf->flags = block_state.flags.value;
1879 <  conf->name = xstrdup(block_state.name.buf);
1877 >  struct ClusterItem *cluster = cluster_make();
1878 >  cluster->type = block_state.flags.value;
1879 >  cluster->server = xstrdup(block_state.name.buf);
1880   };
1881  
1882   cluster_items:  cluster_items cluster_item | cluster_item;
# Line 2032 | Line 1898 | cluster_types:  cluster_types ',' cluste
1898   cluster_type_item: KLINE
1899   {
1900    if (conf_parser_ctx.pass == 2)
1901 <    block_state.flags.value |= SHARED_KLINE;
1901 >    block_state.flags.value |= CLUSTER_KLINE;
1902   } | UNKLINE
1903   {
1904    if (conf_parser_ctx.pass == 2)
1905 <    block_state.flags.value |= SHARED_UNKLINE;
1905 >    block_state.flags.value |= CLUSTER_UNKLINE;
1906   } | T_DLINE
1907   {
1908    if (conf_parser_ctx.pass == 2)
1909 <    block_state.flags.value |= SHARED_DLINE;
1909 >    block_state.flags.value |= CLUSTER_DLINE;
1910   } | T_UNDLINE
1911   {
1912    if (conf_parser_ctx.pass == 2)
1913 <    block_state.flags.value |= SHARED_UNDLINE;
1913 >    block_state.flags.value |= CLUSTER_UNDLINE;
1914   } | XLINE
1915   {
1916    if (conf_parser_ctx.pass == 2)
1917 <    block_state.flags.value |= SHARED_XLINE;
1917 >    block_state.flags.value |= CLUSTER_XLINE;
1918   } | T_UNXLINE
1919   {
1920    if (conf_parser_ctx.pass == 2)
1921 <    block_state.flags.value |= SHARED_UNXLINE;
1921 >    block_state.flags.value |= CLUSTER_UNXLINE;
1922   } | RESV
1923   {
1924    if (conf_parser_ctx.pass == 2)
1925 <    block_state.flags.value |= SHARED_RESV;
1925 >    block_state.flags.value |= CLUSTER_RESV;
1926   } | T_UNRESV
1927   {
1928    if (conf_parser_ctx.pass == 2)
1929 <    block_state.flags.value |= SHARED_UNRESV;
1929 >    block_state.flags.value |= CLUSTER_UNRESV;
1930   } | T_LOCOPS
1931   {
1932    if (conf_parser_ctx.pass == 2)
1933 <    block_state.flags.value |= SHARED_LOCOPS;
1933 >    block_state.flags.value |= CLUSTER_LOCOPS;
1934   } | T_ALL
1935   {
1936    if (conf_parser_ctx.pass == 2)
1937 <    block_state.flags.value = SHARED_ALL;
1937 >    block_state.flags.value = CLUSTER_ALL;
1938   };
1939  
1940 +
1941   /***************************************************************************
1942 < *  section connect
1942 > * connect {}  section
1943   ***************************************************************************/
1944   connect_entry: CONNECT
1945   {
# Line 2085 | Line 1952 | connect_entry: CONNECT
1952    block_state.port.value = PORTNUM;
1953   } '{' connect_items '}' ';'
1954   {
2088  struct MaskItem *conf = NULL;
1955    struct addrinfo hints, *res;
1956  
1957    if (conf_parser_ctx.pass != 2)
# Line 2099 | Line 1965 | connect_entry: CONNECT
1965        !block_state.spass.buf[0])
1966      break;
1967  
1968 +  if (server_valid_name(block_state.name.buf) == false)
1969 +    break;
1970 +
1971    if (has_wildcards(block_state.name.buf) ||
1972        has_wildcards(block_state.host.buf))
1973      break;
1974  
1975 <  conf = conf_make(CONF_SERVER);
1975 >  struct MaskItem *conf = conf_make(CONF_SERVER);
1976 >  conf->addr = xcalloc(sizeof(*conf->addr));
1977    conf->port = block_state.port.value;
1978    conf->flags = block_state.flags.value;
1979    conf->aftype = block_state.aftype.value;
# Line 2130 | Line 2000 | connect_entry: CONNECT
2000      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2001  
2002      if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2003 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2003 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server bind(%s)", block_state.bind.buf);
2004      else
2005      {
2006        assert(res);
2007  
2008 <      memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2009 <      conf->bind.ss.ss_family = res->ai_family;
2010 <      conf->bind.ss_len = res->ai_addrlen;
2008 >      conf->bind = xcalloc(sizeof(*conf->bind));
2009 >
2010 >      memcpy(conf->bind, res->ai_addr, res->ai_addrlen);
2011 >      conf->bind->ss_len = res->ai_addrlen;
2012        freeaddrinfo(res);
2013      }
2014    }
# Line 2149 | Line 2020 | connect_entry: CONNECT
2020   connect_items:  connect_items connect_item | connect_item;
2021   connect_item:   connect_name |
2022                  connect_host |
2023 <                connect_vhost |
2023 >                connect_bind |
2024                  connect_send_password |
2025                  connect_accept_password |
2026                  connect_ssl_certificate_fingerprint |
# Line 2175 | Line 2046 | connect_host: HOST '=' QSTRING ';'
2046      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2047   };
2048  
2049 < connect_vhost: VHOST '=' QSTRING ';'
2049 > connect_bind: T_BIND '=' QSTRING ';'
2050   {
2051    if (conf_parser_ctx.pass == 2)
2052      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
# Line 2186 | Line 2057 | connect_send_password: SEND_PASSWORD '='
2057    if (conf_parser_ctx.pass != 2)
2058      break;
2059  
2060 <  if ($3[0] == ':')
2060 >  if (*yylval.string == ':')
2061      conf_error_report("Server passwords cannot begin with a colon");
2062 <  else if (strchr($3, ' '))
2062 >  else if (strchr(yylval.string, ' '))
2063      conf_error_report("Server passwords cannot contain spaces");
2064    else
2065      strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
# Line 2199 | Line 2070 | connect_accept_password: ACCEPT_PASSWORD
2070    if (conf_parser_ctx.pass != 2)
2071      break;
2072  
2073 <  if ($3[0] == ':')
2073 >  if (*yylval.string == ':')
2074      conf_error_report("Server passwords cannot begin with a colon");
2075 <  else if (strchr($3, ' '))
2075 >  else if (strchr(yylval.string, ' '))
2076      conf_error_report("Server passwords cannot contain spaces");
2077    else
2078      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2232 | Line 2103 | connect_aftype: AFTYPE '=' T_IPV4 ';'
2103   connect_flags: IRCD_FLAGS
2104   {
2105    block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2106 < } '='  connect_flags_items ';';
2106 > } '=' connect_flags_items ';';
2107  
2108   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2109   connect_flags_item: AUTOCONN
# Line 2276 | Line 2147 | connect_class: CLASS '=' QSTRING ';'
2147  
2148   connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2149   {
2150 < #ifdef HAVE_LIBCRYPTO
2150 > #ifdef HAVE_TLS
2151    if (conf_parser_ctx.pass == 2)
2152      strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2153   #else
2154    if (conf_parser_ctx.pass == 2)
2155 <    conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2155 >    conf_error_report("Ignoring connect::ciphers -- no TLS support");
2156   #endif
2157   };
2158  
2159  
2160   /***************************************************************************
2161 < *  section kill
2161 > * kill {} section
2162   ***************************************************************************/
2163   kill_entry: KILL
2164   {
# Line 2295 | Line 2166 | kill_entry: KILL
2166      reset_block_state();
2167   } '{' kill_items '}' ';'
2168   {
2298  struct MaskItem *conf = NULL;
2299
2169    if (conf_parser_ctx.pass != 2)
2170      break;
2171  
# Line 2304 | Line 2173 | kill_entry: KILL
2173        !block_state.host.buf[0])
2174      break;
2175  
2176 <  conf = conf_make(CONF_KLINE);
2176 >  struct MaskItem *conf = conf_make(CONF_KLINE);
2177    conf->user = xstrdup(block_state.user.buf);
2178    conf->host = xstrdup(block_state.host.buf);
2179  
# Line 2344 | Line 2213 | kill_reason: REASON '=' QSTRING ';'
2213      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2214   };
2215  
2216 +
2217   /***************************************************************************
2218 < *  section deny
2218 > * deny {} section
2219   ***************************************************************************/
2220   deny_entry: DENY
2221   {
# Line 2353 | Line 2223 | deny_entry: DENY
2223      reset_block_state();
2224   } '{' deny_items '}' ';'
2225   {
2356  struct MaskItem *conf = NULL;
2357
2226    if (conf_parser_ctx.pass != 2)
2227      break;
2228  
# Line 2363 | Line 2231 | deny_entry: DENY
2231  
2232    if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2233    {
2234 <    conf = conf_make(CONF_DLINE);
2234 >    struct MaskItem *conf = conf_make(CONF_DLINE);
2235      conf->host = xstrdup(block_state.addr.buf);
2236  
2237      if (block_state.rpass.buf[0])
# Line 2389 | Line 2257 | deny_reason: REASON '=' QSTRING ';'
2257      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2258   };
2259  
2260 +
2261   /***************************************************************************
2262 < *  section exempt
2262 > * exempt {} section
2263   ***************************************************************************/
2264   exempt_entry: EXEMPT '{' exempt_items '}' ';';
2265  
2266 < exempt_items:     exempt_items exempt_item | exempt_item;
2267 < exempt_item:      exempt_ip | error;
2266 > exempt_items: exempt_items exempt_item | exempt_item;
2267 > exempt_item:  exempt_ip | error;
2268  
2269   exempt_ip: IP '=' QSTRING ';'
2270   {
2271    if (conf_parser_ctx.pass == 2)
2272    {
2273 <    if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2273 >    if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2274      {
2275        struct MaskItem *conf = conf_make(CONF_EXEMPT);
2276        conf->host = xstrdup(yylval.string);
# Line 2412 | Line 2281 | exempt_ip: IP '=' QSTRING ';'
2281   };
2282  
2283   /***************************************************************************
2284 < *  section gecos
2284 > * gecos {} section
2285   ***************************************************************************/
2286   gecos_entry: GECOS
2287   {
# Line 2420 | Line 2289 | gecos_entry: GECOS
2289      reset_block_state();
2290   } '{' gecos_items '}' ';'
2291   {
2423  struct MaskItem *conf = NULL;
2424
2292    if (conf_parser_ctx.pass != 2)
2293      break;
2294  
2295    if (!block_state.name.buf[0])
2296      break;
2297  
2298 <  conf = conf_make(CONF_XLINE);
2299 <  conf->name = xstrdup(block_state.name.buf);
2298 >  struct GecosItem *gecos = gecos_make();
2299 >  gecos->mask = xstrdup(block_state.name.buf);
2300  
2301    if (block_state.rpass.buf[0])
2302 <    conf->reason = xstrdup(block_state.rpass.buf);
2302 >    gecos->reason = xstrdup(block_state.rpass.buf);
2303    else
2304 <    conf->reason = xstrdup(CONF_NOREASON);
2304 >    gecos->reason = xstrdup(CONF_NOREASON);
2305   };
2306  
2307   gecos_items: gecos_items gecos_item | gecos_item;
# Line 2452 | Line 2319 | gecos_reason: REASON '=' QSTRING ';'
2319      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2320   };
2321  
2322 +
2323   /***************************************************************************
2324 < *  section general
2324 > * general {} section
2325   ***************************************************************************/
2326 < general_entry: GENERAL
2459 <  '{' general_items '}' ';';
2326 > general_entry: GENERAL '{' general_items '}' ';';
2327  
2328   general_items:      general_items general_item | general_item;
2329   general_item:       general_away_count |
2330                      general_away_time |
2464                    general_hide_spoof_ips |
2465                    general_ignore_bogus_ts |
2331                      general_failed_oper_notice |
2332                      general_anti_nick_flood |
2333                      general_max_nick_time |
2334                      general_max_nick_changes |
2335                      general_max_accept |
2336 +                    general_whowas_history_length |
2337                      general_anti_spam_exit_message_time |
2338                      general_ts_warn_delta |
2339                      general_ts_max_delta |
# Line 2475 | Line 2341 | general_item:       general_away_count |
2341                      general_invisible_on_connect |
2342                      general_warn_no_connect_block |
2343                      general_dots_in_ident |
2478                    general_stats_o_oper_only |
2479                    general_stats_k_oper_only |
2480                    general_pace_wait |
2344                      general_stats_i_oper_only |
2345 <                    general_pace_wait_simple |
2345 >                    general_stats_k_oper_only |
2346 >                    general_stats_m_oper_only |
2347 >                    general_stats_o_oper_only |
2348                      general_stats_P_oper_only |
2349                      general_stats_u_oper_only |
2350 +                    general_pace_wait |
2351 +                    general_pace_wait_simple |
2352                      general_short_motd |
2353                      general_no_oper_flood |
2487                    general_true_no_oper_flood |
2488                    general_oper_pass_resv |
2354                      general_oper_only_umodes |
2355                      general_max_targets |
2356                      general_oper_umodes |
2357                      general_caller_id_wait |
2358                      general_opers_bypass_callerid |
2359                      general_default_floodcount |
2360 +                    general_default_floodtime |
2361                      general_min_nonwildcard |
2362                      general_min_nonwildcard_simple |
2363                      general_throttle_count |
2364                      general_throttle_time |
2499                    general_havent_read_conf |
2365                      general_ping_cookie |
2366                      general_disable_auth |
2367 <                    general_tkline_expire_notices |
2368 <                    general_gline_enable |
2369 <                    general_gline_duration |
2370 <                    general_gline_request_duration |
2506 <                    general_gline_min_cidr |
2507 <                    general_gline_min_cidr6 |
2367 >                    general_dline_min_cidr |
2368 >                    general_dline_min_cidr6 |
2369 >                    general_kline_min_cidr |
2370 >                    general_kline_min_cidr6 |
2371                      general_stats_e_disabled |
2372                      general_max_watch |
2510                    general_services_name |
2373                      general_cycle_on_host_change |
2374                      error;
2375  
# Line 2527 | Line 2389 | general_max_watch: MAX_WATCH '=' NUMBER
2389    ConfigGeneral.max_watch = $3;
2390   };
2391  
2392 < general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2392 > general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2393   {
2394 <  if (conf_parser_ctx.pass == 2)
2533 <    ConfigGeneral.cycle_on_host_change = yylval.number;
2394 >  ConfigGeneral.whowas_history_length = $3;
2395   };
2396  
2397 < general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2537 < {
2538 <  if (conf_parser_ctx.pass == 2)
2539 <    ConfigGeneral.glines = yylval.number;
2540 < };
2541 <
2542 < general_gline_duration: GLINE_DURATION '=' timespec ';'
2397 > general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2398   {
2399 <  if (conf_parser_ctx.pass == 2)
2545 <    ConfigGeneral.gline_time = $3;
2399 >  ConfigGeneral.cycle_on_host_change = yylval.number;
2400   };
2401  
2402 < general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2402 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2403   {
2404 <  if (conf_parser_ctx.pass == 2)
2551 <    ConfigGeneral.gline_request_time = $3;
2404 >  ConfigGeneral.dline_min_cidr = $3;
2405   };
2406  
2407 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2407 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2408   {
2409 <  ConfigGeneral.gline_min_cidr = $3;
2409 >  ConfigGeneral.dline_min_cidr6 = $3;
2410   };
2411  
2412 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2412 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2413   {
2414 <  ConfigGeneral.gline_min_cidr6 = $3;
2414 >  ConfigGeneral.kline_min_cidr = $3;
2415   };
2416  
2417 < general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2417 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2418   {
2419 <  ConfigGeneral.tkline_expire_notices = yylval.number;
2419 >  ConfigGeneral.kline_min_cidr6 = $3;
2420   };
2421  
2422   general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
# Line 2571 | Line 2424 | general_kill_chase_time_limit: KILL_CHAS
2424    ConfigGeneral.kill_chase_time_limit = $3;
2425   };
2426  
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
2427   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2428   {
2429    ConfigGeneral.failed_oper_notice = yylval.number;
# Line 2618 | Line 2461 | general_ts_warn_delta: TS_WARN_DELTA '='
2461  
2462   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2463   {
2464 <  if (conf_parser_ctx.pass == 2)
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 <  }
2464 >  ConfigGeneral.ts_max_delta = $3;
2465   };
2466  
2467   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
# Line 2648 | Line 2479 | general_stats_e_disabled: STATS_E_DISABL
2479    ConfigGeneral.stats_e_disabled = yylval.number;
2480   };
2481  
2482 + general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2483 + {
2484 +  ConfigGeneral.stats_m_oper_only = yylval.number;
2485 + };
2486 +
2487   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2488   {
2489    ConfigGeneral.stats_o_oper_only = yylval.number;
# Line 2709 | Line 2545 | general_no_oper_flood: NO_OPER_FLOOD '='
2545    ConfigGeneral.no_oper_flood = yylval.number;
2546   };
2547  
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
2548   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2549   {
2550    ConfigGeneral.dots_in_ident = $3;
# Line 2729 | Line 2555 | general_max_targets: MAX_TARGETS '=' NUM
2555    ConfigGeneral.max_targets = $3;
2556   };
2557  
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
2558   general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2559   {
2560    ConfigGeneral.ping_cookie = yylval.number;
# Line 2761 | Line 2578 | general_throttle_time: THROTTLE_TIME '='
2578   general_oper_umodes: OPER_UMODES
2579   {
2580    ConfigGeneral.oper_umodes = 0;
2581 < } '='  umode_oitems ';' ;
2581 > } '=' umode_oitems ';' ;
2582  
2583   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2584   umode_oitem:     T_BOTS
# Line 2830 | Line 2647 | umode_oitem:     T_BOTS
2647   } | T_FARCONNECT
2648   {
2649    ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2650 + } | EXPIRATION
2651 + {
2652 +  ConfigGeneral.oper_umodes |= UMODE_EXPIRATION;
2653   };
2654  
2655   general_oper_only_umodes: OPER_ONLY_UMODES
2656   {
2657    ConfigGeneral.oper_only_umodes = 0;
2658 < } '='  umode_items ';' ;
2658 > } '=' umode_items ';' ;
2659  
2660   umode_items:  umode_items ',' umode_item | umode_item;
2661   umode_item:   T_BOTS
# Line 2898 | Line 2718 | umode_item:   T_BOTS
2718   } | T_FARCONNECT
2719   {
2720    ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2721 + } | EXPIRATION
2722 + {
2723 +  ConfigGeneral.oper_only_umodes |= UMODE_EXPIRATION;
2724   };
2725  
2726   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
# Line 2915 | Line 2738 | general_default_floodcount: DEFAULT_FLOO
2738    ConfigGeneral.default_floodcount = $3;
2739   };
2740  
2741 + general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2742 + {
2743 +  ConfigGeneral.default_floodtime = $3;
2744 + };
2745 +
2746  
2747   /***************************************************************************
2748 < *  section channel
2748 > * channel {} section
2749   ***************************************************************************/
2750 < channel_entry: CHANNEL
2923 <  '{' channel_items '}' ';';
2750 > channel_entry: CHANNEL '{' channel_items '}' ';';
2751  
2752   channel_items:      channel_items channel_item | channel_item;
2753   channel_item:       channel_max_bans |
2754 +                    channel_max_bans_large |
2755                      channel_invite_client_count |
2756                      channel_invite_client_time |
2757 +                    channel_invite_delay_channel |
2758 +                    channel_invite_expire_time |
2759                      channel_knock_client_count |
2760                      channel_knock_client_time |
2761                      channel_knock_delay_channel |
2762                      channel_max_channels |
2763 <                    channel_default_split_user_count |
2764 <                    channel_default_split_server_count |
2765 <                    channel_no_create_on_split |
2936 <                    channel_no_join_on_split |
2937 <                    channel_jflood_count |
2938 <                    channel_jflood_time |
2763 >                    channel_max_invites |
2764 >                    channel_default_join_flood_count |
2765 >                    channel_default_join_flood_time |
2766                      channel_disable_fake_channels |
2767                      error;
2768  
# Line 2954 | Line 2781 | channel_invite_client_time: INVITE_CLIEN
2781    ConfigChannel.invite_client_time = $3;
2782   };
2783  
2784 + channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2785 + {
2786 +  ConfigChannel.invite_delay_channel = $3;
2787 + };
2788 +
2789 + channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2790 + {
2791 +  ConfigChannel.invite_expire_time = $3;
2792 + };
2793 +
2794   channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2795   {
2796    ConfigChannel.knock_client_count = $3;
# Line 2974 | Line 2811 | channel_max_channels: MAX_CHANNELS '=' N
2811    ConfigChannel.max_channels = $3;
2812   };
2813  
2814 < channel_max_bans: MAX_BANS '=' NUMBER ';'
2814 > channel_max_invites: MAX_INVITES '=' NUMBER ';'
2815   {
2816 <  ConfigChannel.max_bans = $3;
2816 >  ConfigChannel.max_invites = $3;
2817   };
2818  
2819 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2983 < {
2984 <  ConfigChannel.default_split_user_count = $3;
2985 < };
2986 <
2987 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2819 > channel_max_bans: MAX_BANS '=' NUMBER ';'
2820   {
2821 <  ConfigChannel.default_split_server_count = $3;
2821 >  ConfigChannel.max_bans = $3;
2822   };
2823  
2824 < channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
2824 > channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2825   {
2826 <  ConfigChannel.no_create_on_split = yylval.number;
2826 >  ConfigChannel.max_bans_large = $3;
2827   };
2828  
2829 < channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2829 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2830   {
2831 <  ConfigChannel.no_join_on_split = yylval.number;
2831 >  ConfigChannel.default_join_flood_count = yylval.number;
2832   };
2833  
2834 < channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2834 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2835   {
2836 <  GlobalSetOptions.joinfloodcount = yylval.number;
2836 >  ConfigChannel.default_join_flood_time = $3;
2837   };
2838  
3007 channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
3008 {
3009  GlobalSetOptions.joinfloodtime = $3;
3010 };
2839  
2840   /***************************************************************************
2841 < *  section serverhide
2841 > * serverhide {} section
2842   ***************************************************************************/
2843 < serverhide_entry: SERVERHIDE
3016 <  '{' serverhide_items '}' ';';
2843 > serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2844  
2845   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2846   serverhide_item:    serverhide_flatten_links |
2847 +                    serverhide_flatten_links_delay |
2848 +                    serverhide_flatten_links_file |
2849                      serverhide_disable_remote_commands |
2850                      serverhide_hide_servers |
2851                      serverhide_hide_services |
3023                    serverhide_links_delay |
2852                      serverhide_hidden |
2853                      serverhide_hidden_name |
2854                      serverhide_hide_server_ips |
# Line 3032 | Line 2860 | serverhide_flatten_links: FLATTEN_LINKS
2860      ConfigServerHide.flatten_links = yylval.number;
2861   };
2862  
2863 + serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2864 + {
2865 +  if (conf_parser_ctx.pass == 2)
2866 +  {
2867 +    if ($3 > 0)
2868 +    {
2869 +      event_write_links_file.when = $3;
2870 +      event_add(&event_write_links_file, NULL);
2871 +    }
2872 +    else
2873 +     event_delete(&event_write_links_file);
2874 +
2875 +    ConfigServerHide.flatten_links_delay = $3;
2876 +  }
2877 + };
2878 +
2879 + serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2880 + {
2881 +  if (conf_parser_ctx.pass == 2)
2882 +  {
2883 +    xfree(ConfigServerHide.flatten_links_file);
2884 +    ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2885 +  }
2886 + };
2887 +
2888   serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2889   {
2890    if (conf_parser_ctx.pass == 2)
# Line 3054 | Line 2907 | serverhide_hidden_name: HIDDEN_NAME '='
2907   {
2908    if (conf_parser_ctx.pass == 2)
2909    {
2910 <    MyFree(ConfigServerHide.hidden_name);
2910 >    xfree(ConfigServerHide.hidden_name);
2911      ConfigServerHide.hidden_name = xstrdup(yylval.string);
2912    }
2913   };
2914  
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
2915   serverhide_hidden: HIDDEN '=' TBOOL ';'
2916   {
2917    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 8963 by michael, Sat May 11 21:06:49 2019 UTC

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

Diff Legend

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