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 1904 by michael, Sat Apr 27 21:16:22 2013 UTC vs.
Revision 3441 by michael, Thu May 1 18:30:41 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  conf_parser.y: Parses the ircd configuration file.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2005 by the past and present ircd coders, and others.
4 > *  Copyright (c) 2000-2014 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 18 | Line 17
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   *  USA
21 *
22 *  $Id$
20   */
21  
22 + /*! \file conf_parser.y
23 + * \brief Parses the ircd configuration file.
24 + * \version $Id$
25 + */
26 +
27 +
28   %{
29  
30   #define YY_NO_UNPUT
# Line 40 | Line 43
43   #include "irc_string.h"
44   #include "memory.h"
45   #include "modules.h"
46 < #include "s_serv.h"
46 > #include "server.h"
47   #include "hostmask.h"
48   #include "send.h"
49   #include "listener.h"
50   #include "resv.h"
51   #include "numeric.h"
52 < #include "s_user.h"
52 > #include "user.h"
53 > #include "motd.h"
54  
55   #ifdef HAVE_LIBCRYPTO
56   #include <openssl/rsa.h>
# Line 61 | Line 65 | int yylex(void);
65  
66   static struct
67   {
68 <  struct {
68 >  struct
69 >  {
70      dlink_list list;
71    } mask,
72      leaf,
73      hub;
74  
75 <  struct {
75 >  struct
76 >  {
77      char buf[IRCD_BUFSIZE];
78    } name,
79      user,
# Line 76 | Line 82 | static struct
82      bind,
83      file,
84      ciph,
85 +    cert,
86      rpass,
87      spass,
88      class;
89  
90 <  struct {
90 >  struct
91 >  {
92      unsigned int value;
93    } flags,
94      modes,
# Line 150 | Line 158 | reset_block_state(void)
158   %token  CALLER_ID_WAIT
159   %token  CAN_FLOOD
160   %token  CHANNEL
161 < %token  CIDR_BITLEN_IPV4
162 < %token  CIDR_BITLEN_IPV6
161 > %token  CIDR_BITLEN_IPV4
162 > %token  CIDR_BITLEN_IPV6
163   %token  CLASS
164   %token  CONNECT
165   %token  CONNECTFREQ
166 + %token  CYCLE_ON_HOST_CHANGE
167   %token  DEFAULT_FLOODCOUNT
168   %token  DEFAULT_SPLIT_SERVER_COUNT
169   %token  DEFAULT_SPLIT_USER_COUNT
# Line 171 | Line 180 | reset_block_state(void)
180   %token  EXCEED_LIMIT
181   %token  EXEMPT
182   %token  FAILED_OPER_NOTICE
174 %token  IRCD_FLAGS
183   %token  FLATTEN_LINKS
184   %token  GECOS
185   %token  GENERAL
# Line 179 | Line 187 | reset_block_state(void)
187   %token  GLINE_DURATION
188   %token  GLINE_ENABLE
189   %token  GLINE_EXEMPT
182 %token  GLINE_REQUEST_DURATION
190   %token  GLINE_MIN_CIDR
191   %token  GLINE_MIN_CIDR6
192 + %token  GLINE_REQUEST_DURATION
193   %token  GLOBAL_KILL
186 %token  IRCD_AUTH
187 %token  NEED_IDENT
194   %token  HAVENT_READ_CONF
195   %token  HIDDEN
196 < %token  HIDDEN_NAME
196 > %token  HIDDEN_NAME
197 > %token  HIDE_IDLE_FROM_OPERS
198   %token  HIDE_SERVER_IPS
199   %token  HIDE_SERVERS
200   %token  HIDE_SERVICES
201 < %token  HIDE_SPOOF_IPS
201 > %token  HIDE_SPOOF_IPS
202   %token  HOST
203   %token  HUB
204   %token  HUB_MASK
205   %token  IGNORE_BOGUS_TS
206   %token  INVISIBLE_ON_CONNECT
207   %token  IP
208 + %token  IRCD_AUTH
209 + %token  IRCD_FLAGS
210 + %token  IRCD_SID
211 + %token  JOIN_FLOOD_COUNT
212 + %token  JOIN_FLOOD_TIME
213   %token  KILL
214 < %token  KILL_CHASE_TIME_LIMIT
214 > %token  KILL_CHASE_TIME_LIMIT
215   %token  KLINE
216   %token  KLINE_EXEMPT
217   %token  KNOCK_DELAY
# Line 207 | Line 219 | reset_block_state(void)
219   %token  LEAF_MASK
220   %token  LINKS_DELAY
221   %token  LISTEN
210 %token  T_LOG
222   %token  MASK
223   %token  MAX_ACCEPT
224   %token  MAX_BANS
# Line 215 | Line 226 | reset_block_state(void)
226   %token  MAX_CHANS_PER_USER
227   %token  MAX_GLOBAL
228   %token  MAX_IDENT
229 + %token  MAX_IDLE
230   %token  MAX_LOCAL
231   %token  MAX_NICK_CHANGES
232   %token  MAX_NICK_LENGTH
# Line 223 | Line 235 | reset_block_state(void)
235   %token  MAX_TARGETS
236   %token  MAX_TOPIC_LENGTH
237   %token  MAX_WATCH
238 + %token  MIN_IDLE
239   %token  MIN_NONWILDCARD
240   %token  MIN_NONWILDCARD_SIMPLE
228 %token  MIN_IDLE
229 %token  MAX_IDLE
230 %token  RANDOM_IDLE
231 %token  HIDE_IDLE_FROM_OPERS
241   %token  MODULE
242   %token  MODULES
243 + %token  MOTD
244   %token  NAME
245 + %token  NEED_IDENT
246   %token  NEED_PASSWORD
247   %token  NETWORK_DESC
248   %token  NETWORK_NAME
# Line 243 | Line 254 | reset_block_state(void)
254   %token  NUMBER
255   %token  NUMBER_PER_CIDR
256   %token  NUMBER_PER_IP
246 %token  OPERATOR
247 %token  OPERS_BYPASS_CALLERID
257   %token  OPER_ONLY_UMODES
258   %token  OPER_PASS_RESV
250 %token  OPER_SPY_T
259   %token  OPER_UMODES
260 < %token  JOIN_FLOOD_COUNT
261 < %token  JOIN_FLOOD_TIME
260 > %token  OPERATOR
261 > %token  OPERS_BYPASS_CALLERID
262   %token  PACE_WAIT
263   %token  PACE_WAIT_SIMPLE
264   %token  PASSWORD
# Line 259 | Line 267 | reset_block_state(void)
267   %token  PING_TIME
268   %token  PORT
269   %token  QSTRING
270 < %token  QUIET_ON_BAN
270 > %token  RANDOM_IDLE
271   %token  REASON
272   %token  REDIRPORT
273   %token  REDIRSERV
266 %token  REGEX_T
274   %token  REHASH
275   %token  REMOTE
276   %token  REMOTEBAN
270 %token  RSA_PRIVATE_KEY_FILE
271 %token  RSA_PUBLIC_KEY_FILE
272 %token  SSL_CERTIFICATE_FILE
273 %token  SSL_DH_PARAM_FILE
274 %token  T_SSL_CLIENT_METHOD
275 %token  T_SSL_SERVER_METHOD
276 %token  T_SSLV3
277 %token  T_TLSV1
277   %token  RESV
278   %token  RESV_EXEMPT
279 + %token  RSA_PRIVATE_KEY_FILE
280 + %token  RSA_PUBLIC_KEY_FILE
281   %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
281 %token  SENDQ
282   %token  SEND_PASSWORD
283 + %token  SENDQ
284   %token  SERVERHIDE
285   %token  SERVERINFO
285 %token  IRCD_SID
286 %token  TKLINE_EXPIRE_NOTICES
287 %token  T_SHARED
288 %token  T_CLUSTER
289 %token  TYPE
286   %token  SHORT_MOTD
287   %token  SPOOF
288   %token  SPOOF_NOTICE
289 + %token  SQUIT
290 + %token  SSL_CERTIFICATE_FILE
291 + %token  SSL_CERTIFICATE_FINGERPRINT
292 + %token  SSL_CONNECTION_REQUIRED
293 + %token  SSL_DH_PARAM_FILE
294   %token  STATS_E_DISABLED
295   %token  STATS_I_OPER_ONLY
296   %token  STATS_K_OPER_ONLY
297   %token  STATS_O_OPER_ONLY
298   %token  STATS_P_OPER_ONLY
299 < %token  TBOOL
299 < %token  TMASKED
300 < %token  TS_MAX_DELTA
301 < %token  TS_WARN_DELTA
302 < %token  TWODOTS
299 > %token  STATS_U_OPER_ONLY
300   %token  T_ALL
301   %token  T_BOTS
305 %token  T_SOFTCALLERID
302   %token  T_CALLERID
303   %token  T_CCONN
304 < %token  T_CCONN_FULL
309 < %token  T_SSL_CIPHER_LIST
304 > %token  T_CLUSTER
305   %token  T_DEAF
306   %token  T_DEBUG
307   %token  T_DLINE
308   %token  T_EXTERNAL
309 + %token  T_FARCONNECT
310 + %token  T_FILE
311   %token  T_FULL
312 + %token  T_GLOBOPS
313   %token  T_INVISIBLE
314   %token  T_IPV4
315   %token  T_IPV6
316   %token  T_LOCOPS
317 + %token  T_LOG
318   %token  T_MAX_CLIENTS
319   %token  T_NCHANGE
320   %token  T_NONONREG
321   %token  T_OPERWALL
322   %token  T_RECVQ
323   %token  T_REJ
324 + %token  T_RESTART
325   %token  T_SERVER
326 + %token  T_SERVICE
327 + %token  T_SERVICES_NAME
328   %token  T_SERVNOTICE
329   %token  T_SET
330 + %token  T_SHARED
331 + %token  T_SIZE
332   %token  T_SKILL
333 + %token  T_SOFTCALLERID
334   %token  T_SPY
335   %token  T_SSL
336 + %token  T_SSL_CIPHER_LIST
337 + %token  T_SSL_CLIENT_METHOD
338 + %token  T_SSL_SERVER_METHOD
339 + %token  T_SSLV3
340 + %token  T_TLSV1
341   %token  T_UMODES
342   %token  T_UNAUTH
343   %token  T_UNDLINE
344   %token  T_UNLIMITED
345   %token  T_UNRESV
346   %token  T_UNXLINE
337 %token  T_GLOBOPS
347   %token  T_WALLOP
348 + %token  T_WALLOPS
349   %token  T_WEBIRC
350 < %token  T_RESTART
341 < %token  T_SERVICE
342 < %token  T_SERVICES_NAME
350 > %token  TBOOL
351   %token  THROTTLE_TIME
352 + %token  TKLINE_EXPIRE_NOTICES
353 + %token  TMASKED
354   %token  TRUE_NO_OPER_FLOOD
355 + %token  TS_MAX_DELTA
356 + %token  TS_WARN_DELTA
357 + %token  TWODOTS
358 + %token  TYPE
359   %token  UNKLINE
346 %token  USER
360   %token  USE_EGD
361   %token  USE_LOGGING
362 + %token  USER
363   %token  VHOST
364   %token  VHOST6
351 %token  XLINE
365   %token  WARN_NO_NLINE
366 < %token  T_SIZE
354 < %token  T_FILE
366 > %token  XLINE
367  
368 < %type <string> QSTRING
369 < %type <number> NUMBER
370 < %type <number> timespec
371 < %type <number> timespec_
372 < %type <number> sizespec
373 < %type <number> sizespec_
368 > %type  <string> QSTRING
369 > %type  <number> NUMBER
370 > %type  <number> timespec
371 > %type  <number> timespec_
372 > %type  <number> sizespec
373 > %type  <number> sizespec_
374  
375   %%
376 < conf:  
376 > conf:
377          | conf conf_item
378          ;
379  
380   conf_item:        admin_entry
381                  | logging_entry
382                  | oper_entry
383 <                | channel_entry
384 <                | class_entry
383 >                | channel_entry
384 >                | class_entry
385                  | listen_entry
386                  | auth_entry
387                  | serverinfo_entry
388 <                | serverhide_entry
388 >                | serverhide_entry
389                  | resv_entry
390                  | service_entry
391                  | shared_entry
392 <                | cluster_entry
392 >                | cluster_entry
393                  | connect_entry
394                  | kill_entry
395                  | deny_entry
396 <                | exempt_entry
397 <                | general_entry
396 >                | exempt_entry
397 >                | general_entry
398                  | gecos_entry
399                  | modules_entry
400 +                | motd_entry
401                  | error ';'
402                  | error '}'
403          ;
404  
405  
406   timespec_: { $$ = 0; } | timespec;
407 < timespec:       NUMBER timespec_
408 <                {
409 <                        $$ = $1 + $2;
410 <                }
411 <                | NUMBER SECONDS timespec_
412 <                {
413 <                        $$ = $1 + $3;
414 <                }
415 <                | NUMBER MINUTES timespec_
416 <                {
417 <                        $$ = $1 * 60 + $3;
418 <                }
419 <                | NUMBER HOURS timespec_
420 <                {
421 <                        $$ = $1 * 60 * 60 + $3;
422 <                }
410 <                | NUMBER DAYS timespec_
411 <                {
412 <                        $$ = $1 * 60 * 60 * 24 + $3;
413 <                }
414 <                | NUMBER WEEKS timespec_
415 <                {
416 <                        $$ = $1 * 60 * 60 * 24 * 7 + $3;
417 <                }
418 <                | NUMBER MONTHS timespec_
419 <                {
420 <                        $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3;
421 <                }
422 <                | NUMBER YEARS timespec_
423 <                {
424 <                        $$ = $1 * 60 * 60 * 24 * 365 + $3;
425 <                }
426 <                ;
427 <
428 < sizespec_:      { $$ = 0; } | sizespec;
429 < sizespec:       NUMBER sizespec_ { $$ = $1 + $2; }
430 <                | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
431 <                | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
432 <                | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
433 <                ;
407 > timespec:  NUMBER timespec_         { $$ = $1 + $2; } |
408 >           NUMBER SECONDS timespec_ { $$ = $1 + $3; } |
409 >           NUMBER MINUTES timespec_ { $$ = $1 * 60 + $3; } |
410 >           NUMBER HOURS timespec_   { $$ = $1 * 60 * 60 + $3; } |
411 >           NUMBER DAYS timespec_    { $$ = $1 * 60 * 60 * 24 + $3; } |
412 >           NUMBER WEEKS timespec_   { $$ = $1 * 60 * 60 * 24 * 7 + $3; } |
413 >           NUMBER MONTHS timespec_  { $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; } |
414 >           NUMBER YEARS timespec_   { $$ = $1 * 60 * 60 * 24 * 365 + $3; }
415 >           ;
416 >
417 > sizespec_:  { $$ = 0; } | sizespec;
418 > sizespec:   NUMBER sizespec_ { $$ = $1 + $2; } |
419 >            NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
420 >            NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
421 >            NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
422 >            ;
423  
424  
425   /***************************************************************************
# Line 458 | Line 447 | modules_path: PATH '=' QSTRING ';'
447   serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
448  
449   serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
450 < serverinfo_item:        serverinfo_name | serverinfo_vhost |
451 <                        serverinfo_hub | serverinfo_description |
452 <                        serverinfo_network_name | serverinfo_network_desc |
453 <                        serverinfo_max_clients | serverinfo_max_nick_length |
454 <                        serverinfo_max_topic_length | serverinfo_ssl_dh_param_file |
455 <                        serverinfo_rsa_private_key_file | serverinfo_vhost6 |
456 <                        serverinfo_sid | serverinfo_ssl_certificate_file |
457 <                        serverinfo_ssl_client_method | serverinfo_ssl_server_method |
450 > serverinfo_item:        serverinfo_name |
451 >                        serverinfo_vhost |
452 >                        serverinfo_hub |
453 >                        serverinfo_description |
454 >                        serverinfo_network_name |
455 >                        serverinfo_network_desc |
456 >                        serverinfo_max_clients |
457 >                        serverinfo_max_nick_length |
458 >                        serverinfo_max_topic_length |
459 >                        serverinfo_ssl_dh_param_file |
460 >                        serverinfo_rsa_private_key_file |
461 >                        serverinfo_vhost6 |
462 >                        serverinfo_sid |
463 >                        serverinfo_ssl_certificate_file |
464 >                        serverinfo_ssl_client_method |
465 >                        serverinfo_ssl_server_method |
466                          serverinfo_ssl_cipher_list |
467 <                        error ';' ;
467 >                        error ';' ;
468  
469  
470   serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
# Line 506 | Line 503 | server_method_type_item: T_SSLV3
503   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
504   {
505   #ifdef HAVE_LIBCRYPTO
506 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
506 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
507    {
508      if (!ServerInfo.rsa_private_key_file)
509      {
# Line 548 | Line 545 | serverinfo_ssl_certificate_file: SSL_CER
545   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
546   {
547   #ifdef HAVE_LIBCRYPTO
548 <  if (conf_parser_ctx.pass == 1)
552 <  {
553 <    BIO *file;
548 >  BIO *file = NULL;
549  
550 <    if (ServerInfo.rsa_private_key)
551 <    {
557 <      RSA_free(ServerInfo.rsa_private_key);
558 <      ServerInfo.rsa_private_key = NULL;
559 <    }
550 >  if (conf_parser_ctx.pass != 1)
551 >    break;
552  
553 <    if (ServerInfo.rsa_private_key_file)
554 <    {
555 <      MyFree(ServerInfo.rsa_private_key_file);
556 <      ServerInfo.rsa_private_key_file = NULL;
557 <    }
553 >  if (ServerInfo.rsa_private_key)
554 >  {
555 >    RSA_free(ServerInfo.rsa_private_key);
556 >    ServerInfo.rsa_private_key = NULL;
557 >  }
558  
559 <    ServerInfo.rsa_private_key_file = xstrdup(yylval.string);
559 >  if (ServerInfo.rsa_private_key_file)
560 >  {
561 >    MyFree(ServerInfo.rsa_private_key_file);
562 >    ServerInfo.rsa_private_key_file = NULL;
563 >  }
564  
565 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
570 <    {
571 <      conf_error_report("File open failed, ignoring");
572 <      break;
573 <    }
565 >  ServerInfo.rsa_private_key_file = xstrdup(yylval.string);
566  
567 <    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
567 >  if ((file = BIO_new_file(yylval.string, "r")) == NULL)
568 >  {
569 >    conf_error_report("File open failed, ignoring");
570 >    break;
571 >  }
572  
573 <    BIO_set_close(file, BIO_CLOSE);
578 <    BIO_free(file);
573 >  ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
574  
575 <    if (ServerInfo.rsa_private_key == NULL)
576 <    {
582 <      conf_error_report("Couldn't extract key, ignoring");
583 <      break;
584 <    }
575 >  BIO_set_close(file, BIO_CLOSE);
576 >  BIO_free(file);
577  
578 <    if (!RSA_check_key(ServerInfo.rsa_private_key))
579 <    {
580 <      RSA_free(ServerInfo.rsa_private_key);
581 <      ServerInfo.rsa_private_key = NULL;
578 >  if (ServerInfo.rsa_private_key == NULL)
579 >  {
580 >    conf_error_report("Couldn't extract key, ignoring");
581 >    break;
582 >  }
583  
584 <      conf_error_report("Invalid key, ignoring");
585 <      break;
586 <    }
584 >  if (!RSA_check_key(ServerInfo.rsa_private_key))
585 >  {
586 >    RSA_free(ServerInfo.rsa_private_key);
587 >    ServerInfo.rsa_private_key = NULL;
588  
589 <    /* require 2048 bit (256 byte) key */
590 <    if (RSA_size(ServerInfo.rsa_private_key) != 256)
591 <    {
598 <      RSA_free(ServerInfo.rsa_private_key);
599 <      ServerInfo.rsa_private_key = NULL;
589 >    conf_error_report("Invalid key, ignoring");
590 >    break;
591 >  }
592  
593 <      conf_error_report("Not a 2048 bit key, ignoring");
594 <    }
593 >  if (RSA_size(ServerInfo.rsa_private_key) < 128)
594 >  {
595 >    RSA_free(ServerInfo.rsa_private_key);
596 >    ServerInfo.rsa_private_key = NULL;
597 >
598 >    conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size");
599    }
600   #endif
601   };
# Line 640 | Line 636 | serverinfo_ssl_cipher_list: T_SSL_CIPHER
636   #endif
637   };
638  
639 < serverinfo_name: NAME '=' QSTRING ';'
639 > serverinfo_name: NAME '=' QSTRING ';'
640   {
641    /* this isn't rehashable */
642    if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
# Line 655 | Line 651 | serverinfo_name: NAME '=' QSTRING ';'
651    }
652   };
653  
654 < serverinfo_sid: IRCD_SID '=' QSTRING ';'
654 > serverinfo_sid: IRCD_SID '=' QSTRING ';'
655   {
656    /* this isn't rehashable */
657    if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
# Line 695 | Line 691 | serverinfo_network_name: NETWORK_NAME '=
691  
692   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
693   {
694 <  if (conf_parser_ctx.pass == 2)
695 <  {
696 <    MyFree(ServerInfo.network_desc);
697 <    ServerInfo.network_desc = xstrdup(yylval.string);
698 <  }
694 >  if (conf_parser_ctx.pass != 2)
695 >    break;
696 >
697 >  MyFree(ServerInfo.network_desc);
698 >  ServerInfo.network_desc = xstrdup(yylval.string);
699   };
700  
701   serverinfo_vhost: VHOST '=' QSTRING ';'
# Line 829 | Line 825 | serverinfo_max_topic_length: MAX_TOPIC_L
825      ServerInfo.max_topic_length = $3;
826   };
827  
828 < serverinfo_hub: HUB '=' TBOOL ';'
828 > serverinfo_hub: HUB '=' TBOOL ';'
829   {
830    if (conf_parser_ctx.pass == 2)
831      ServerInfo.hub = yylval.number;
# Line 841 | Line 837 | serverinfo_hub: HUB '=' TBOOL ';'
837   admin_entry: ADMIN  '{' admin_items '}' ';' ;
838  
839   admin_items: admin_items admin_item | admin_item;
840 < admin_item:  admin_name | admin_description |
841 <             admin_email | error ';' ;
840 > admin_item:  admin_name |
841 >             admin_description |
842 >             admin_email |
843 >             error ';' ;
844  
845 < admin_name: NAME '=' QSTRING ';'
845 > admin_name: NAME '=' QSTRING ';'
846   {
847 <  if (conf_parser_ctx.pass == 2)
848 <  {
849 <    MyFree(AdminInfo.name);
850 <    AdminInfo.name = xstrdup(yylval.string);
851 <  }
847 >  if (conf_parser_ctx.pass != 2)
848 >    break;
849 >
850 >  MyFree(AdminInfo.name);
851 >  AdminInfo.name = xstrdup(yylval.string);
852   };
853  
854   admin_email: EMAIL '=' QSTRING ';'
855   {
856 <  if (conf_parser_ctx.pass == 2)
857 <  {
858 <    MyFree(AdminInfo.email);
859 <    AdminInfo.email = xstrdup(yylval.string);
860 <  }
856 >  if (conf_parser_ctx.pass != 2)
857 >    break;
858 >
859 >  MyFree(AdminInfo.email);
860 >  AdminInfo.email = xstrdup(yylval.string);
861   };
862  
863   admin_description: DESCRIPTION '=' QSTRING ';'
864   {
865 +  if (conf_parser_ctx.pass != 2)
866 +    break;
867 +
868 +  MyFree(AdminInfo.description);
869 +  AdminInfo.description = xstrdup(yylval.string);
870 + };
871 +
872 + /***************************************************************************
873 + * motd section
874 + ***************************************************************************/
875 + motd_entry: MOTD
876 + {
877    if (conf_parser_ctx.pass == 2)
878 <  {
879 <    MyFree(AdminInfo.description);
880 <    AdminInfo.description = xstrdup(yylval.string);
881 <  }
878 >    reset_block_state();
879 > } '{' motd_items '}' ';'
880 > {
881 >  dlink_node *ptr = NULL;
882 >
883 >  if (conf_parser_ctx.pass != 2)
884 >    break;
885 >
886 >  if (!block_state.file.buf[0])
887 >    break;
888 >
889 >  DLINK_FOREACH(ptr, block_state.mask.list.head)
890 >    motd_add(ptr->data, block_state.file.buf);
891 > };
892 >
893 > motd_items: motd_items motd_item | motd_item;
894 > motd_item:  motd_mask | motd_file | error ';' ;
895 >
896 > motd_mask: MASK '=' QSTRING ';'
897 > {
898 >  if (conf_parser_ctx.pass == 2)
899 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
900 > };
901 >
902 > motd_file: T_FILE '=' QSTRING ';'
903 > {
904 >  if (conf_parser_ctx.pass == 2)
905 >    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
906   };
907  
908   /***************************************************************************
# Line 877 | Line 911 | admin_description: DESCRIPTION '=' QSTRI
911   logging_entry:          T_LOG  '{' logging_items '}' ';' ;
912   logging_items:          logging_items logging_item | logging_item ;
913  
914 < logging_item:           logging_use_logging | logging_file_entry |
915 <                        error ';' ;
914 > logging_item:           logging_use_logging | logging_file_entry |
915 >                        error ';' ;
916  
917   logging_use_logging: USE_LOGGING '=' TBOOL ';'
918   {
# Line 941 | Line 975 | logging_file_type_item:  USER
975   {
976    if (conf_parser_ctx.pass == 2)
977      block_state.type.value = LOG_TYPE_GLINE;
978 + } | XLINE
979 + {
980 +  if (conf_parser_ctx.pass == 2)
981 +    block_state.type.value = LOG_TYPE_XLINE;
982 + } | RESV
983 + {
984 +  if (conf_parser_ctx.pass == 2)
985 +    block_state.type.value = LOG_TYPE_RESV;
986   } | T_DLINE
987   {
988    if (conf_parser_ctx.pass == 2)
# Line 963 | Line 1005 | logging_file_type_item:  USER
1005   /***************************************************************************
1006   * section oper
1007   ***************************************************************************/
1008 < oper_entry: OPERATOR
1008 > oper_entry: OPERATOR
1009   {
1010    if (conf_parser_ctx.pass != 2)
1011      break;
# Line 980 | Line 1022 | oper_entry: OPERATOR
1022    if (!block_state.name.buf[0])
1023      break;
1024   #ifdef HAVE_LIBCRYPTO
1025 <  if (!(block_state.file.buf[0] ||
1026 <        block_state.rpass.buf[0]))
1025 >  if (!block_state.file.buf[0] &&
1026 >      !block_state.rpass.buf[0])
1027      break;
1028   #else
1029    if (!block_state.rpass.buf[0])
# Line 1002 | Line 1044 | oper_entry: OPERATOR
1044      nuh.hostsize = sizeof(block_state.host.buf);
1045      split_nuh(&nuh);
1046  
1047 <    conf        = conf_make(CONF_OPER);
1048 <    conf->name  = xstrdup(block_state.name.buf);
1049 <    conf->user  = xstrdup(block_state.user.buf);
1050 <    conf->host  = xstrdup(block_state.host.buf);
1047 >    conf         = conf_make(CONF_OPER);
1048 >    conf->name   = xstrdup(block_state.name.buf);
1049 >    conf->user   = xstrdup(block_state.user.buf);
1050 >    conf->host   = xstrdup(block_state.host.buf);
1051 >
1052 >    if (block_state.cert.buf[0])
1053 >      conf->certfp = xstrdup(block_state.cert.buf);
1054  
1055      if (block_state.rpass.buf[0])
1056        conf->passwd = xstrdup(block_state.rpass.buf);
# Line 1041 | Line 1086 | oper_entry: OPERATOR
1086   };
1087  
1088   oper_items:     oper_items oper_item | oper_item;
1089 < oper_item:      oper_name | oper_user | oper_password |
1090 <                oper_umodes | oper_class | oper_encrypted |
1091 <                oper_rsa_public_key_file | oper_flags | error ';' ;
1089 > oper_item:      oper_name |
1090 >                oper_user |
1091 >                oper_password |
1092 >                oper_umodes |
1093 >                oper_class |
1094 >                oper_encrypted |
1095 >                oper_rsa_public_key_file |
1096 >                oper_ssl_certificate_fingerprint |
1097 >                oper_ssl_connection_required |
1098 >                oper_flags |
1099 >                error ';' ;
1100  
1101   oper_name: NAME '=' QSTRING ';'
1102   {
# Line 1065 | Line 1118 | oper_password: PASSWORD '=' QSTRING ';'
1118  
1119   oper_encrypted: ENCRYPTED '=' TBOOL ';'
1120   {
1121 <  if (conf_parser_ctx.pass == 2)
1122 <  {
1123 <    if (yylval.number)
1124 <      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1125 <    else
1126 <      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1127 <  }
1121 >  if (conf_parser_ctx.pass != 2)
1122 >    break;
1123 >
1124 >  if (yylval.number)
1125 >    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1126 >  else
1127 >    block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1128   };
1129  
1130   oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
# Line 1080 | Line 1133 | oper_rsa_public_key_file: RSA_PUBLIC_KEY
1133      strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1134   };
1135  
1136 + oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1137 + {
1138 +  if (conf_parser_ctx.pass == 2)
1139 +    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1140 + };
1141 +
1142 + oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1143 + {
1144 +  if (conf_parser_ctx.pass != 2)
1145 +    break;
1146 +
1147 +  if (yylval.number)
1148 +    block_state.flags.value |= CONF_FLAGS_SSL;
1149 +  else
1150 +    block_state.flags.value &= ~CONF_FLAGS_SSL;
1151 + };
1152 +
1153   oper_class: CLASS '=' QSTRING ';'
1154   {
1155    if (conf_parser_ctx.pass == 2)
# Line 1101 | Line 1171 | oper_umodes_item:  T_BOTS
1171   {
1172    if (conf_parser_ctx.pass == 2)
1173      block_state.modes.value |= UMODE_CCONN;
1104 } | T_CCONN_FULL
1105 {
1106  if (conf_parser_ctx.pass == 2)
1107    block_state.modes.value |= UMODE_CCONN_FULL;
1174   } | T_DEAF
1175   {
1176    if (conf_parser_ctx.pass == 2)
# Line 1177 | Line 1243 | oper_umodes_item:  T_BOTS
1243   {
1244    if (conf_parser_ctx.pass == 2)
1245      block_state.modes.value |= UMODE_REGONLY;
1246 + } | T_FARCONNECT
1247 + {
1248 +  if (conf_parser_ctx.pass == 2)
1249 +    block_state.modes.value |= UMODE_FARCONNECT;
1250   };
1251  
1252   oper_flags: IRCD_FLAGS
# Line 1186 | Line 1256 | oper_flags: IRCD_FLAGS
1256   } '='  oper_flags_items ';';
1257  
1258   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1259 < oper_flags_item: GLOBAL_KILL
1259 > oper_flags_item: KILL ':' REMOTE
1260 > {
1261 >  if (conf_parser_ctx.pass == 2)
1262 >    block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1263 > } | KILL
1264 > {
1265 >  if (conf_parser_ctx.pass == 2)
1266 >    block_state.port.value |= OPER_FLAG_KILL;
1267 > } | CONNECT ':' REMOTE
1268 > {
1269 >  if (conf_parser_ctx.pass == 2)
1270 >    block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1271 > } | CONNECT
1272 > {
1273 >  if (conf_parser_ctx.pass == 2)
1274 >    block_state.port.value |= OPER_FLAG_CONNECT;
1275 > } | SQUIT ':' REMOTE
1276   {
1277    if (conf_parser_ctx.pass == 2)
1278 <    block_state.port.value |= OPER_FLAG_GLOBAL_KILL;
1279 < } | REMOTE
1278 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1279 > } | SQUIT
1280   {
1281    if (conf_parser_ctx.pass == 2)
1282 <    block_state.port.value |= OPER_FLAG_REMOTE;
1282 >    block_state.port.value |= OPER_FLAG_SQUIT;
1283   } | KLINE
1284   {
1285    if (conf_parser_ctx.pass == 2)
# Line 1213 | Line 1299 | oper_flags_item: GLOBAL_KILL
1299   } | XLINE
1300   {
1301    if (conf_parser_ctx.pass == 2)
1302 <    block_state.port.value |= OPER_FLAG_X;
1302 >    block_state.port.value |= OPER_FLAG_XLINE;
1303 > } | T_UNXLINE
1304 > {
1305 >  if (conf_parser_ctx.pass == 2)
1306 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1307   } | GLINE
1308   {
1309    if (conf_parser_ctx.pass == 2)
# Line 1242 | Line 1332 | oper_flags_item: GLOBAL_KILL
1332   {
1333    if (conf_parser_ctx.pass == 2)
1334      block_state.port.value |= OPER_FLAG_GLOBOPS;
1335 < } | OPER_SPY_T
1335 > } | T_WALLOPS
1336 > {
1337 >  if (conf_parser_ctx.pass == 2)
1338 >    block_state.port.value |= OPER_FLAG_WALLOPS;
1339 > } | T_LOCOPS
1340   {
1341    if (conf_parser_ctx.pass == 2)
1342 <    block_state.port.value |= OPER_FLAG_OPER_SPY;
1342 >    block_state.port.value |= OPER_FLAG_LOCOPS;
1343   } | REMOTEBAN
1344   {
1345    if (conf_parser_ctx.pass == 2)
# Line 1327 | Line 1421 | class_entry: CLASS
1421  
1422   class_items:    class_items class_item | class_item;
1423   class_item:     class_name |
1424 <                class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1424 >                class_cidr_bitlen_ipv4 |
1425 >                class_cidr_bitlen_ipv6 |
1426                  class_ping_time |
1427 <                class_number_per_cidr |
1427 >                class_number_per_cidr |
1428                  class_number_per_ip |
1429                  class_connectfreq |
1430                  class_max_number |
1431 <                class_max_global |
1432 <                class_max_local |
1433 <                class_max_ident |
1431 >                class_max_global |
1432 >                class_max_local |
1433 >                class_max_ident |
1434                  class_sendq | class_recvq |
1435                  class_min_idle |
1436                  class_max_idle |
1437                  class_flags |
1438 <                error ';' ;
1438 >                error ';' ;
1439  
1440 < class_name: NAME '=' QSTRING ';'
1440 > class_name: NAME '=' QSTRING ';'
1441   {
1442    if (conf_parser_ctx.pass == 1)
1443      strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
# Line 1503 | Line 1598 | port_item: NUMBER
1598   #endif
1599        {
1600          conf_error_report("SSL not available - port closed");
1601 <        break;
1601 >        break;
1602        }
1603      add_listener($1, block_state.addr.buf, block_state.flags.value);
1604    }
# Line 1511 | Line 1606 | port_item: NUMBER
1606   {
1607    if (conf_parser_ctx.pass == 2)
1608    {
1514    int i;
1515
1609      if (block_state.flags.value & LISTENER_SSL)
1610   #ifdef HAVE_LIBCRYPTO
1611        if (!ServerInfo.server_ctx)
1612   #endif
1613        {
1614          conf_error_report("SSL not available - port closed");
1615 <        break;
1615 >        break;
1616        }
1617  
1618 <    for (i = $1; i <= $3; ++i)
1618 >    for (int i = $1; i <= $3; ++i)
1619        add_listener(i, block_state.addr.buf, block_state.flags.value);
1620    }
1621   };
# Line 1568 | Line 1661 | auth_entry: IRCD_AUTH
1661      split_nuh(&nuh);
1662  
1663      conf        = conf_make(CONF_CLIENT);
1664 <    conf->user  = xstrdup(collapse(block_state.user.buf));
1665 <    conf->host  = xstrdup(collapse(block_state.host.buf));
1664 >    conf->user  = xstrdup(block_state.user.buf);
1665 >    conf->host  = xstrdup(block_state.host.buf);
1666  
1667      if (block_state.rpass.buf[0])
1668        conf->passwd = xstrdup(block_state.rpass.buf);
1669      if (block_state.name.buf[0])
1670 <      conf->passwd = xstrdup(block_state.name.buf);
1670 >      conf->name = xstrdup(block_state.name.buf);
1671  
1672      conf->flags = block_state.flags.value;
1673      conf->port  = block_state.port.value;
# Line 1582 | Line 1675 | auth_entry: IRCD_AUTH
1675      conf_add_class_to_conf(conf, block_state.class.buf);
1676      add_conf_by_address(CONF_CLIENT, conf);
1677    }
1678 < };
1678 > };
1679  
1680   auth_items:     auth_items auth_item | auth_item;
1681 < auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1682 <                auth_spoof | auth_redir_serv | auth_redir_port |
1683 <                auth_encrypted | error ';' ;
1681 > auth_item:      auth_user |
1682 >                auth_passwd |
1683 >                auth_class |
1684 >                auth_flags |
1685 >                auth_spoof |
1686 >                auth_redir_serv |
1687 >                auth_redir_port |
1688 >                auth_encrypted |
1689 >                error ';' ;
1690  
1691   auth_user: USER '=' QSTRING ';'
1692   {
# Line 1621 | Line 1720 | auth_encrypted: ENCRYPTED '=' TBOOL ';'
1720   auth_flags: IRCD_FLAGS
1721   {
1722    if (conf_parser_ctx.pass == 2)
1723 <    block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
1723 >    block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1724   } '='  auth_flags_items ';';
1725  
1726   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
# Line 1667 | Line 1766 | auth_flags_item: SPOOF_NOTICE
1766      block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1767   };
1768  
1769 < auth_spoof: SPOOF '=' QSTRING ';'
1769 > auth_spoof: SPOOF '=' QSTRING ';'
1770   {
1771    if (conf_parser_ctx.pass != 2)
1772      break;
1773  
1774 <  if (strlen(yylval.string) <= HOSTLEN && valid_hostname(yylval.string))
1774 >  if (valid_hostname(yylval.string))
1775    {
1776      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1777      block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
# Line 1718 | Line 1817 | resv_entry: RESV
1817    create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1818   };
1819  
1820 < resv_items:     resv_items resv_item | resv_item;
1821 < resv_item:      resv_mask | resv_reason | resv_exempt | error ';' ;
1820 > resv_items:     resv_items resv_item | resv_item;
1821 > resv_item:      resv_mask | resv_reason | resv_exempt | error ';' ;
1822  
1823   resv_mask: MASK '=' QSTRING ';'
1824   {
# Line 1750 | Line 1849 | service_item:      service_name | error;
1849  
1850   service_name: NAME '=' QSTRING ';'
1851   {
1852 <  if (conf_parser_ctx.pass == 2)
1852 >  if (conf_parser_ctx.pass != 2)
1853 >    break;
1854 >
1855 >  if (valid_servname(yylval.string))
1856    {
1857 <    if (valid_servname(yylval.string))
1858 <    {
1757 <      struct MaskItem *conf = conf_make(CONF_SERVICE);
1758 <      conf->name = xstrdup(yylval.string);
1759 <    }
1857 >    struct MaskItem *conf = conf_make(CONF_SERVICE);
1858 >    conf->name = xstrdup(yylval.string);
1859    }
1860   };
1861  
# Line 1785 | Line 1884 | shared_entry: T_SHARED
1884    conf->flags = block_state.flags.value;
1885    conf->name = xstrdup(block_state.name.buf);
1886    conf->user = xstrdup(block_state.user.buf);
1887 <  conf->user = xstrdup(block_state.host.buf);
1887 >  conf->host = xstrdup(block_state.host.buf);
1888   };
1889  
1890   shared_items: shared_items shared_item | shared_item;
# Line 1889 | Line 1988 | cluster_entry: T_CLUSTER
1988    conf->name = xstrdup(block_state.name.buf);
1989   };
1990  
1991 < cluster_items:  cluster_items cluster_item | cluster_item;
1992 < cluster_item:   cluster_name | cluster_type | error ';' ;
1991 > cluster_items:  cluster_items cluster_item | cluster_item;
1992 > cluster_item:   cluster_name | cluster_type | error ';' ;
1993  
1994   cluster_name: NAME '=' QSTRING ';'
1995   {
# Line 1904 | Line 2003 | cluster_type: TYPE
2003      block_state.flags.value = 0;
2004   } '=' cluster_types ';' ;
2005  
2006 < cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2006 > cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2007   cluster_type_item: KLINE
2008   {
2009    if (conf_parser_ctx.pass == 2)
# Line 1950 | Line 2049 | cluster_type_item: KLINE
2049   /***************************************************************************
2050   *  section connect
2051   ***************************************************************************/
2052 < connect_entry: CONNECT  
2052 > connect_entry: CONNECT
2053   {
2054  
2055    if (conf_parser_ctx.pass != 2)
2056      break;
2057  
2058    reset_block_state();
2059 +  block_state.aftype.value = AF_INET;
2060    block_state.port.value = PORTNUM;
2061   } '{' connect_items '}' ';'
2062   {
# Line 1970 | Line 2070 | connect_entry: CONNECT
2070        !block_state.host.buf[0])
2071      break;
2072  
2073 <  if (!(block_state.rpass.buf[0] ||
2074 <        block_state.spass.buf[0]))
2073 >  if (!block_state.rpass.buf[0] ||
2074 >      !block_state.spass.buf[0])
2075      break;
2076  
2077    if (has_wildcards(block_state.name.buf) ||
# Line 1986 | Line 2086 | connect_entry: CONNECT
2086    conf->name = xstrdup(block_state.name.buf);
2087    conf->passwd = xstrdup(block_state.rpass.buf);
2088    conf->spasswd = xstrdup(block_state.spass.buf);
2089 <  conf->cipher_list = xstrdup(block_state.ciph.buf);
2089 >
2090 >  if (block_state.cert.buf[0])
2091 >    conf->certfp = xstrdup(block_state.cert.buf);
2092 >
2093 >  if (block_state.ciph.buf[0])
2094 >    conf->cipher_list = xstrdup(block_state.ciph.buf);
2095  
2096    dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2097    dlinkMoveList(&block_state.hub.list, &conf->hub_list);
# Line 2017 | Line 2122 | connect_entry: CONNECT
2122   };
2123  
2124   connect_items:  connect_items connect_item | connect_item;
2125 < connect_item:   connect_name | connect_host | connect_vhost |
2126 <                connect_send_password | connect_accept_password |
2127 <                connect_aftype | connect_port | connect_ssl_cipher_list |
2128 <                connect_flags | connect_hub_mask | connect_leaf_mask |
2129 <                connect_class | connect_encrypted |
2125 > connect_item:   connect_name |
2126 >                connect_host |
2127 >                connect_vhost |
2128 >                connect_send_password |
2129 >                connect_accept_password |
2130 >                connect_ssl_certificate_fingerprint |
2131 >                connect_aftype |
2132 >                connect_port |
2133 >                connect_ssl_cipher_list |
2134 >                connect_flags |
2135 >                connect_hub_mask |
2136 >                connect_leaf_mask |
2137 >                connect_class |
2138 >                connect_encrypted |
2139                  error ';' ;
2140  
2141   connect_name: NAME '=' QSTRING ';'
# Line 2030 | Line 2144 | connect_name: NAME '=' QSTRING ';'
2144      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2145   };
2146  
2147 < connect_host: HOST '=' QSTRING ';'
2147 > connect_host: HOST '=' QSTRING ';'
2148   {
2149    if (conf_parser_ctx.pass == 2)
2150      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2151   };
2152  
2153 < connect_vhost: VHOST '=' QSTRING ';'
2153 > connect_vhost: VHOST '=' QSTRING ';'
2154   {
2155    if (conf_parser_ctx.pass == 2)
2156      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2157   };
2158 <
2158 >
2159   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2160   {
2161    if (conf_parser_ctx.pass != 2)
# Line 2068 | Line 2182 | connect_accept_password: ACCEPT_PASSWORD
2182      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2183   };
2184  
2185 + connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2186 + {
2187 +  if (conf_parser_ctx.pass == 2)
2188 +    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2189 + };
2190 +
2191   connect_port: PORT '=' NUMBER ';'
2192   {
2193    if (conf_parser_ctx.pass == 2)
# Line 2113 | Line 2233 | connect_encrypted: ENCRYPTED '=' TBOOL '
2233    }
2234   };
2235  
2236 < connect_hub_mask: HUB_MASK '=' QSTRING ';'
2236 > connect_hub_mask: HUB_MASK '=' QSTRING ';'
2237   {
2238    if (conf_parser_ctx.pass == 2)
2239      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2240   };
2241  
2242 < connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2242 > connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2243   {
2244    if (conf_parser_ctx.pass == 2)
2245      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
# Line 2161 | Line 2281 | kill_entry: KILL
2281        !block_state.host.buf[0])
2282      break;
2283  
2284 +  conf = conf_make(CONF_KLINE);
2285 +  conf->user = xstrdup(block_state.user.buf);
2286 +  conf->host = xstrdup(block_state.host.buf);
2287  
2288 <  if (block_state.port.value == 1)
2289 <  {
2167 < #ifdef HAVE_LIBPCRE
2168 <    void *exp_user = NULL;
2169 <    void *exp_host = NULL;
2170 <    const char *errptr = NULL;
2171 <
2172 <    if (!(exp_user = ircd_pcre_compile(block_state.user.buf, &errptr)) ||
2173 <        !(exp_host = ircd_pcre_compile(block_state.host.buf, &errptr)))
2174 <    {
2175 <      ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2176 <           errptr);
2177 <      break;
2178 <    }
2179 <
2180 <    conf = conf_make(CONF_RKLINE);
2181 <    conf->regexuser = exp_user;
2182 <    conf->regexhost = exp_host;
2183 <
2184 <    conf->user = xstrdup(block_state.user.buf);
2185 <    conf->host = xstrdup(block_state.host.buf);
2186 <
2187 <    if (block_state.rpass.buf[0])
2188 <      conf->reason = xstrdup(block_state.rpass.buf);
2189 <    else
2190 <      conf->reason = xstrdup(CONF_NOREASON);
2191 < #else
2192 <    ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2193 <    break;
2194 < #endif
2195 <  }
2288 >  if (block_state.rpass.buf[0])
2289 >    conf->reason = xstrdup(block_state.rpass.buf);
2290    else
2291 <  {
2292 <    conf = conf_make(CONF_KLINE);
2199 <
2200 <    conf->user = xstrdup(block_state.user.buf);
2201 <    conf->host = xstrdup(block_state.host.buf);
2202 <
2203 <    if (block_state.rpass.buf[0])
2204 <      conf->reason = xstrdup(block_state.rpass.buf);
2205 <    else
2206 <      conf->reason = xstrdup(CONF_NOREASON);
2207 <    add_conf_by_address(CONF_KLINE, conf);
2208 <  }
2209 < };
2210 <
2211 < kill_type: TYPE
2212 < {
2213 <  if (conf_parser_ctx.pass == 2)
2214 <    block_state.port.value = 0;
2215 < } '='  kill_type_items ';';
2216 <
2217 < kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2218 < kill_type_item: REGEX_T
2219 < {
2220 <  if (conf_parser_ctx.pass == 2)
2221 <    block_state.port.value = 1;
2291 >    conf->reason = xstrdup(CONF_NOREASON);
2292 >  add_conf_by_address(CONF_KLINE, conf);
2293   };
2294  
2295   kill_items:     kill_items kill_item | kill_item;
2296 < kill_item:      kill_user | kill_reason | kill_type | error;
2296 > kill_item:      kill_user | kill_reason | error;
2297  
2298   kill_user: USER '=' QSTRING ';'
2299   {
# Line 2244 | Line 2315 | kill_user: USER '=' QSTRING ';'
2315    }
2316   };
2317  
2318 < kill_reason: REASON '=' QSTRING ';'
2318 > kill_reason: REASON '=' QSTRING ';'
2319   {
2320    if (conf_parser_ctx.pass == 2)
2321      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2253 | Line 2324 | kill_reason: REASON '=' QSTRING ';'
2324   /***************************************************************************
2325   *  section deny
2326   ***************************************************************************/
2327 < deny_entry: DENY
2327 > deny_entry: DENY
2328   {
2329    if (conf_parser_ctx.pass == 2)
2330      reset_block_state();
# Line 2278 | Line 2349 | deny_entry: DENY
2349        conf->reason = xstrdup(CONF_NOREASON);
2350      add_conf_by_address(CONF_DLINE, conf);
2351    }
2352 < };
2352 > };
2353  
2354   deny_items:     deny_items deny_item | deny_item;
2355   deny_item:      deny_ip | deny_reason | error;
# Line 2289 | Line 2360 | deny_ip: IP '=' QSTRING ';'
2360      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2361   };
2362  
2363 < deny_reason: REASON '=' QSTRING ';'
2363 > deny_reason: REASON '=' QSTRING ';'
2364   {
2365    if (conf_parser_ctx.pass == 2)
2366      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2334 | Line 2405 | gecos_entry: GECOS
2405    if (!block_state.name.buf[0])
2406      break;
2407  
2408 <  if (block_state.port.value == 1)
2338 <  {
2339 < #ifdef HAVE_LIBPCRE
2340 <    void *exp_p = NULL;
2341 <    const char *errptr = NULL;
2342 <
2343 <    if (!(exp_p = ircd_pcre_compile(block_state.name.buf, &errptr)))
2344 <    {
2345 <      ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2346 <           errptr);
2347 <      break;
2348 <    }
2349 <
2350 <    conf = conf_make(CONF_RXLINE);
2351 <    conf->regexuser = exp_p;
2352 < #else
2353 <    conf_error_report("Failed to add regular expression based X-Line: no PCRE support");
2354 <    break;
2355 < #endif
2356 <  }
2357 <  else
2358 <    conf = conf_make(CONF_XLINE);
2359 <
2408 >  conf = conf_make(CONF_XLINE);
2409    conf->name = xstrdup(block_state.name.buf);
2410  
2411    if (block_state.rpass.buf[0])
# Line 2365 | Line 2414 | gecos_entry: GECOS
2414      conf->reason = xstrdup(CONF_NOREASON);
2415   };
2416  
2368 gecos_flags: TYPE
2369 {
2370  if (conf_parser_ctx.pass == 2)
2371    block_state.port.value = 0;
2372 } '='  gecos_flags_items ';';
2373
2374 gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2375 gecos_flags_item: REGEX_T
2376 {
2377  if (conf_parser_ctx.pass == 2)
2378    block_state.port.value = 1;
2379 };
2380
2417   gecos_items: gecos_items gecos_item | gecos_item;
2418 < gecos_item:  gecos_name | gecos_reason | gecos_flags | error;
2418 > gecos_item:  gecos_name | gecos_reason | error;
2419  
2420 < gecos_name: NAME '=' QSTRING ';'
2420 > gecos_name: NAME '=' QSTRING ';'
2421   {
2422    if (conf_parser_ctx.pass == 2)
2423      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2424   };
2425  
2426 < gecos_reason: REASON '=' QSTRING ';'
2426 > gecos_reason: REASON '=' QSTRING ';'
2427   {
2428    if (conf_parser_ctx.pass == 2)
2429      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2400 | Line 2436 | general_entry: GENERAL
2436    '{' general_items '}' ';';
2437  
2438   general_items:      general_items general_item | general_item;
2439 < general_item:       general_hide_spoof_ips | general_ignore_bogus_ts |
2440 <                    general_failed_oper_notice | general_anti_nick_flood |
2441 <                    general_max_nick_time | general_max_nick_changes |
2442 <                    general_max_accept | general_anti_spam_exit_message_time |
2443 <                    general_ts_warn_delta | general_ts_max_delta |
2439 > general_item:       general_hide_spoof_ips |
2440 >                    general_ignore_bogus_ts |
2441 >                    general_failed_oper_notice |
2442 >                    general_anti_nick_flood |
2443 >                    general_max_nick_time |
2444 >                    general_max_nick_changes |
2445 >                    general_max_accept |
2446 >                    general_anti_spam_exit_message_time |
2447 >                    general_ts_warn_delta |
2448 >                    general_ts_max_delta |
2449                      general_kill_chase_time_limit |
2450                      general_invisible_on_connect |
2451 <                    general_warn_no_nline | general_dots_in_ident |
2452 <                    general_stats_o_oper_only | general_stats_k_oper_only |
2453 <                    general_pace_wait | general_stats_i_oper_only |
2454 <                    general_pace_wait_simple | general_stats_P_oper_only |
2455 <                    general_short_motd | general_no_oper_flood |
2456 <                    general_true_no_oper_flood | general_oper_pass_resv |
2457 <                    general_oper_only_umodes | general_max_targets |
2458 <                    general_use_egd | general_egdpool_path |
2459 <                    general_oper_umodes | general_caller_id_wait |
2460 <                    general_opers_bypass_callerid | general_default_floodcount |
2461 <                    general_min_nonwildcard | general_min_nonwildcard_simple |
2462 <                    general_disable_remote_commands |
2463 <                    general_throttle_time | general_havent_read_conf |
2451 >                    general_warn_no_nline |
2452 >                    general_dots_in_ident |
2453 >                    general_stats_o_oper_only |
2454 >                    general_stats_k_oper_only |
2455 >                    general_pace_wait |
2456 >                    general_stats_i_oper_only |
2457 >                    general_pace_wait_simple |
2458 >                    general_stats_P_oper_only |
2459 >                    general_stats_u_oper_only |
2460 >                    general_short_motd |
2461 >                    general_no_oper_flood |
2462 >                    general_true_no_oper_flood |
2463 >                    general_oper_pass_resv |
2464 >                    general_oper_only_umodes |
2465 >                    general_max_targets |
2466 >                    general_use_egd |
2467 >                    general_egdpool_path |
2468 >                    general_oper_umodes |
2469 >                    general_caller_id_wait |
2470 >                    general_opers_bypass_callerid |
2471 >                    general_default_floodcount |
2472 >                    general_min_nonwildcard |
2473 >                    general_min_nonwildcard_simple |
2474 >                    general_throttle_time |
2475 >                    general_havent_read_conf |
2476                      general_ping_cookie |
2477 <                    general_disable_auth |
2478 <                    general_tkline_expire_notices | general_gline_enable |
2479 <                    general_gline_duration | general_gline_request_duration |
2477 >                    general_disable_auth |
2478 >                    general_tkline_expire_notices |
2479 >                    general_gline_enable |
2480 >                    general_gline_duration |
2481 >                    general_gline_request_duration |
2482                      general_gline_min_cidr |
2483                      general_gline_min_cidr6 |
2484 <                    general_stats_e_disabled |
2485 <                    general_max_watch | general_services_name |
2486 <                    error;
2484 >                    general_stats_e_disabled |
2485 >                    general_max_watch |
2486 >                    general_services_name |
2487 >                    general_cycle_on_host_change |
2488 >                    error;
2489  
2490  
2491   general_max_watch: MAX_WATCH '=' NUMBER ';'
# Line 2436 | Line 2493 | general_max_watch: MAX_WATCH '=' NUMBER
2493    ConfigFileEntry.max_watch = $3;
2494   };
2495  
2496 + general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2497 + {
2498 +  if (conf_parser_ctx.pass == 2)
2499 +    ConfigFileEntry.cycle_on_host_change = yylval.number;
2500 + };
2501 +
2502   general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2503   {
2504    if (conf_parser_ctx.pass == 2)
# Line 2484 | Line 2547 | general_ignore_bogus_ts: IGNORE_BOGUS_TS
2547    ConfigFileEntry.ignore_bogus_ts = yylval.number;
2548   };
2549  
2487 general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2488 {
2489  ConfigFileEntry.disable_remote = yylval.number;
2490 };
2491
2550   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2551   {
2552    ConfigFileEntry.failed_oper_notice = yylval.number;
# Line 2501 | Line 2559 | general_anti_nick_flood: ANTI_NICK_FLOOD
2559  
2560   general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2561   {
2562 <  ConfigFileEntry.max_nick_time = $3;
2562 >  ConfigFileEntry.max_nick_time = $3;
2563   };
2564  
2565   general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
# Line 2566 | Line 2624 | general_stats_P_oper_only: STATS_P_OPER_
2624    ConfigFileEntry.stats_P_oper_only = yylval.number;
2625   };
2626  
2627 + general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2628 + {
2629 +  ConfigFileEntry.stats_u_oper_only = yylval.number;
2630 + };
2631 +
2632   general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2633   {
2634    ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
# Line 2606 | Line 2669 | general_short_motd: SHORT_MOTD '=' TBOOL
2669   {
2670    ConfigFileEntry.short_motd = yylval.number;
2671   };
2672 <  
2672 >
2673   general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2674   {
2675    ConfigFileEntry.no_oper_flood = yylval.number;
# Line 2667 | Line 2730 | general_disable_auth: DISABLE_AUTH '=' T
2730  
2731   general_throttle_time: THROTTLE_TIME '=' timespec ';'
2732   {
2733 <  ConfigFileEntry.throttle_time = yylval.number;
2733 >  ConfigFileEntry.throttle_time = $3;
2734   };
2735  
2736   general_oper_umodes: OPER_UMODES
# Line 2682 | Line 2745 | umode_oitem:     T_BOTS
2745   } | T_CCONN
2746   {
2747    ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2685 } | T_CCONN_FULL
2686 {
2687  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2748   } | T_DEAF
2749   {
2750    ConfigFileEntry.oper_umodes |= UMODE_DEAF;
# Line 2736 | Line 2796 | umode_oitem:     T_BOTS
2796   } | T_LOCOPS
2797   {
2798    ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2799 + } | T_NONONREG
2800 + {
2801 +  ConfigFileEntry.oper_umodes |= UMODE_REGONLY;
2802 + } | T_FARCONNECT
2803 + {
2804 +  ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT;
2805   };
2806  
2807 < general_oper_only_umodes: OPER_ONLY_UMODES
2807 > general_oper_only_umodes: OPER_ONLY_UMODES
2808   {
2809    ConfigFileEntry.oper_only_umodes = 0;
2810   } '='  umode_items ';' ;
2811  
2812 < umode_items:    umode_items ',' umode_item | umode_item;
2813 < umode_item:     T_BOTS
2812 > umode_items:  umode_items ',' umode_item | umode_item;
2813 > umode_item:   T_BOTS
2814   {
2815    ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2816   } | T_CCONN
2817   {
2818    ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2753 } | T_CCONN_FULL
2754 {
2755  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2819   } | T_DEAF
2820   {
2821    ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
# Line 2760 | Line 2823 | umode_item:    T_BOTS
2823   {
2824    ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2825   } | T_FULL
2826 < {
2826 > {
2827    ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2828   } | T_SKILL
2829   {
# Line 2807 | Line 2870 | umode_item:    T_BOTS
2870   } | T_NONONREG
2871   {
2872    ConfigFileEntry.oper_only_umodes |= UMODE_REGONLY;
2873 + } | T_FARCONNECT
2874 + {
2875 +  ConfigFileEntry.oper_only_umodes |= UMODE_FARCONNECT;
2876   };
2877  
2878   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
# Line 2833 | Line 2899 | channel_entry: CHANNEL
2899  
2900   channel_items:      channel_items channel_item | channel_item;
2901   channel_item:       channel_max_bans |
2902 <                    channel_knock_delay | channel_knock_delay_channel |
2903 <                    channel_max_chans_per_user | channel_max_chans_per_oper |
2904 <                    channel_quiet_on_ban | channel_default_split_user_count |
2902 >                    channel_knock_delay |
2903 >                    channel_knock_delay_channel |
2904 >                    channel_max_chans_per_user |
2905 >                    channel_max_chans_per_oper |
2906 >                    channel_default_split_user_count |
2907                      channel_default_split_server_count |
2908                      channel_no_create_on_split |
2909                      channel_no_join_on_split |
2910 <                    channel_jflood_count | channel_jflood_time |
2911 <                    channel_disable_fake_channels | error;
2910 >                    channel_jflood_count |
2911 >                    channel_jflood_time |
2912 >                    channel_disable_fake_channels |
2913 >                    error;
2914  
2915   channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2916   {
# Line 2867 | Line 2937 | channel_max_chans_per_oper: MAX_CHANS_PE
2937    ConfigChannel.max_chans_per_oper = $3;
2938   };
2939  
2870 channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2871 {
2872  ConfigChannel.quiet_on_ban = yylval.number;
2873 };
2874
2940   channel_max_bans: MAX_BANS '=' NUMBER ';'
2941   {
2942    ConfigChannel.max_bans = $3;
# Line 2904 | Line 2969 | channel_jflood_count: JOIN_FLOOD_COUNT '
2969  
2970   channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2971   {
2972 <  GlobalSetOptions.joinfloodtime = yylval.number;
2972 >  GlobalSetOptions.joinfloodtime = $3;
2973   };
2974  
2975   /***************************************************************************
# Line 2914 | Line 2979 | serverhide_entry: SERVERHIDE
2979    '{' serverhide_items '}' ';';
2980  
2981   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2982 < serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
2983 <                    serverhide_hide_services |
2984 <                    serverhide_links_delay |
2985 <                    serverhide_hidden | serverhide_hidden_name |
2986 <                    serverhide_hide_server_ips |
2982 > serverhide_item:    serverhide_flatten_links |
2983 >                    serverhide_disable_remote_commands |
2984 >                    serverhide_hide_servers |
2985 >                    serverhide_hide_services |
2986 >                    serverhide_links_delay |
2987 >                    serverhide_hidden |
2988 >                    serverhide_hidden_name |
2989 >                    serverhide_hide_server_ips |
2990                      error;
2991  
2992   serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
# Line 2927 | Line 2995 | serverhide_flatten_links: FLATTEN_LINKS
2995      ConfigServerHide.flatten_links = yylval.number;
2996   };
2997  
2998 + serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2999 + {
3000 +  if (conf_parser_ctx.pass == 2)
3001 +    ConfigServerHide.disable_remote_commands = yylval.number;
3002 + };
3003 +
3004   serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3005   {
3006    if (conf_parser_ctx.pass == 2)

Diff Legend

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