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 1992 by michael, Fri May 10 18:32:26 2013 UTC vs.
Revision 3435 by michael, Thu May 1 13:57:39 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 76 | Line 80 | static struct
80      bind,
81      file,
82      ciph,
83 +    cert,
84      rpass,
85      spass,
86      class;
# Line 150 | Line 155 | reset_block_state(void)
155   %token  CALLER_ID_WAIT
156   %token  CAN_FLOOD
157   %token  CHANNEL
158 < %token  CIDR_BITLEN_IPV4
159 < %token  CIDR_BITLEN_IPV6
158 > %token  CIDR_BITLEN_IPV4
159 > %token  CIDR_BITLEN_IPV6
160   %token  CLASS
161   %token  CONNECT
162   %token  CONNECTFREQ
163 + %token  CYCLE_ON_HOST_CHANGE
164   %token  DEFAULT_FLOODCOUNT
165   %token  DEFAULT_SPLIT_SERVER_COUNT
166   %token  DEFAULT_SPLIT_USER_COUNT
# Line 171 | Line 177 | reset_block_state(void)
177   %token  EXCEED_LIMIT
178   %token  EXEMPT
179   %token  FAILED_OPER_NOTICE
174 %token  IRCD_FLAGS
180   %token  FLATTEN_LINKS
181   %token  GECOS
182   %token  GENERAL
# Line 179 | Line 184 | reset_block_state(void)
184   %token  GLINE_DURATION
185   %token  GLINE_ENABLE
186   %token  GLINE_EXEMPT
182 %token  GLINE_REQUEST_DURATION
187   %token  GLINE_MIN_CIDR
188   %token  GLINE_MIN_CIDR6
189 + %token  GLINE_REQUEST_DURATION
190   %token  GLOBAL_KILL
186 %token  IRCD_AUTH
187 %token  NEED_IDENT
191   %token  HAVENT_READ_CONF
192   %token  HIDDEN
193 < %token  HIDDEN_NAME
193 > %token  HIDDEN_NAME
194 > %token  HIDE_IDLE_FROM_OPERS
195   %token  HIDE_SERVER_IPS
196   %token  HIDE_SERVERS
197   %token  HIDE_SERVICES
198 < %token  HIDE_SPOOF_IPS
198 > %token  HIDE_SPOOF_IPS
199   %token  HOST
200   %token  HUB
201   %token  HUB_MASK
202   %token  IGNORE_BOGUS_TS
203   %token  INVISIBLE_ON_CONNECT
204   %token  IP
205 + %token  IRCD_AUTH
206 + %token  IRCD_FLAGS
207 + %token  IRCD_SID
208 + %token  JOIN_FLOOD_COUNT
209 + %token  JOIN_FLOOD_TIME
210   %token  KILL
211 < %token  KILL_CHASE_TIME_LIMIT
211 > %token  KILL_CHASE_TIME_LIMIT
212   %token  KLINE
213   %token  KLINE_EXEMPT
214   %token  KNOCK_DELAY
# Line 207 | Line 216 | reset_block_state(void)
216   %token  LEAF_MASK
217   %token  LINKS_DELAY
218   %token  LISTEN
210 %token  T_LOG
219   %token  MASK
220   %token  MAX_ACCEPT
221   %token  MAX_BANS
# Line 215 | Line 223 | reset_block_state(void)
223   %token  MAX_CHANS_PER_USER
224   %token  MAX_GLOBAL
225   %token  MAX_IDENT
226 + %token  MAX_IDLE
227   %token  MAX_LOCAL
228   %token  MAX_NICK_CHANGES
229   %token  MAX_NICK_LENGTH
# Line 223 | Line 232 | reset_block_state(void)
232   %token  MAX_TARGETS
233   %token  MAX_TOPIC_LENGTH
234   %token  MAX_WATCH
235 + %token  MIN_IDLE
236   %token  MIN_NONWILDCARD
237   %token  MIN_NONWILDCARD_SIMPLE
228 %token  MIN_IDLE
229 %token  MAX_IDLE
230 %token  RANDOM_IDLE
231 %token  HIDE_IDLE_FROM_OPERS
238   %token  MODULE
239   %token  MODULES
240 + %token  MOTD
241   %token  NAME
242 + %token  NEED_IDENT
243   %token  NEED_PASSWORD
244   %token  NETWORK_DESC
245   %token  NETWORK_NAME
# Line 243 | Line 251 | reset_block_state(void)
251   %token  NUMBER
252   %token  NUMBER_PER_CIDR
253   %token  NUMBER_PER_IP
246 %token  OPERATOR
247 %token  OPERS_BYPASS_CALLERID
254   %token  OPER_ONLY_UMODES
255   %token  OPER_PASS_RESV
256   %token  OPER_UMODES
257 < %token  JOIN_FLOOD_COUNT
258 < %token  JOIN_FLOOD_TIME
257 > %token  OPERATOR
258 > %token  OPERS_BYPASS_CALLERID
259   %token  PACE_WAIT
260   %token  PACE_WAIT_SIMPLE
261   %token  PASSWORD
# Line 258 | Line 264 | reset_block_state(void)
264   %token  PING_TIME
265   %token  PORT
266   %token  QSTRING
267 + %token  RANDOM_IDLE
268   %token  REASON
269   %token  REDIRPORT
270   %token  REDIRSERV
271   %token  REHASH
272   %token  REMOTE
273   %token  REMOTEBAN
267 %token  RSA_PRIVATE_KEY_FILE
268 %token  RSA_PUBLIC_KEY_FILE
269 %token  SSL_CERTIFICATE_FILE
270 %token  SSL_DH_PARAM_FILE
271 %token  T_SSL_CLIENT_METHOD
272 %token  T_SSL_SERVER_METHOD
273 %token  T_SSLV3
274 %token  T_TLSV1
274   %token  RESV
275   %token  RESV_EXEMPT
276 + %token  RSA_PRIVATE_KEY_FILE
277 + %token  RSA_PUBLIC_KEY_FILE
278   %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
278 %token  SENDQ
279   %token  SEND_PASSWORD
280 + %token  SENDQ
281   %token  SERVERHIDE
282   %token  SERVERINFO
282 %token  IRCD_SID
283 %token  TKLINE_EXPIRE_NOTICES
284 %token  T_SHARED
285 %token  T_CLUSTER
286 %token  TYPE
283   %token  SHORT_MOTD
284   %token  SPOOF
285   %token  SPOOF_NOTICE
286 + %token  SQUIT
287 + %token  SSL_CERTIFICATE_FILE
288 + %token  SSL_CERTIFICATE_FINGERPRINT
289 + %token  SSL_CONNECTION_REQUIRED
290 + %token  SSL_DH_PARAM_FILE
291   %token  STATS_E_DISABLED
292   %token  STATS_I_OPER_ONLY
293   %token  STATS_K_OPER_ONLY
294   %token  STATS_O_OPER_ONLY
295   %token  STATS_P_OPER_ONLY
296 < %token  TBOOL
296 < %token  TMASKED
297 < %token  TS_MAX_DELTA
298 < %token  TS_WARN_DELTA
299 < %token  TWODOTS
296 > %token  STATS_U_OPER_ONLY
297   %token  T_ALL
298   %token  T_BOTS
302 %token  T_SOFTCALLERID
299   %token  T_CALLERID
300   %token  T_CCONN
301 < %token  T_CCONN_FULL
306 < %token  T_SSL_CIPHER_LIST
301 > %token  T_CLUSTER
302   %token  T_DEAF
303   %token  T_DEBUG
304   %token  T_DLINE
305   %token  T_EXTERNAL
306   %token  T_FARCONNECT
307 + %token  T_FILE
308   %token  T_FULL
309 + %token  T_GLOBOPS
310   %token  T_INVISIBLE
311   %token  T_IPV4
312   %token  T_IPV6
313   %token  T_LOCOPS
314 + %token  T_LOG
315   %token  T_MAX_CLIENTS
316   %token  T_NCHANGE
317   %token  T_NONONREG
318   %token  T_OPERWALL
319   %token  T_RECVQ
320   %token  T_REJ
321 + %token  T_RESTART
322   %token  T_SERVER
323 + %token  T_SERVICE
324 + %token  T_SERVICES_NAME
325   %token  T_SERVNOTICE
326   %token  T_SET
327 + %token  T_SHARED
328 + %token  T_SIZE
329   %token  T_SKILL
330 + %token  T_SOFTCALLERID
331   %token  T_SPY
332   %token  T_SSL
333 + %token  T_SSL_CIPHER_LIST
334 + %token  T_SSL_CLIENT_METHOD
335 + %token  T_SSL_SERVER_METHOD
336 + %token  T_SSLV3
337 + %token  T_TLSV1
338   %token  T_UMODES
339   %token  T_UNAUTH
340   %token  T_UNDLINE
341   %token  T_UNLIMITED
342   %token  T_UNRESV
343   %token  T_UNXLINE
335 %token  T_GLOBOPS
344   %token  T_WALLOP
345 + %token  T_WALLOPS
346   %token  T_WEBIRC
347 < %token  T_RESTART
339 < %token  T_SERVICE
340 < %token  T_SERVICES_NAME
347 > %token  TBOOL
348   %token  THROTTLE_TIME
349 + %token  TKLINE_EXPIRE_NOTICES
350 + %token  TMASKED
351   %token  TRUE_NO_OPER_FLOOD
352 + %token  TS_MAX_DELTA
353 + %token  TS_WARN_DELTA
354 + %token  TWODOTS
355 + %token  TYPE
356   %token  UNKLINE
344 %token  USER
357   %token  USE_EGD
358   %token  USE_LOGGING
359 + %token  USER
360   %token  VHOST
361   %token  VHOST6
349 %token  XLINE
362   %token  WARN_NO_NLINE
363 < %token  T_SIZE
352 < %token  T_FILE
363 > %token  XLINE
364  
365 < %type <string> QSTRING
366 < %type <number> NUMBER
367 < %type <number> timespec
368 < %type <number> timespec_
369 < %type <number> sizespec
370 < %type <number> sizespec_
365 > %type  <string> QSTRING
366 > %type  <number> NUMBER
367 > %type  <number> timespec
368 > %type  <number> timespec_
369 > %type  <number> sizespec
370 > %type  <number> sizespec_
371  
372   %%
373 < conf:  
373 > conf:
374          | conf conf_item
375          ;
376  
# Line 367 | Line 378 | conf_item:        admin_entry
378                  | logging_entry
379                  | oper_entry
380                  | channel_entry
381 <                | class_entry
381 >                | class_entry
382                  | listen_entry
383                  | auth_entry
384                  | serverinfo_entry
# Line 383 | Line 394 | conf_item:        admin_entry
394                  | general_entry
395                  | gecos_entry
396                  | modules_entry
397 +                | motd_entry
398                  | error ';'
399                  | error '}'
400          ;
# Line 504 | Line 516 | server_method_type_item: T_SSLV3
516   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
517   {
518   #ifdef HAVE_LIBCRYPTO
519 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
519 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
520    {
521      if (!ServerInfo.rsa_private_key_file)
522      {
# Line 546 | Line 558 | serverinfo_ssl_certificate_file: SSL_CER
558   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
559   {
560   #ifdef HAVE_LIBCRYPTO
561 <  if (conf_parser_ctx.pass == 1)
550 <  {
551 <    BIO *file;
561 >  BIO *file = NULL;
562  
563 <    if (ServerInfo.rsa_private_key)
564 <    {
555 <      RSA_free(ServerInfo.rsa_private_key);
556 <      ServerInfo.rsa_private_key = NULL;
557 <    }
563 >  if (conf_parser_ctx.pass != 1)
564 >    break;
565  
566 <    if (ServerInfo.rsa_private_key_file)
567 <    {
568 <      MyFree(ServerInfo.rsa_private_key_file);
569 <      ServerInfo.rsa_private_key_file = NULL;
570 <    }
566 >  if (ServerInfo.rsa_private_key)
567 >  {
568 >    RSA_free(ServerInfo.rsa_private_key);
569 >    ServerInfo.rsa_private_key = NULL;
570 >  }
571  
572 <    ServerInfo.rsa_private_key_file = xstrdup(yylval.string);
572 >  if (ServerInfo.rsa_private_key_file)
573 >  {
574 >    MyFree(ServerInfo.rsa_private_key_file);
575 >    ServerInfo.rsa_private_key_file = NULL;
576 >  }
577  
578 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
568 <    {
569 <      conf_error_report("File open failed, ignoring");
570 <      break;
571 <    }
578 >  ServerInfo.rsa_private_key_file = xstrdup(yylval.string);
579  
580 <    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
580 >  if ((file = BIO_new_file(yylval.string, "r")) == NULL)
581 >  {
582 >    conf_error_report("File open failed, ignoring");
583 >    break;
584 >  }
585  
586 <    BIO_set_close(file, BIO_CLOSE);
576 <    BIO_free(file);
586 >  ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
587  
588 <    if (ServerInfo.rsa_private_key == NULL)
589 <    {
580 <      conf_error_report("Couldn't extract key, ignoring");
581 <      break;
582 <    }
588 >  BIO_set_close(file, BIO_CLOSE);
589 >  BIO_free(file);
590  
591 <    if (!RSA_check_key(ServerInfo.rsa_private_key))
592 <    {
593 <      RSA_free(ServerInfo.rsa_private_key);
594 <      ServerInfo.rsa_private_key = NULL;
591 >  if (ServerInfo.rsa_private_key == NULL)
592 >  {
593 >    conf_error_report("Couldn't extract key, ignoring");
594 >    break;
595 >  }
596  
597 <      conf_error_report("Invalid key, ignoring");
598 <      break;
599 <    }
597 >  if (!RSA_check_key(ServerInfo.rsa_private_key))
598 >  {
599 >    RSA_free(ServerInfo.rsa_private_key);
600 >    ServerInfo.rsa_private_key = NULL;
601  
602 <    /* require 2048 bit (256 byte) key */
603 <    if (RSA_size(ServerInfo.rsa_private_key) != 256)
604 <    {
596 <      RSA_free(ServerInfo.rsa_private_key);
597 <      ServerInfo.rsa_private_key = NULL;
602 >    conf_error_report("Invalid key, ignoring");
603 >    break;
604 >  }
605  
606 <      conf_error_report("Not a 2048 bit key, ignoring");
607 <    }
606 >  if (RSA_size(ServerInfo.rsa_private_key) < 128)
607 >  {
608 >    RSA_free(ServerInfo.rsa_private_key);
609 >    ServerInfo.rsa_private_key = NULL;
610 >
611 >    conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size");
612    }
613   #endif
614   };
# Line 638 | Line 649 | serverinfo_ssl_cipher_list: T_SSL_CIPHER
649   #endif
650   };
651  
652 < serverinfo_name: NAME '=' QSTRING ';'
652 > serverinfo_name: NAME '=' QSTRING ';'
653   {
654    /* this isn't rehashable */
655    if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
# Line 653 | Line 664 | serverinfo_name: NAME '=' QSTRING ';'
664    }
665   };
666  
667 < serverinfo_sid: IRCD_SID '=' QSTRING ';'
667 > serverinfo_sid: IRCD_SID '=' QSTRING ';'
668   {
669    /* this isn't rehashable */
670    if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
# Line 693 | Line 704 | serverinfo_network_name: NETWORK_NAME '=
704  
705   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
706   {
707 <  if (conf_parser_ctx.pass == 2)
708 <  {
709 <    MyFree(ServerInfo.network_desc);
710 <    ServerInfo.network_desc = xstrdup(yylval.string);
711 <  }
707 >  if (conf_parser_ctx.pass != 2)
708 >    break;
709 >
710 >  MyFree(ServerInfo.network_desc);
711 >  ServerInfo.network_desc = xstrdup(yylval.string);
712   };
713  
714   serverinfo_vhost: VHOST '=' QSTRING ';'
# Line 827 | Line 838 | serverinfo_max_topic_length: MAX_TOPIC_L
838      ServerInfo.max_topic_length = $3;
839   };
840  
841 < serverinfo_hub: HUB '=' TBOOL ';'
841 > serverinfo_hub: HUB '=' TBOOL ';'
842   {
843    if (conf_parser_ctx.pass == 2)
844      ServerInfo.hub = yylval.number;
# Line 842 | Line 853 | admin_items: admin_items admin_item | ad
853   admin_item:  admin_name | admin_description |
854               admin_email | error ';' ;
855  
856 < admin_name: NAME '=' QSTRING ';'
856 > admin_name: NAME '=' QSTRING ';'
857   {
858 <  if (conf_parser_ctx.pass == 2)
859 <  {
860 <    MyFree(AdminInfo.name);
861 <    AdminInfo.name = xstrdup(yylval.string);
862 <  }
858 >  if (conf_parser_ctx.pass != 2)
859 >    break;
860 >
861 >  MyFree(AdminInfo.name);
862 >  AdminInfo.name = xstrdup(yylval.string);
863   };
864  
865   admin_email: EMAIL '=' QSTRING ';'
866   {
867 <  if (conf_parser_ctx.pass == 2)
868 <  {
869 <    MyFree(AdminInfo.email);
870 <    AdminInfo.email = xstrdup(yylval.string);
871 <  }
867 >  if (conf_parser_ctx.pass != 2)
868 >    break;
869 >
870 >  MyFree(AdminInfo.email);
871 >  AdminInfo.email = xstrdup(yylval.string);
872   };
873  
874   admin_description: DESCRIPTION '=' QSTRING ';'
875   {
876 +  if (conf_parser_ctx.pass != 2)
877 +    break;
878 +
879 +  MyFree(AdminInfo.description);
880 +  AdminInfo.description = xstrdup(yylval.string);
881 + };
882 +
883 + /***************************************************************************
884 + * motd section
885 + ***************************************************************************/
886 + motd_entry: MOTD
887 + {
888    if (conf_parser_ctx.pass == 2)
889 <  {
890 <    MyFree(AdminInfo.description);
891 <    AdminInfo.description = xstrdup(yylval.string);
892 <  }
889 >    reset_block_state();
890 > } '{' motd_items '}' ';'
891 > {
892 >  dlink_node *ptr = NULL;
893 >
894 >  if (conf_parser_ctx.pass != 2)
895 >    break;
896 >
897 >  if (!block_state.file.buf[0])
898 >    break;
899 >
900 >  DLINK_FOREACH(ptr, block_state.mask.list.head)
901 >    motd_add(ptr->data, block_state.file.buf);
902 > };
903 >
904 > motd_items: motd_items motd_item | motd_item;
905 > motd_item:  motd_mask | motd_file | error ';' ;
906 >
907 > motd_mask: MASK '=' QSTRING ';'
908 > {
909 >  if (conf_parser_ctx.pass == 2)
910 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
911 > };
912 >
913 > motd_file: T_FILE '=' QSTRING ';'
914 > {
915 >  if (conf_parser_ctx.pass == 2)
916 >    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
917   };
918  
919   /***************************************************************************
# Line 939 | Line 986 | logging_file_type_item:  USER
986   {
987    if (conf_parser_ctx.pass == 2)
988      block_state.type.value = LOG_TYPE_GLINE;
989 + } | XLINE
990 + {
991 +  if (conf_parser_ctx.pass == 2)
992 +    block_state.type.value = LOG_TYPE_XLINE;
993 + } | RESV
994 + {
995 +  if (conf_parser_ctx.pass == 2)
996 +    block_state.type.value = LOG_TYPE_RESV;
997   } | T_DLINE
998   {
999    if (conf_parser_ctx.pass == 2)
# Line 961 | Line 1016 | logging_file_type_item:  USER
1016   /***************************************************************************
1017   * section oper
1018   ***************************************************************************/
1019 < oper_entry: OPERATOR
1019 > oper_entry: OPERATOR
1020   {
1021    if (conf_parser_ctx.pass != 2)
1022      break;
# Line 978 | Line 1033 | oper_entry: OPERATOR
1033    if (!block_state.name.buf[0])
1034      break;
1035   #ifdef HAVE_LIBCRYPTO
1036 <  if (!(block_state.file.buf[0] ||
1037 <        block_state.rpass.buf[0]))
1036 >  if (!block_state.file.buf[0] &&
1037 >      !block_state.rpass.buf[0])
1038      break;
1039   #else
1040    if (!block_state.rpass.buf[0])
# Line 1000 | Line 1055 | oper_entry: OPERATOR
1055      nuh.hostsize = sizeof(block_state.host.buf);
1056      split_nuh(&nuh);
1057  
1058 <    conf        = conf_make(CONF_OPER);
1059 <    conf->name  = xstrdup(block_state.name.buf);
1060 <    conf->user  = xstrdup(block_state.user.buf);
1061 <    conf->host  = xstrdup(block_state.host.buf);
1058 >    conf         = conf_make(CONF_OPER);
1059 >    conf->name   = xstrdup(block_state.name.buf);
1060 >    conf->user   = xstrdup(block_state.user.buf);
1061 >    conf->host   = xstrdup(block_state.host.buf);
1062 >
1063 >    if (block_state.cert.buf[0])
1064 >      conf->certfp = xstrdup(block_state.cert.buf);
1065  
1066      if (block_state.rpass.buf[0])
1067        conf->passwd = xstrdup(block_state.rpass.buf);
# Line 1041 | Line 1099 | oper_entry: OPERATOR
1099   oper_items:     oper_items oper_item | oper_item;
1100   oper_item:      oper_name | oper_user | oper_password |
1101                  oper_umodes | oper_class | oper_encrypted |
1102 <                oper_rsa_public_key_file | oper_flags | error ';' ;
1102 >                oper_rsa_public_key_file | oper_ssl_certificate_fingerprint |
1103 >                oper_ssl_connection_required |
1104 >                oper_flags | error ';' ;
1105  
1106   oper_name: NAME '=' QSTRING ';'
1107   {
# Line 1063 | Line 1123 | oper_password: PASSWORD '=' QSTRING ';'
1123  
1124   oper_encrypted: ENCRYPTED '=' TBOOL ';'
1125   {
1126 <  if (conf_parser_ctx.pass == 2)
1127 <  {
1128 <    if (yylval.number)
1129 <      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1130 <    else
1131 <      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1132 <  }
1126 >  if (conf_parser_ctx.pass != 2)
1127 >    break;
1128 >
1129 >  if (yylval.number)
1130 >    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1131 >  else
1132 >    block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1133   };
1134  
1135   oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
# Line 1078 | Line 1138 | oper_rsa_public_key_file: RSA_PUBLIC_KEY
1138      strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1139   };
1140  
1141 + oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1142 + {
1143 +  if (conf_parser_ctx.pass == 2)
1144 +    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1145 + };
1146 +
1147 + oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1148 + {
1149 +  if (conf_parser_ctx.pass != 2)
1150 +    break;
1151 +
1152 +  if (yylval.number)
1153 +    block_state.flags.value |= CONF_FLAGS_SSL;
1154 +  else
1155 +    block_state.flags.value &= ~CONF_FLAGS_SSL;
1156 + };
1157 +
1158   oper_class: CLASS '=' QSTRING ';'
1159   {
1160    if (conf_parser_ctx.pass == 2)
# Line 1099 | Line 1176 | oper_umodes_item:  T_BOTS
1176   {
1177    if (conf_parser_ctx.pass == 2)
1178      block_state.modes.value |= UMODE_CCONN;
1102 } | T_CCONN_FULL
1103 {
1104  if (conf_parser_ctx.pass == 2)
1105    block_state.modes.value |= UMODE_CCONN_FULL;
1179   } | T_DEAF
1180   {
1181    if (conf_parser_ctx.pass == 2)
# Line 1188 | Line 1261 | oper_flags: IRCD_FLAGS
1261   } '='  oper_flags_items ';';
1262  
1263   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1264 < oper_flags_item: GLOBAL_KILL
1264 > oper_flags_item: KILL ':' REMOTE
1265 > {
1266 >  if (conf_parser_ctx.pass == 2)
1267 >    block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1268 > } | KILL
1269 > {
1270 >  if (conf_parser_ctx.pass == 2)
1271 >    block_state.port.value |= OPER_FLAG_KILL;
1272 > } | CONNECT ':' REMOTE
1273 > {
1274 >  if (conf_parser_ctx.pass == 2)
1275 >    block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1276 > } | CONNECT
1277 > {
1278 >  if (conf_parser_ctx.pass == 2)
1279 >    block_state.port.value |= OPER_FLAG_CONNECT;
1280 > } | SQUIT ':' REMOTE
1281   {
1282    if (conf_parser_ctx.pass == 2)
1283 <    block_state.port.value |= OPER_FLAG_GLOBAL_KILL;
1284 < } | REMOTE
1283 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1284 > } | SQUIT
1285   {
1286    if (conf_parser_ctx.pass == 2)
1287 <    block_state.port.value |= OPER_FLAG_REMOTE;
1287 >    block_state.port.value |= OPER_FLAG_SQUIT;
1288   } | KLINE
1289   {
1290    if (conf_parser_ctx.pass == 2)
# Line 1215 | Line 1304 | oper_flags_item: GLOBAL_KILL
1304   } | XLINE
1305   {
1306    if (conf_parser_ctx.pass == 2)
1307 <    block_state.port.value |= OPER_FLAG_X;
1307 >    block_state.port.value |= OPER_FLAG_XLINE;
1308 > } | T_UNXLINE
1309 > {
1310 >  if (conf_parser_ctx.pass == 2)
1311 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1312   } | GLINE
1313   {
1314    if (conf_parser_ctx.pass == 2)
# Line 1244 | Line 1337 | oper_flags_item: GLOBAL_KILL
1337   {
1338    if (conf_parser_ctx.pass == 2)
1339      block_state.port.value |= OPER_FLAG_GLOBOPS;
1340 + } | T_WALLOPS
1341 + {
1342 +  if (conf_parser_ctx.pass == 2)
1343 +    block_state.port.value |= OPER_FLAG_WALLOPS;
1344 + } | T_LOCOPS
1345 + {
1346 +  if (conf_parser_ctx.pass == 2)
1347 +    block_state.port.value |= OPER_FLAG_LOCOPS;
1348   } | REMOTEBAN
1349   {
1350    if (conf_parser_ctx.pass == 2)
# Line 1340 | Line 1441 | class_item:     class_name |
1441                  class_flags |
1442                  error ';' ;
1443  
1444 < class_name: NAME '=' QSTRING ';'
1444 > class_name: NAME '=' QSTRING ';'
1445   {
1446    if (conf_parser_ctx.pass == 1)
1447      strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
# Line 1566 | Line 1667 | auth_entry: IRCD_AUTH
1667      split_nuh(&nuh);
1668  
1669      conf        = conf_make(CONF_CLIENT);
1670 <    conf->user  = xstrdup(collapse(block_state.user.buf));
1671 <    conf->host  = xstrdup(collapse(block_state.host.buf));
1670 >    conf->user  = xstrdup(block_state.user.buf);
1671 >    conf->host  = xstrdup(block_state.host.buf);
1672  
1673      if (block_state.rpass.buf[0])
1674        conf->passwd = xstrdup(block_state.rpass.buf);
# Line 1580 | Line 1681 | auth_entry: IRCD_AUTH
1681      conf_add_class_to_conf(conf, block_state.class.buf);
1682      add_conf_by_address(CONF_CLIENT, conf);
1683    }
1684 < };
1684 > };
1685  
1686   auth_items:     auth_items auth_item | auth_item;
1687   auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
# Line 1619 | 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 1665 | 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;
# Line 1748 | 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 <    {
1755 <      struct MaskItem *conf = conf_make(CONF_SERVICE);
1756 <      conf->name = xstrdup(yylval.string);
1757 <    }
1857 >    struct MaskItem *conf = conf_make(CONF_SERVICE);
1858 >    conf->name = xstrdup(yylval.string);
1859    }
1860   };
1861  
# Line 1948 | 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 1968 | 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 1984 | 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 2124 | connect_entry: CONNECT
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_ssl_certificate_fingerprint |
2128                  connect_aftype | connect_port | connect_ssl_cipher_list |
2129                  connect_flags | connect_hub_mask | connect_leaf_mask |
2130 <                connect_class | connect_encrypted |
2130 >                connect_class | connect_encrypted |
2131                  error ';' ;
2132  
2133   connect_name: NAME '=' QSTRING ';'
# Line 2028 | Line 2136 | connect_name: NAME '=' QSTRING ';'
2136      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2137   };
2138  
2139 < connect_host: HOST '=' QSTRING ';'
2139 > connect_host: HOST '=' QSTRING ';'
2140   {
2141    if (conf_parser_ctx.pass == 2)
2142      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2143   };
2144  
2145 < connect_vhost: VHOST '=' QSTRING ';'
2145 > connect_vhost: VHOST '=' QSTRING ';'
2146   {
2147    if (conf_parser_ctx.pass == 2)
2148      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2149   };
2150 <
2150 >
2151   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2152   {
2153    if (conf_parser_ctx.pass != 2)
# Line 2066 | Line 2174 | connect_accept_password: ACCEPT_PASSWORD
2174      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2175   };
2176  
2177 + connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2178 + {
2179 +  if (conf_parser_ctx.pass == 2)
2180 +    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2181 + };
2182 +
2183   connect_port: PORT '=' NUMBER ';'
2184   {
2185    if (conf_parser_ctx.pass == 2)
# Line 2111 | Line 2225 | connect_encrypted: ENCRYPTED '=' TBOOL '
2225    }
2226   };
2227  
2228 < connect_hub_mask: HUB_MASK '=' QSTRING ';'
2228 > connect_hub_mask: HUB_MASK '=' QSTRING ';'
2229   {
2230    if (conf_parser_ctx.pass == 2)
2231      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2232   };
2233  
2234 < connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2234 > connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2235   {
2236    if (conf_parser_ctx.pass == 2)
2237      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
# Line 2168 | Line 2282 | kill_entry: KILL
2282    else
2283      conf->reason = xstrdup(CONF_NOREASON);
2284    add_conf_by_address(CONF_KLINE, conf);
2285 < };
2285 > };
2286  
2287   kill_items:     kill_items kill_item | kill_item;
2288   kill_item:      kill_user | kill_reason | error;
# Line 2193 | Line 2307 | kill_user: USER '=' QSTRING ';'
2307    }
2308   };
2309  
2310 < kill_reason: REASON '=' QSTRING ';'
2310 > kill_reason: REASON '=' QSTRING ';'
2311   {
2312    if (conf_parser_ctx.pass == 2)
2313      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2202 | Line 2316 | kill_reason: REASON '=' QSTRING ';'
2316   /***************************************************************************
2317   *  section deny
2318   ***************************************************************************/
2319 < deny_entry: DENY
2319 > deny_entry: DENY
2320   {
2321    if (conf_parser_ctx.pass == 2)
2322      reset_block_state();
# Line 2227 | Line 2341 | deny_entry: DENY
2341        conf->reason = xstrdup(CONF_NOREASON);
2342      add_conf_by_address(CONF_DLINE, conf);
2343    }
2344 < };
2344 > };
2345  
2346   deny_items:     deny_items deny_item | deny_item;
2347   deny_item:      deny_ip | deny_reason | error;
# Line 2238 | Line 2352 | deny_ip: IP '=' QSTRING ';'
2352      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2353   };
2354  
2355 < deny_reason: REASON '=' QSTRING ';'
2355 > deny_reason: REASON '=' QSTRING ';'
2356   {
2357    if (conf_parser_ctx.pass == 2)
2358      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2295 | Line 2409 | gecos_entry: GECOS
2409   gecos_items: gecos_items gecos_item | gecos_item;
2410   gecos_item:  gecos_name | gecos_reason | error;
2411  
2412 < gecos_name: NAME '=' QSTRING ';'
2412 > gecos_name: NAME '=' QSTRING ';'
2413   {
2414    if (conf_parser_ctx.pass == 2)
2415      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2416   };
2417  
2418 < gecos_reason: REASON '=' QSTRING ';'
2418 > gecos_reason: REASON '=' QSTRING ';'
2419   {
2420    if (conf_parser_ctx.pass == 2)
2421      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2325 | Line 2439 | general_item:       general_hide_spoof_i
2439                      general_stats_o_oper_only | general_stats_k_oper_only |
2440                      general_pace_wait | general_stats_i_oper_only |
2441                      general_pace_wait_simple | general_stats_P_oper_only |
2442 +                    general_stats_u_oper_only |
2443                      general_short_motd | general_no_oper_flood |
2444                      general_true_no_oper_flood | general_oper_pass_resv |
2445                      general_oper_only_umodes | general_max_targets |
# Line 2332 | Line 2447 | general_item:       general_hide_spoof_i
2447                      general_oper_umodes | general_caller_id_wait |
2448                      general_opers_bypass_callerid | general_default_floodcount |
2449                      general_min_nonwildcard | general_min_nonwildcard_simple |
2335                    general_disable_remote_commands |
2450                      general_throttle_time | general_havent_read_conf |
2451                      general_ping_cookie |
2452 <                    general_disable_auth |
2452 >                    general_disable_auth |
2453                      general_tkline_expire_notices | general_gline_enable |
2454                      general_gline_duration | general_gline_request_duration |
2455                      general_gline_min_cidr |
2456                      general_gline_min_cidr6 |
2457                      general_stats_e_disabled |
2458                      general_max_watch | general_services_name |
2459 +                    general_cycle_on_host_change |
2460                      error;
2461  
2462  
# Line 2350 | Line 2465 | general_max_watch: MAX_WATCH '=' NUMBER
2465    ConfigFileEntry.max_watch = $3;
2466   };
2467  
2468 + general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2469 + {
2470 +  if (conf_parser_ctx.pass == 2)
2471 +    ConfigFileEntry.cycle_on_host_change = yylval.number;
2472 + };
2473 +
2474   general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2475   {
2476    if (conf_parser_ctx.pass == 2)
# Line 2398 | Line 2519 | general_ignore_bogus_ts: IGNORE_BOGUS_TS
2519    ConfigFileEntry.ignore_bogus_ts = yylval.number;
2520   };
2521  
2401 general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2402 {
2403  ConfigFileEntry.disable_remote = yylval.number;
2404 };
2405
2522   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2523   {
2524    ConfigFileEntry.failed_oper_notice = yylval.number;
# Line 2415 | Line 2531 | general_anti_nick_flood: ANTI_NICK_FLOOD
2531  
2532   general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2533   {
2534 <  ConfigFileEntry.max_nick_time = $3;
2534 >  ConfigFileEntry.max_nick_time = $3;
2535   };
2536  
2537   general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
# Line 2480 | Line 2596 | general_stats_P_oper_only: STATS_P_OPER_
2596    ConfigFileEntry.stats_P_oper_only = yylval.number;
2597   };
2598  
2599 + general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2600 + {
2601 +  ConfigFileEntry.stats_u_oper_only = yylval.number;
2602 + };
2603 +
2604   general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2605   {
2606    ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
# Line 2520 | Line 2641 | general_short_motd: SHORT_MOTD '=' TBOOL
2641   {
2642    ConfigFileEntry.short_motd = yylval.number;
2643   };
2644 <  
2644 >
2645   general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2646   {
2647    ConfigFileEntry.no_oper_flood = yylval.number;
# Line 2581 | Line 2702 | general_disable_auth: DISABLE_AUTH '=' T
2702  
2703   general_throttle_time: THROTTLE_TIME '=' timespec ';'
2704   {
2705 <  ConfigFileEntry.throttle_time = yylval.number;
2705 >  ConfigFileEntry.throttle_time = $3;
2706   };
2707  
2708   general_oper_umodes: OPER_UMODES
# Line 2596 | Line 2717 | umode_oitem:     T_BOTS
2717   } | T_CCONN
2718   {
2719    ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2599 } | T_CCONN_FULL
2600 {
2601  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2720   } | T_DEAF
2721   {
2722    ConfigFileEntry.oper_umodes |= UMODE_DEAF;
# Line 2658 | Line 2776 | umode_oitem:     T_BOTS
2776    ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT;
2777   };
2778  
2779 < general_oper_only_umodes: OPER_ONLY_UMODES
2779 > general_oper_only_umodes: OPER_ONLY_UMODES
2780   {
2781    ConfigFileEntry.oper_only_umodes = 0;
2782   } '='  umode_items ';' ;
2783  
2784   umode_items:    umode_items ',' umode_item | umode_item;
2785 < umode_item:     T_BOTS
2785 > umode_item:     T_BOTS
2786   {
2787    ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2788   } | T_CCONN
2789   {
2790    ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2673 } | T_CCONN_FULL
2674 {
2675  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2791   } | T_DEAF
2792   {
2793    ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
# Line 2680 | Line 2795 | umode_item:    T_BOTS
2795   {
2796    ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2797   } | T_FULL
2798 < {
2798 > {
2799    ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2800   } | T_SKILL
2801   {
# Line 2822 | Line 2937 | channel_jflood_count: JOIN_FLOOD_COUNT '
2937  
2938   channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2939   {
2940 <  GlobalSetOptions.joinfloodtime = yylval.number;
2940 >  GlobalSetOptions.joinfloodtime = $3;
2941   };
2942  
2943   /***************************************************************************
# Line 2832 | Line 2947 | serverhide_entry: SERVERHIDE
2947    '{' serverhide_items '}' ';';
2948  
2949   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2950 < serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
2950 > serverhide_item:    serverhide_flatten_links | serverhide_disable_remote_commands |
2951 >                    serverhide_hide_servers |
2952                      serverhide_hide_services |
2953                      serverhide_links_delay |
2954                      serverhide_hidden | serverhide_hidden_name |
# Line 2845 | Line 2961 | serverhide_flatten_links: FLATTEN_LINKS
2961      ConfigServerHide.flatten_links = yylval.number;
2962   };
2963  
2964 + serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2965 + {
2966 +  if (conf_parser_ctx.pass == 2)
2967 +    ConfigServerHide.disable_remote_commands = yylval.number;
2968 + };
2969 +
2970   serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
2971   {
2972    if (conf_parser_ctx.pass == 2)

Diff Legend

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