ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.0.x/src/conf_parser.y
(Generate patch)

Comparing:
ircd-hybrid-8/src/ircd_parser.y (file contents), Revision 1176 by michael, Sun Aug 14 11:24:24 2011 UTC vs.
ircd-hybrid-8/src/conf_parser.y (file contents), Revision 1377 by michael, Mon Apr 30 19:35:16 2012 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  ircd_parser.y: Parses the ircd configuration file.
3 > *  conf_parser.y: Parses the ircd configuration file.
4   *
5   *  Copyright (C) 2005 by the past and present ircd coders, and others.
6   *
# Line 32 | Line 32
32   #include "stdinc.h"
33   #include "ircd.h"
34   #include "list.h"
35 < #include "s_conf.h"
35 > #include "conf.h"
36   #include "event.h"
37 < #include "s_log.h"
37 > #include "log.h"
38   #include "client.h"     /* for UMODE_ALL only */
39   #include "irc_string.h"
40   #include "sprintf_irc.h"
# Line 52 | Line 52
52   #include <openssl/rsa.h>
53   #include <openssl/bio.h>
54   #include <openssl/pem.h>
55 + #include <openssl/dh.h>
56   #endif
57  
58 + int yylex(void);
59 +
60   static char *class_name = NULL;
61   static struct ConfItem *yy_conf = NULL;
62   static struct AccessItem *yy_aconf = NULL;
# Line 70 | Line 73 | static char userbuf[IRCD_BUFSIZE];
73   static char hostbuf[IRCD_BUFSIZE];
74   static char reasonbuf[REASONLEN + 1];
75   static char gecos_name[REALLEN * 4];
76 <
76 > static char lfile[IRCD_BUFSIZE];
77 > static unsigned int ltype = 0;
78 > static unsigned int lsize = 0;
79   static char *resv_reason = NULL;
80   static char *listener_address = NULL;
76 static int not_atom = 0;
81  
82   struct CollectItem
83   {
# Line 150 | Line 154 | unhook_hub_leaf_confs(void)
154   %token  CHANNEL
155   %token  CIDR_BITLEN_IPV4
156   %token  CIDR_BITLEN_IPV6
153 %token  CIPHER_PREFERENCE
157   %token  CLASS
155 %token  COMPRESSED
156 %token  COMPRESSION_LEVEL
158   %token  CONNECT
159   %token  CONNECTFREQ
159 %token  CRYPTLINK
160 %token  DEFAULT_CIPHER_PREFERENCE
160   %token  DEFAULT_FLOODCOUNT
161   %token  DEFAULT_SPLIT_SERVER_COUNT
162   %token  DEFAULT_SPLIT_USER_COUNT
# Line 180 | Line 179 | unhook_hub_leaf_confs(void)
179   %token  FAILED_OPER_NOTICE
180   %token  IRCD_FLAGS
181   %token  FLATTEN_LINKS
183 %token  FFAILED_OPERLOG
184 %token  FKILLLOG
185 %token  FKLINELOG
186 %token  FGLINELOG
187 %token  FIOERRLOG
188 %token  FOPERLOG
189 %token  FOPERSPYLOG
190 %token  FUSERLOG
182   %token  GECOS
183   %token  GENERAL
184   %token  GLINE
185   %token  GLINES
186   %token  GLINE_EXEMPT
196 %token  GLINE_LOG
187   %token  GLINE_TIME
188   %token  GLINE_MIN_CIDR
189   %token  GLINE_MIN_CIDR6
# Line 202 | Line 192 | unhook_hub_leaf_confs(void)
192   %token  NEED_IDENT
193   %token  HAVENT_READ_CONF
194   %token  HIDDEN
205 %token  HIDDEN_ADMIN
195   %token  HIDDEN_NAME
207 %token  HIDDEN_OPER
196   %token  HIDE_SERVER_IPS
197   %token  HIDE_SERVERS
198   %token  HIDE_SPOOF_IPS
# Line 226 | Line 214 | unhook_hub_leaf_confs(void)
214   %token  LINKS_DELAY
215   %token  LISTEN
216   %token  T_LOG
229 %token  LOGGING
230 %token  LOG_LEVEL
217   %token  MAX_ACCEPT
218   %token  MAX_BANS
219   %token  MAX_CHANS_PER_USER
# Line 254 | Line 240 | unhook_hub_leaf_confs(void)
240   %token  NO_JOIN_ON_SPLIT
241   %token  NO_OPER_FLOOD
242   %token  NO_TILDE
257 %token  NOT
243   %token  NUMBER
244   %token  NUMBER_PER_IDENT
245   %token  NUMBER_PER_CIDR
# Line 262 | Line 247 | unhook_hub_leaf_confs(void)
247   %token  NUMBER_PER_IP_GLOBAL
248   %token  OPERATOR
249   %token  OPERS_BYPASS_CALLERID
265 %token  OPER_LOG
250   %token  OPER_ONLY_UMODES
251   %token  OPER_PASS_RESV
252   %token  OPER_SPY_T
# Line 292 | Line 276 | unhook_hub_leaf_confs(void)
276   %token  RSA_PRIVATE_KEY_FILE
277   %token  RSA_PUBLIC_KEY_FILE
278   %token  SSL_CERTIFICATE_FILE
279 < %token  T_SSL_CONNECTION_METHOD
279 > %token  SSL_DH_PARAM_FILE
280 > %token  T_SSL_CLIENT_METHOD
281 > %token  T_SSL_SERVER_METHOD
282   %token  T_SSLV3
283   %token  T_TLSV1
284   %token  RESV
# Line 302 | Line 288 | unhook_hub_leaf_confs(void)
288   %token  SEND_PASSWORD
289   %token  SERVERHIDE
290   %token  SERVERINFO
305 %token  SERVLINK_PATH
291   %token  IRCD_SID
292   %token  TKLINE_EXPIRE_NOTICES
293   %token  T_SHARED
# Line 329 | Line 314 | unhook_hub_leaf_confs(void)
314   %token  T_CALLERID
315   %token  T_CCONN
316   %token  T_CCONN_FULL
317 + %token  T_SSL_CIPHER_LIST
318   %token  T_CLIENT_FLOOD
319   %token  T_DEAF
320   %token  T_DEBUG
321 + %token  T_DLINE
322   %token  T_DRONE
323   %token  T_EXTERNAL
324   %token  T_FULL
# Line 339 | Line 326 | unhook_hub_leaf_confs(void)
326   %token  T_IPV4
327   %token  T_IPV6
328   %token  T_LOCOPS
342 %token  T_LOGPATH
343 %token  T_L_CRIT
344 %token  T_L_DEBUG
345 %token  T_L_ERROR
346 %token  T_L_INFO
347 %token  T_L_NOTICE
348 %token  T_L_TRACE
349 %token  T_L_WARN
329   %token  T_MAX_CLIENTS
330   %token  T_NCHANGE
331   %token  T_OPERWALL
# Line 358 | Line 337 | unhook_hub_leaf_confs(void)
337   %token  T_SSL
338   %token  T_UMODES
339   %token  T_UNAUTH
340 + %token  T_UNDLINE
341 + %token  T_UNLIMITED
342   %token  T_UNRESV
343   %token  T_UNXLINE
344 + %token  T_GLOBOPS
345   %token  T_WALLOP
346 + %token  T_RESTART
347   %token  T_SERVICE
348   %token  T_SERVICES_NAME
349   %token  THROTTLE_TIME
# Line 382 | Line 365 | unhook_hub_leaf_confs(void)
365   %token  XLINE
366   %token  WARN
367   %token  WARN_NO_NLINE
368 + %token  T_SIZE
369 + %token  T_FILE
370  
371   %type <string> QSTRING
372   %type <number> NUMBER
# Line 484 | Line 469 | serverinfo_items:       serverinfo_items
469   serverinfo_item:        serverinfo_name | serverinfo_vhost |
470                          serverinfo_hub | serverinfo_description |
471                          serverinfo_network_name | serverinfo_network_desc |
472 <                        serverinfo_max_clients |
472 >                        serverinfo_max_clients | serverinfo_ssl_dh_param_file |
473                          serverinfo_rsa_private_key_file | serverinfo_vhost6 |
474                          serverinfo_sid | serverinfo_ssl_certificate_file |
475 <                        serverinfo_ssl_connection_method |
475 >                        serverinfo_ssl_client_method | serverinfo_ssl_server_method |
476 >                        serverinfo_ssl_cipher_list |
477                          error ';' ;
478  
479  
480 < serverinfo_ssl_connection_method: T_SSL_CONNECTION_METHOD
480 > serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
481 > serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ;
482 >
483 > client_method_types: client_method_types ',' client_method_type_item | client_method_type_item;
484 > client_method_type_item: T_SSLV3
485   {
486   #ifdef HAVE_LIBCRYPTO
487 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
488 <    ServerInfo.tls_version = 0;
487 >  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
488 >    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
489   #endif
490 < } '=' method_types ';'
490 > } | T_TLSV1
491   {
492   #ifdef HAVE_LIBCRYPTO
493 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
494 <  {
505 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
506 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
507 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
508 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
509 <  }
493 >  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
494 >    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
495   #endif
496   };
497  
498 < method_types: method_types ',' method_type_item | method_type_item;
499 < method_type_item: T_SSLV3
498 > server_method_types: server_method_types ',' server_method_type_item | server_method_type_item;
499 > server_method_type_item: T_SSLV3
500   {
501   #ifdef HAVE_LIBCRYPTO
502 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
503 <    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_SSLV3;
502 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
503 >    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
504   #endif
505   } | T_TLSV1
506   {
507   #ifdef HAVE_LIBCRYPTO
508 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
509 <    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_TLSV1;
508 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
509 >    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
510   #endif
511   };
512  
# Line 537 | Line 522 | serverinfo_ssl_certificate_file: SSL_CER
522      }
523  
524      if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
525 +                                     SSL_FILETYPE_PEM) <= 0 ||
526 +        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
527                                       SSL_FILETYPE_PEM) <= 0)
528      {
529        yyerror(ERR_lib_error_string(ERR_get_error()));
# Line 544 | Line 531 | serverinfo_ssl_certificate_file: SSL_CER
531      }
532  
533      if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
534 +                                    SSL_FILETYPE_PEM) <= 0 ||
535 +        SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
536                                      SSL_FILETYPE_PEM) <= 0)
537      {
538        yyerror(ERR_lib_error_string(ERR_get_error()));
539        break;
540      }
541  
542 <    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx))
542 >    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
543 >        !SSL_CTX_check_private_key(ServerInfo.client_ctx))
544      {
545        yyerror(ERR_lib_error_string(ERR_get_error()));
546        break;
# Line 586 | Line 576 | serverinfo_rsa_private_key_file: RSA_PRI
576        break;
577      }
578  
579 <    ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL,
590 <      0, NULL);
579 >    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
580  
581      BIO_set_close(file, BIO_CLOSE);
582      BIO_free(file);
# Line 619 | Line 608 | serverinfo_rsa_private_key_file: RSA_PRI
608   #endif
609   };
610  
611 + serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
612 + {
613 + /* TBD - XXX: error reporting */
614 + #ifdef HAVE_LIBCRYPTO
615 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
616 +  {
617 +    BIO *file = BIO_new_file(yylval.string, "r");
618 +
619 +    if (file)
620 +    {
621 +      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
622 +
623 +      BIO_free(file);
624 +
625 +      if (dh)
626 +      {
627 +        if (DH_size(dh) < 128)
628 +          ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
629 +        else
630 +          SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
631 +
632 +        DH_free(dh);
633 +      }
634 +    }
635 +  }
636 + #endif
637 + };
638 +
639 + serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
640 + {
641 + #ifdef HAVE_LIBCRYPTO
642 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
643 +    SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
644 + #endif
645 + };
646 +
647   serverinfo_name: NAME '=' QSTRING ';'
648   {
649    /* this isn't rehashable */
# Line 628 | Line 653 | serverinfo_name: NAME '=' QSTRING ';'
653        DupString(ServerInfo.name, yylval.string);
654      else
655      {
656 <      ilog(L_ERROR, "Ignoring serverinfo::name -- invalid name. Aborting.");
656 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
657        exit(0);
658      }
659    }
# Line 643 | Line 668 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
668        DupString(ServerInfo.sid, yylval.string);
669      else
670      {
671 <      ilog(L_ERROR, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
671 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
672        exit(0);
673      }
674    }
# Line 694 | Line 719 | serverinfo_vhost: VHOST '=' QSTRING ';'
719      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
720  
721      if (getaddrinfo(yylval.string, NULL, &hints, &res))
722 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
722 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
723      else
724      {
725        assert(res != NULL);
# Line 723 | Line 748 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
748      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
749  
750      if (getaddrinfo(yylval.string, NULL, &hints, &res))
751 <      ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
751 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
752      else
753      {
754        assert(res != NULL);
# Line 807 | Line 832 | admin_description: DESCRIPTION '=' QSTRI
832   /***************************************************************************
833   *  section logging
834   ***************************************************************************/
835 < /* XXX */
836 < logging_entry:          LOGGING  '{' logging_items '}' ';' ;
812 <
813 < logging_items:          logging_items logging_item |
814 <                        logging_item ;
835 > logging_entry:          T_LOG  '{' logging_items '}' ';' ;
836 > logging_items:          logging_items logging_item | logging_item ;
837  
838 < logging_item:           logging_path | logging_oper_log |
817 <                        logging_log_level |
818 <                        logging_use_logging | logging_fuserlog |
819 <                        logging_foperlog | logging_fglinelog |
820 <                        logging_fklinelog | logging_killlog |
821 <                        logging_foperspylog | logging_ioerrlog |
822 <                        logging_ffailed_operlog |
838 > logging_item:           logging_use_logging | logging_file_entry |
839                          error ';' ;
840  
841 < logging_path:           T_LOGPATH '=' QSTRING ';'
826 <                        {
827 <                        };
828 <
829 < logging_oper_log:       OPER_LOG '=' QSTRING ';'
830 <                        {
831 <                        };
832 <
833 < logging_fuserlog: FUSERLOG '=' QSTRING ';'
841 > logging_use_logging: USE_LOGGING '=' TBOOL ';'
842   {
843    if (conf_parser_ctx.pass == 2)
844 <    strlcpy(ConfigLoggingEntry.userlog, yylval.string,
837 <            sizeof(ConfigLoggingEntry.userlog));
844 >    ConfigLoggingEntry.use_logging = yylval.number;
845   };
846  
847 < logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
847 > logging_file_entry:
848   {
849 <  if (conf_parser_ctx.pass == 2)
850 <    strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
851 <            sizeof(ConfigLoggingEntry.failed_operlog));
852 < };
846 <
847 < logging_foperlog: FOPERLOG '=' QSTRING ';'
849 >  lfile[0] = '\0';
850 >  ltype = 0;
851 >  lsize = 0;
852 > } T_FILE  '{' logging_file_items '}' ';'
853   {
854 <  if (conf_parser_ctx.pass == 2)
855 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
851 <            sizeof(ConfigLoggingEntry.operlog));
854 >  if (conf_parser_ctx.pass == 2 && ltype > 0)
855 >    log_add_file(ltype, lsize, lfile);
856   };
857  
858 < logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
859 < {
856 <  if (conf_parser_ctx.pass == 2)
857 <    strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
858 <            sizeof(ConfigLoggingEntry.operspylog));
859 < };
858 > logging_file_items: logging_file_items logging_file_item |
859 >                    logging_file_item ;
860  
861 < logging_fglinelog: FGLINELOG '=' QSTRING ';'
862 < {
863 <  if (conf_parser_ctx.pass == 2)
864 <    strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
865 <            sizeof(ConfigLoggingEntry.glinelog));
866 < };
861 > logging_file_item:  logging_file_name | logging_file_type |
862 >                    logging_file_size | error ';' ;
863  
864 < logging_fklinelog: FKLINELOG '=' QSTRING ';'
864 > logging_file_name: NAME '=' QSTRING ';'
865   {
866 <  if (conf_parser_ctx.pass == 2)
867 <    strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
872 <            sizeof(ConfigLoggingEntry.klinelog));
873 < };
866 >  strlcpy(lfile, yylval.string, sizeof(lfile));
867 > }
868  
869 < logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
869 > logging_file_size: T_SIZE '=' sizespec ';'
870   {
871 <  if (conf_parser_ctx.pass == 2)
872 <    strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
873 <            sizeof(ConfigLoggingEntry.ioerrlog));
871 >  lsize = $3;
872 > } | T_SIZE '=' T_UNLIMITED ';'
873 > {
874 >  lsize = 0;
875   };
876  
877 < logging_killlog: FKILLLOG '=' QSTRING ';'
877 > logging_file_type: TYPE
878   {
879    if (conf_parser_ctx.pass == 2)
880 <    strlcpy(ConfigLoggingEntry.killlog, yylval.string,
881 <            sizeof(ConfigLoggingEntry.killlog));
887 < };
880 >    ltype = 0;
881 > } '='  logging_file_type_items ';' ;
882  
883 < logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
884 < {
891 <  if (conf_parser_ctx.pass == 2)
892 <    set_log_level(L_CRIT);
893 < } | LOG_LEVEL '=' T_L_ERROR ';'
883 > logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
884 > logging_file_type_item:  USER
885   {
886    if (conf_parser_ctx.pass == 2)
887 <    set_log_level(L_ERROR);
888 < } | LOG_LEVEL '=' T_L_WARN ';'
887 >    ltype = LOG_TYPE_USER;
888 > } | OPERATOR
889   {
890    if (conf_parser_ctx.pass == 2)
891 <    set_log_level(L_WARN);
892 < } | LOG_LEVEL '=' T_L_NOTICE ';'
891 >    ltype = LOG_TYPE_OPER;
892 > } | GLINE
893   {
894    if (conf_parser_ctx.pass == 2)
895 <    set_log_level(L_NOTICE);
896 < } | LOG_LEVEL '=' T_L_TRACE ';'
895 >    ltype = LOG_TYPE_GLINE;
896 > } | T_DLINE
897   {
898    if (conf_parser_ctx.pass == 2)
899 <    set_log_level(L_TRACE);
900 < } | LOG_LEVEL '=' T_L_INFO ';'
899 >    ltype = LOG_TYPE_DLINE;
900 > } | KLINE
901   {
902    if (conf_parser_ctx.pass == 2)
903 <    set_log_level(L_INFO);
904 < } | LOG_LEVEL '=' T_L_DEBUG ';'
903 >    ltype = LOG_TYPE_KLINE;
904 > } | KILL
905   {
906    if (conf_parser_ctx.pass == 2)
907 <    set_log_level(L_DEBUG);
908 < };
918 <
919 < logging_use_logging: USE_LOGGING '=' TBOOL ';'
907 >    ltype = LOG_TYPE_KILL;
908 > } | T_DEBUG
909   {
910    if (conf_parser_ctx.pass == 2)
911 <    ConfigLoggingEntry.use_logging = yylval.number;
911 >    ltype = LOG_TYPE_DEBUG;
912   };
913  
914 +
915   /***************************************************************************
916   * section oper
917   ***************************************************************************/
# Line 938 | Line 928 | oper_entry: OPERATOR
928      MyFree(class_name);
929      class_name = NULL;
930    }
931 < } oper_name_b '{' oper_items '}' ';'
931 > } '{' oper_items '}' ';'
932   {
933    if (conf_parser_ctx.pass == 2)
934    {
# Line 973 | Line 963 | oper_entry: OPERATOR
963          DupString(new_aconf->host, yy_tmp->host);
964        else
965          DupString(new_aconf->host, "*");
966 +
967 +      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->ipnum,
968 +                                     &new_aconf->bits);
969 +
970        conf_add_class_to_conf(new_conf, class_name);
971        if (yy_aconf->passwd != NULL)
972          DupString(new_aconf->passwd, yy_aconf->passwd);
# Line 1019 | Line 1013 | oper_entry: OPERATOR
1013    }
1014   };
1015  
1022 oper_name_b: | oper_name_t;
1016   oper_items:     oper_items oper_item | oper_item;
1017   oper_item:      oper_name | oper_user | oper_password |
1018                  oper_umodes | oper_class | oper_encrypted |
# Line 1037 | Line 1030 | oper_name: NAME '=' QSTRING ';'
1030    }
1031   };
1032  
1040 oper_name_t: QSTRING
1041 {
1042  if (conf_parser_ctx.pass == 2)
1043  {
1044    if (strlen(yylval.string) > OPERNICKLEN)
1045      yylval.string[OPERNICKLEN] = '\0';
1046
1047    MyFree(yy_conf->name);
1048    DupString(yy_conf->name, yylval.string);
1049  }
1050 };
1051
1033   oper_user: USER '=' QSTRING ';'
1034   {
1035    if (conf_parser_ctx.pass == 2)
# Line 1070 | Line 1051 | oper_user: USER '=' QSTRING ';'
1051      {
1052        DupString(yy_aconf->user, userbuf);
1053        DupString(yy_aconf->host, hostbuf);
1054 +
1055 +      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->ipnum,
1056 +                                    &yy_aconf->bits);
1057      }
1058      else
1059      {
# Line 1188 | Line 1172 | oper_umodes_item:  T_BOTS
1172   {
1173    if (conf_parser_ctx.pass == 2)
1174      yy_aconf->modes |= UMODE_FULL;
1175 + } | HIDDEN
1176 + {
1177 +  if (conf_parser_ctx.pass == 2)
1178 +    yy_aconf->modes |= UMODE_HIDDEN;
1179   } | T_SKILL
1180   {
1181    if (conf_parser_ctx.pass == 2)
# Line 1244 | Line 1232 | oper_umodes_item:  T_BOTS
1232  
1233   oper_flags: IRCD_FLAGS
1234   {
1235 +  if (conf_parser_ctx.pass == 2)
1236 +    yy_aconf->port = 0;
1237   } '='  oper_flags_items ';';
1238  
1239   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1240 < oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom
1251 <                | { not_atom = 0; } oper_flags_item_atom;
1252 <
1253 < oper_flags_item_atom: GLOBAL_KILL
1240 > oper_flags_item: GLOBAL_KILL
1241   {
1242    if (conf_parser_ctx.pass == 2)
1243 <  {
1257 <    if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1258 <    else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1259 <  }
1243 >    yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1244   } | REMOTE
1245   {
1246    if (conf_parser_ctx.pass == 2)
1247 <  {
1264 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1265 <    else yy_aconf->port |= OPER_FLAG_REMOTE;
1266 <  }
1247 >    yy_aconf->port |= OPER_FLAG_REMOTE;
1248   } | KLINE
1249   {
1250    if (conf_parser_ctx.pass == 2)
1251 <  {
1271 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1272 <    else yy_aconf->port |= OPER_FLAG_K;
1273 <  }
1251 >    yy_aconf->port |= OPER_FLAG_K;
1252   } | UNKLINE
1253   {
1254    if (conf_parser_ctx.pass == 2)
1255 <  {
1256 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1257 <    else yy_aconf->port |= OPER_FLAG_UNKLINE;
1258 <  }
1255 >    yy_aconf->port |= OPER_FLAG_UNKLINE;
1256 > } | T_DLINE
1257 > {
1258 >  if (conf_parser_ctx.pass == 2)
1259 >    yy_aconf->port |= OPER_FLAG_DLINE;
1260 > } | T_UNDLINE
1261 > {
1262 >  if (conf_parser_ctx.pass == 2)
1263 >    yy_aconf->port |= OPER_FLAG_UNDLINE;
1264   } | XLINE
1265   {
1266    if (conf_parser_ctx.pass == 2)
1267 <  {
1285 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1286 <    else yy_aconf->port |= OPER_FLAG_X;
1287 <  }
1267 >    yy_aconf->port |= OPER_FLAG_X;
1268   } | GLINE
1269   {
1270    if (conf_parser_ctx.pass == 2)
1271 <  {
1292 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1293 <    else yy_aconf->port |= OPER_FLAG_GLINE;
1294 <  }
1271 >    yy_aconf->port |= OPER_FLAG_GLINE;
1272   } | DIE
1273   {
1274    if (conf_parser_ctx.pass == 2)
1275 <  {
1276 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1300 <    else yy_aconf->port |= OPER_FLAG_DIE;
1301 <  }
1302 < } | REHASH
1275 >    yy_aconf->port |= OPER_FLAG_DIE;
1276 > } | T_RESTART
1277   {
1278    if (conf_parser_ctx.pass == 2)
1279 <  {
1280 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1307 <    else yy_aconf->port |= OPER_FLAG_REHASH;
1308 <  }
1309 < } | ADMIN
1279 >    yy_aconf->port |= OPER_FLAG_RESTART;
1280 > } | REHASH
1281   {
1282    if (conf_parser_ctx.pass == 2)
1283 <  {
1284 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1314 <    else yy_aconf->port |= OPER_FLAG_ADMIN;
1315 <  }
1316 < } | HIDDEN_ADMIN
1283 >    yy_aconf->port |= OPER_FLAG_REHASH;
1284 > } | ADMIN
1285   {
1286    if (conf_parser_ctx.pass == 2)
1287 <  {
1320 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1321 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1322 <  }
1287 >    yy_aconf->port |= OPER_FLAG_ADMIN;
1288   } | NICK_CHANGES
1289   {
1290    if (conf_parser_ctx.pass == 2)
1291 <  {
1327 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1328 <    else yy_aconf->port |= OPER_FLAG_N;
1329 <  }
1291 >    yy_aconf->port |= OPER_FLAG_N;
1292   } | T_OPERWALL
1293   {
1294    if (conf_parser_ctx.pass == 2)
1295 <  {
1296 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1335 <    else yy_aconf->port |= OPER_FLAG_OPERWALL;
1336 <  }
1337 < } | OPER_SPY_T
1295 >    yy_aconf->port |= OPER_FLAG_OPERWALL;
1296 > } | T_GLOBOPS
1297   {
1298    if (conf_parser_ctx.pass == 2)
1299 <  {
1300 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1342 <    else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1343 <  }
1344 < } | HIDDEN_OPER
1299 >    yy_aconf->port |= OPER_FLAG_GLOBOPS;
1300 > } | OPER_SPY_T
1301   {
1302    if (conf_parser_ctx.pass == 2)
1303 <  {
1348 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1349 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1350 <  }
1303 >    yy_aconf->port |= OPER_FLAG_OPER_SPY;
1304   } | REMOTEBAN
1305   {
1306    if (conf_parser_ctx.pass == 2)
1307 <  {
1308 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1356 <    else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1357 <  }
1358 < } | ENCRYPTED
1307 >    yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1308 > } | MODULE
1309   {
1310    if (conf_parser_ctx.pass == 2)
1311 <  {
1362 <    if (not_atom) ClearConfEncrypted(yy_aconf);
1363 <    else SetConfEncrypted(yy_aconf);
1364 <  }
1311 >    yy_aconf->port |= OPER_FLAG_MODULE;
1312   };
1313  
1314  
# Line 1375 | Line 1322 | class_entry: CLASS
1322      yy_conf = make_conf_item(CLASS_TYPE);
1323      yy_class = map_to_conf(yy_conf);
1324    }
1325 < } class_name_b '{' class_items '}' ';'
1325 > } '{' class_items '}' ';'
1326   {
1327    if (conf_parser_ctx.pass == 1)
1328    {
# Line 1386 | Line 1333 | class_entry: CLASS
1333        delete_conf_item(yy_conf);
1334      else
1335      {
1336 <      cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1336 >      cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1337  
1338        if (cconf != NULL)                /* The class existed already */
1339        {
# Line 1418 | Line 1365 | class_entry: CLASS
1365    }
1366   };
1367  
1421 class_name_b: | class_name_t;
1422
1368   class_items:    class_items class_item | class_item;
1369   class_item:     class_name |
1370                  class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
# Line 1444 | Line 1389 | class_name: NAME '=' QSTRING ';'
1389    }
1390   };
1391  
1447 class_name_t: QSTRING
1448 {
1449  if (conf_parser_ctx.pass == 1)
1450  {
1451    MyFree(yy_class_name);
1452    DupString(yy_class_name, yylval.string);
1453  }
1454 };
1455
1392   class_ping_time: PING_TIME '=' timespec ';'
1393   {
1394    if (conf_parser_ctx.pass == 1)
1395 <    PingFreq(yy_class) = $3;
1395 >    yy_class->ping_freq = $3;
1396   };
1397  
1398   class_ping_warning: PING_WARNING '=' timespec ';'
1399   {
1400    if (conf_parser_ctx.pass == 1)
1401 <    PingWarning(yy_class) = $3;
1401 >    yy_class->ping_warning = $3;
1402   };
1403  
1404   class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1405   {
1406    if (conf_parser_ctx.pass == 1)
1407 <    MaxPerIp(yy_class) = $3;
1407 >    yy_class->max_perip = $3;
1408   };
1409  
1410   class_connectfreq: CONNECTFREQ '=' timespec ';'
1411   {
1412    if (conf_parser_ctx.pass == 1)
1413 <    ConFreq(yy_class) = $3;
1413 >    yy_class->con_freq = $3;
1414   };
1415  
1416   class_max_number: MAX_NUMBER '=' NUMBER ';'
1417   {
1418    if (conf_parser_ctx.pass == 1)
1419 <    MaxTotal(yy_class) = $3;
1419 >    yy_class->max_total = $3;
1420   };
1421  
1422   class_max_global: MAX_GLOBAL '=' NUMBER ';'
1423   {
1424    if (conf_parser_ctx.pass == 1)
1425 <    MaxGlobal(yy_class) = $3;
1425 >    yy_class->max_global = $3;
1426   };
1427  
1428   class_max_local: MAX_LOCAL '=' NUMBER ';'
1429   {
1430    if (conf_parser_ctx.pass == 1)
1431 <    MaxLocal(yy_class) = $3;
1431 >    yy_class->max_local = $3;
1432   };
1433  
1434   class_max_ident: MAX_IDENT '=' NUMBER ';'
1435   {
1436    if (conf_parser_ctx.pass == 1)
1437 <    MaxIdent(yy_class) = $3;
1437 >    yy_class->max_ident = $3;
1438   };
1439  
1440   class_sendq: SENDQ '=' sizespec ';'
1441   {
1442    if (conf_parser_ctx.pass == 1)
1443 <    MaxSendq(yy_class) = $3;
1443 >    yy_class->max_sendq = $3;
1444   };
1445  
1446   class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1447   {
1448    if (conf_parser_ctx.pass == 1)
1449 <    CidrBitlenIPV4(yy_class) = $3;
1449 >    yy_class->cidr_bitlen_ipv4 = $3;
1450   };
1451  
1452   class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1453   {
1454    if (conf_parser_ctx.pass == 1)
1455 <    CidrBitlenIPV6(yy_class) = $3;
1455 >    yy_class->cidr_bitlen_ipv6 = $3;
1456   };
1457  
1458   class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1459   {
1460    if (conf_parser_ctx.pass == 1)
1461 <    NumberPerCidr(yy_class) = $3;
1461 >    yy_class->number_per_cidr = $3;
1462   };
1463  
1464   /***************************************************************************
# Line 1777 | Line 1713 | auth_flags: IRCD_FLAGS
1713   } '='  auth_flags_items ';';
1714  
1715   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1716 < auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom
1781 <                | { not_atom = 0; } auth_flags_item_atom;
1782 <
1783 < auth_flags_item_atom: SPOOF_NOTICE
1716 > auth_flags_item: SPOOF_NOTICE
1717   {
1718    if (conf_parser_ctx.pass == 2)
1719 <  {
1787 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1788 <    else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1789 <  }
1719 >    yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1720   } | EXCEED_LIMIT
1721   {
1722    if (conf_parser_ctx.pass == 2)
1723 <  {
1794 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1795 <    else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1796 <  }
1723 >    yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1724   } | KLINE_EXEMPT
1725   {
1726    if (conf_parser_ctx.pass == 2)
1727 <  {
1801 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1802 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1803 <  }
1727 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1728   } | NEED_IDENT
1729   {
1730    if (conf_parser_ctx.pass == 2)
1731 <  {
1808 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1809 <    else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1810 <  }
1731 >    yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1732   } | CAN_FLOOD
1733   {
1734    if (conf_parser_ctx.pass == 2)
1735 <  {
1815 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
1816 <    else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1817 <  }
1735 >    yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1736   } | NO_TILDE
1737   {
1738    if (conf_parser_ctx.pass == 2)
1739 <  {
1822 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
1823 <    else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1824 <  }
1739 >    yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1740   } | GLINE_EXEMPT
1741   {
1742    if (conf_parser_ctx.pass == 2)
1743 <  {
1829 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
1830 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1831 <  }
1743 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1744   } | RESV_EXEMPT
1745   {
1746    if (conf_parser_ctx.pass == 2)
1747 <  {
1836 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
1837 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1838 <  }
1747 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1748   } | NEED_PASSWORD
1749   {
1750    if (conf_parser_ctx.pass == 2)
1751 <  {
1843 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
1844 <    else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1845 <  }
1751 >    yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1752   };
1753  
1754   /* XXX - need check for illegal hostnames here */
# Line 1859 | Line 1765 | auth_spoof: SPOOF '=' QSTRING ';'
1765      }
1766      else
1767      {
1768 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1768 >      ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1769        yy_conf->name = NULL;
1770      }
1771    }
# Line 2025 | Line 1931 | shared_type_item: KLINE
1931   {
1932    if (conf_parser_ctx.pass == 2)
1933      yy_match_item->action |= SHARED_KLINE;
2028 } | TKLINE
2029 {
2030  if (conf_parser_ctx.pass == 2)
2031    yy_match_item->action |= SHARED_TKLINE;
1934   } | UNKLINE
1935   {
1936    if (conf_parser_ctx.pass == 2)
1937      yy_match_item->action |= SHARED_UNKLINE;
1938 < } | XLINE
1938 > } | T_DLINE
1939   {
1940    if (conf_parser_ctx.pass == 2)
1941 <    yy_match_item->action |= SHARED_XLINE;
1942 < } | TXLINE
1941 >    yy_match_item->action |= SHARED_DLINE;
1942 > } | T_UNDLINE
1943 > {
1944 >  if (conf_parser_ctx.pass == 2)
1945 >    yy_match_item->action |= SHARED_UNDLINE;
1946 > } | XLINE
1947   {
1948    if (conf_parser_ctx.pass == 2)
1949 <    yy_match_item->action |= SHARED_TXLINE;
1949 >    yy_match_item->action |= SHARED_XLINE;
1950   } | T_UNXLINE
1951   {
1952    if (conf_parser_ctx.pass == 2)
# Line 2049 | Line 1955 | shared_type_item: KLINE
1955   {
1956    if (conf_parser_ctx.pass == 2)
1957      yy_match_item->action |= SHARED_RESV;
2052 } | TRESV
2053 {
2054  if (conf_parser_ctx.pass == 2)
2055    yy_match_item->action |= SHARED_TRESV;
1958   } | T_UNRESV
1959   {
1960    if (conf_parser_ctx.pass == 2)
# Line 2107 | Line 2009 | cluster_type_item: KLINE
2009   {
2010    if (conf_parser_ctx.pass == 2)
2011      yy_conf->flags |= SHARED_KLINE;
2110 } | TKLINE
2111 {
2112  if (conf_parser_ctx.pass == 2)
2113    yy_conf->flags |= SHARED_TKLINE;
2012   } | UNKLINE
2013   {
2014    if (conf_parser_ctx.pass == 2)
2015      yy_conf->flags |= SHARED_UNKLINE;
2016 < } | XLINE
2016 > } | T_DLINE
2017   {
2018    if (conf_parser_ctx.pass == 2)
2019 <    yy_conf->flags |= SHARED_XLINE;
2020 < } | TXLINE
2019 >    yy_conf->flags |= SHARED_DLINE;
2020 > } | T_UNDLINE
2021 > {
2022 >  if (conf_parser_ctx.pass == 2)
2023 >    yy_conf->flags |= SHARED_UNDLINE;
2024 > } | XLINE
2025   {
2026    if (conf_parser_ctx.pass == 2)
2027 <    yy_conf->flags |= SHARED_TXLINE;
2027 >    yy_conf->flags |= SHARED_XLINE;
2028   } | T_UNXLINE
2029   {
2030    if (conf_parser_ctx.pass == 2)
# Line 2131 | Line 2033 | cluster_type_item: KLINE
2033   {
2034    if (conf_parser_ctx.pass == 2)
2035      yy_conf->flags |= SHARED_RESV;
2134 } | TRESV
2135 {
2136  if (conf_parser_ctx.pass == 2)
2137    yy_conf->flags |= SHARED_TRESV;
2036   } | T_UNRESV
2037   {
2038    if (conf_parser_ctx.pass == 2)
# Line 2157 | Line 2055 | connect_entry: CONNECT
2055    if (conf_parser_ctx.pass == 2)
2056    {
2057      yy_conf = make_conf_item(SERVER_TYPE);
2058 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2059 <    yy_aconf->passwd = NULL;
2058 >    yy_aconf = map_to_conf(yy_conf);
2059 >
2060      /* defaults */
2061      yy_aconf->port = PORTNUM;
2164
2165    if (ConfigFileEntry.burst_away)
2166      yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2062    }
2063    else
2064    {
2065      MyFree(class_name);
2066      class_name = NULL;
2067    }
2068 < } connect_name_b '{' connect_items '}' ';'
2068 > } '{' connect_items '}' ';'
2069   {
2070    if (conf_parser_ctx.pass == 2)
2071    {
2072      struct CollectItem *yy_hconf=NULL;
2073      struct CollectItem *yy_lconf=NULL;
2074 <    dlink_node *ptr;
2075 <    dlink_node *next_ptr;
2181 < #ifdef HAVE_LIBCRYPTO
2074 >    dlink_node *ptr = NULL, *next_ptr = NULL;
2075 >
2076      if (yy_aconf->host &&
2077 <        ((yy_aconf->passwd && yy_aconf->spasswd) ||
2078 <         (yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf))))
2079 < #else /* !HAVE_LIBCRYPTO */
2080 <      if (yy_aconf->host && !IsConfCryptLink(yy_aconf) &&
2081 <          yy_aconf->passwd && yy_aconf->spasswd)
2082 < #endif /* !HAVE_LIBCRYPTO */
2083 <        {
2084 <          if (conf_add_server(yy_conf, class_name) == -1)
2085 <          {
2086 <            delete_conf_item(yy_conf);
2087 <            yy_conf = NULL;
2088 <            yy_aconf = NULL;
2089 <          }
2090 <        }
2091 <        else
2198 <        {
2199 <          /* Even if yy_conf ->name is NULL
2200 <           * should still unhook any hub/leaf confs still pending
2201 <           */
2202 <          unhook_hub_leaf_confs();
2203 <
2204 <          if (yy_conf->name != NULL)
2205 <          {
2206 < #ifndef HAVE_LIBCRYPTO
2207 <            if (IsConfCryptLink(yy_aconf))
2208 <              yyerror("Ignoring connect block -- no OpenSSL support");
2209 < #else
2210 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2211 <              yyerror("Ignoring connect block -- missing key");
2212 < #endif
2213 <            if (yy_aconf->host == NULL)
2214 <              yyerror("Ignoring connect block -- missing host");
2215 <            else if (!IsConfCryptLink(yy_aconf) &&
2216 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2217 <              yyerror("Ignoring connect block -- missing password");
2218 <          }
2219 <
2220 <
2221 <          /* XXX
2222 <           * This fixes a try_connections() core (caused by invalid class_ptr
2223 <           * pointers) reported by metalrock. That's an ugly fix, but there
2224 <           * is currently no better way. The entire config subsystem needs an
2225 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2226 <           * a doubly linked list immediately without any sanity checks!  -Michael
2227 <           */
2228 <          delete_conf_item(yy_conf);
2077 >        yy_aconf->passwd && yy_aconf->spasswd)
2078 >    {
2079 >      if (conf_add_server(yy_conf, class_name) == -1)
2080 >      {
2081 >        delete_conf_item(yy_conf);
2082 >        yy_conf = NULL;
2083 >        yy_aconf = NULL;
2084 >      }
2085 >    }
2086 >    else
2087 >    {
2088 >      /* Even if yy_conf ->name is NULL
2089 >       * should still unhook any hub/leaf confs still pending
2090 >       */
2091 >      unhook_hub_leaf_confs();
2092  
2093 <          yy_aconf = NULL;
2094 <          yy_conf = NULL;
2095 <        }
2093 >      if (yy_conf->name != NULL)
2094 >      {
2095 >        if (yy_aconf->host == NULL)
2096 >          yyerror("Ignoring connect block -- missing host");
2097 >        else if (!yy_aconf->passwd || !yy_aconf->spasswd)
2098 >          yyerror("Ignoring connect block -- missing password");
2099 >      }
2100 >
2101 >
2102 >      /* XXX
2103 >       * This fixes a try_connections() core (caused by invalid class_ptr
2104 >       * pointers) reported by metalrock. That's an ugly fix, but there
2105 >       * is currently no better way. The entire config subsystem needs an
2106 >       * rewrite ASAP. make_conf_item() shouldn't really add things onto
2107 >       * a doubly linked list immediately without any sanity checks!  -Michael
2108 >       */
2109 >      delete_conf_item(yy_conf);
2110 >
2111 >      yy_aconf = NULL;
2112 >      yy_conf = NULL;
2113 >    }
2114  
2115        /*
2116         * yy_conf is still pointing at the server that is having
# Line 2298 | Line 2179 | connect_entry: CONNECT
2179    }
2180   };
2181  
2301 connect_name_b: | connect_name_t;
2182   connect_items:  connect_items connect_item | connect_item;
2183   connect_item:   connect_name | connect_host | connect_vhost |
2184                  connect_send_password | connect_accept_password |
2185 <                connect_aftype | connect_port |
2185 >                connect_aftype | connect_port | connect_ssl_cipher_list |
2186                  connect_flags | connect_hub_mask | connect_leaf_mask |
2187 <                connect_class | connect_encrypted |
2308 <                connect_rsa_public_key_file | connect_cipher_preference |
2187 >                connect_class | connect_encrypted |
2188                  error ';' ;
2189  
2190   connect_name: NAME '=' QSTRING ';'
2191   {
2192    if (conf_parser_ctx.pass == 2)
2193    {
2315    if (yy_conf->name != NULL)
2316      yyerror("Multiple connect name entry");
2317
2318    MyFree(yy_conf->name);
2319    DupString(yy_conf->name, yylval.string);
2320  }
2321 };
2322
2323 connect_name_t: QSTRING
2324 {
2325  if (conf_parser_ctx.pass == 2)
2326  {
2327    if (yy_conf->name != NULL)
2328      yyerror("Multiple connect name entry");
2329
2194      MyFree(yy_conf->name);
2195      DupString(yy_conf->name, yylval.string);
2196    }
# Line 2354 | Line 2218 | connect_vhost: VHOST '=' QSTRING ';'
2218      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2219  
2220      if (getaddrinfo(yylval.string, NULL, &hints, &res))
2221 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2221 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2222      else
2223      {
2224        assert(res != NULL);
# Line 2426 | Line 2290 | connect_flags: IRCD_FLAGS
2290   } '='  connect_flags_items ';';
2291  
2292   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2293 < connect_flags_item: NOT  { not_atom = 1; } connect_flags_item_atom
2430 <                        |  { not_atom = 0; } connect_flags_item_atom;
2431 <
2432 < connect_flags_item_atom: COMPRESSED
2433 < {
2434 <  if (conf_parser_ctx.pass == 2)
2435 < #ifndef HAVE_LIBZ
2436 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2437 < #else
2438 < {
2439 <   if (not_atom)ClearConfCompressed(yy_aconf);
2440 <   else SetConfCompressed(yy_aconf);
2441 < }
2442 < #endif
2443 < } | CRYPTLINK
2444 < {
2445 <  if (conf_parser_ctx.pass == 2)
2446 <  {
2447 <    if (not_atom)ClearConfCryptLink(yy_aconf);
2448 <    else SetConfCryptLink(yy_aconf);
2449 <  }
2450 < } | AUTOCONN
2293 > connect_flags_item: AUTOCONN
2294   {
2295    if (conf_parser_ctx.pass == 2)
2296 <  {
2454 <    if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2455 <    else SetConfAllowAutoConn(yy_aconf);
2456 <  }
2296 >    SetConfAllowAutoConn(yy_aconf);
2297   } | BURST_AWAY
2298   {
2299    if (conf_parser_ctx.pass == 2)
2300 <  {
2461 <    if (not_atom)ClearConfAwayBurst(yy_aconf);
2462 <    else SetConfAwayBurst(yy_aconf);
2463 <  }
2300 >    SetConfAwayBurst(yy_aconf);
2301   } | TOPICBURST
2302   {
2303    if (conf_parser_ctx.pass == 2)
2304 <  {
2305 <    if (not_atom)ClearConfTopicBurst(yy_aconf);
2469 <    else SetConfTopicBurst(yy_aconf);
2470 <  }
2471 < }
2472 < ;
2473 <
2474 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2304 >    SetConfTopicBurst(yy_aconf);
2305 > } | T_SSL
2306   {
2476 #ifdef HAVE_LIBCRYPTO
2307    if (conf_parser_ctx.pass == 2)
2308 <  {
2479 <    BIO *file;
2480 <
2481 <    if (yy_aconf->rsa_public_key != NULL)
2482 <    {
2483 <      RSA_free(yy_aconf->rsa_public_key);
2484 <      yy_aconf->rsa_public_key = NULL;
2485 <    }
2486 <
2487 <    if (yy_aconf->rsa_public_key_file != NULL)
2488 <    {
2489 <      MyFree(yy_aconf->rsa_public_key_file);
2490 <      yy_aconf->rsa_public_key_file = NULL;
2491 <    }
2492 <
2493 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2494 <
2495 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2496 <    {
2497 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2498 <      break;
2499 <    }
2500 <
2501 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2502 <
2503 <    if (yy_aconf->rsa_public_key == NULL)
2504 <    {
2505 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2506 <      break;
2507 <    }
2508 <      
2509 <    BIO_set_close(file, BIO_CLOSE);
2510 <    BIO_free(file);
2511 <  }
2512 < #endif /* HAVE_LIBCRYPTO */
2308 >    SetConfSSL(yy_aconf);
2309   };
2310  
2311   connect_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 2558 | Line 2354 | connect_class: CLASS '=' QSTRING ';'
2354    }
2355   };
2356  
2357 < connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2357 > connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2358   {
2359   #ifdef HAVE_LIBCRYPTO
2360    if (conf_parser_ctx.pass == 2)
2361    {
2362 <    struct EncCapability *ecap;
2363 <    const char *cipher_name;
2568 <    int found = 0;
2569 <
2570 <    yy_aconf->cipher_preference = NULL;
2571 <    cipher_name = yylval.string;
2572 <
2573 <    for (ecap = CipherTable; ecap->name; ecap++)
2574 <    {
2575 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2576 <          (ecap->cap & CAP_ENC_MASK))
2577 <      {
2578 <        yy_aconf->cipher_preference = ecap;
2579 <        found = 1;
2580 <        break;
2581 <      }
2582 <    }
2583 <
2584 <    if (!found)
2585 <      yyerror("Invalid cipher");
2362 >    MyFree(yy_aconf->cipher_list);
2363 >    DupString(yy_aconf->cipher_list, yylval.string);
2364    }
2365   #else
2366    if (conf_parser_ctx.pass == 2)
2367 <    yyerror("Ignoring cipher_preference -- no OpenSSL support");
2367 >    yyerror("Ignoring connect::ciphers -- no OpenSSL support");
2368   #endif
2369   };
2370  
2371 +
2372   /***************************************************************************
2373   *  section kill
2374   ***************************************************************************/
# Line 2616 | Line 2395 | kill_entry: KILL
2395          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2396              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2397          {
2398 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2398 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2399                 errptr);
2400            break;
2401          }
# Line 2633 | Line 2412 | kill_entry: KILL
2412          else
2413            DupString(yy_aconf->reason, "No reason");
2414   #else
2415 <        ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support");
2415 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2416          break;
2417   #endif
2418        }
2419        else
2420        {
2421 +        find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
2422 +
2423          yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2424  
2425          DupString(yy_aconf->user, userbuf);
# Line 2648 | Line 2429 | kill_entry: KILL
2429            DupString(yy_aconf->reason, reasonbuf);
2430          else
2431            DupString(yy_aconf->reason, "No reason");
2432 <        add_conf_by_address(CONF_KILL, yy_aconf);
2432 >        add_conf_by_address(CONF_KLINE, yy_aconf);
2433        }
2434      }
2435  
# Line 2708 | Line 2489 | deny_entry: DENY
2489    {
2490      if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2491      {
2492 +      find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
2493 +
2494        yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2495        DupString(yy_aconf->host, hostbuf);
2496  
# Line 2783 | Line 2566 | gecos_entry: GECOS
2566  
2567          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2568          {
2569 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
2569 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2570                 errptr);
2571            break;
2572          }
# Line 2791 | Line 2574 | gecos_entry: GECOS
2574          yy_conf = make_conf_item(RXLINE_TYPE);
2575          yy_conf->regexpname = exp_p;
2576   #else
2577 <        ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support");
2577 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2578          break;
2579   #endif
2580        }
# Line 2861 | Line 2644 | general_item:       general_hide_spoof_i
2644                      general_oper_umodes | general_caller_id_wait |
2645                      general_opers_bypass_callerid | general_default_floodcount |
2646                      general_min_nonwildcard | general_min_nonwildcard_simple |
2647 <                    general_servlink_path | general_disable_remote_commands |
2648 <                    general_default_cipher_preference |
2866 <                    general_compression_level | general_client_flood |
2647 >                    general_disable_remote_commands |
2648 >                    general_client_flood |
2649                      general_throttle_time | general_havent_read_conf |
2650                      general_ping_cookie |
2651 <                    general_disable_auth | general_burst_away |
2651 >                    general_disable_auth |
2652                      general_tkline_expire_notices | general_gline_min_cidr |
2653                      general_gline_min_cidr6 | general_use_whois_actually |
2654                      general_reject_hold_time | general_stats_e_disabled |
# Line 2889 | Line 2671 | general_gline_min_cidr6: GLINE_MIN_CIDR6
2671    ConfigFileEntry.gline_min_cidr6 = $3;
2672   };
2673  
2892 general_burst_away: BURST_AWAY '=' TBOOL ';'
2893 {
2894  ConfigFileEntry.burst_away = yylval.number;
2895 };
2896
2674   general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2675   {
2676    ConfigFileEntry.use_whois_actually = yylval.number;
# Line 2974 | Line 2751 | general_havent_read_conf: HAVENT_READ_CO
2751   {
2752    if (($3 > 0) && conf_parser_ctx.pass == 1)
2753    {
2754 <    ilog(L_CRIT, "You haven't read your config file properly.");
2755 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
2756 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
2754 >    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2755 >    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2756 >    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2757      exit(0);
2758    }
2759   };
# Line 3097 | Line 2874 | general_max_targets: MAX_TARGETS '=' NUM
2874    ConfigFileEntry.max_targets = $3;
2875   };
2876  
3100 general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3101 {
3102  if (conf_parser_ctx.pass == 2)
3103  {
3104    MyFree(ConfigFileEntry.servlink_path);
3105    DupString(ConfigFileEntry.servlink_path, yylval.string);
3106  }
3107 };
3108
3109 general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3110 {
3111 #ifdef HAVE_LIBCRYPTO
3112  if (conf_parser_ctx.pass == 2)
3113  {
3114    struct EncCapability *ecap;
3115    const char *cipher_name;
3116    int found = 0;
3117
3118    ConfigFileEntry.default_cipher_preference = NULL;
3119    cipher_name = yylval.string;
3120
3121    for (ecap = CipherTable; ecap->name; ecap++)
3122    {
3123      if ((irccmp(ecap->name, cipher_name) == 0) &&
3124          (ecap->cap & CAP_ENC_MASK))
3125      {
3126        ConfigFileEntry.default_cipher_preference = ecap;
3127        found = 1;
3128        break;
3129      }
3130    }
3131
3132    if (!found)
3133      yyerror("Invalid cipher");
3134  }
3135 #else
3136  if (conf_parser_ctx.pass == 2)
3137    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3138 #endif
3139 };
3140
3141 general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3142 {
3143  if (conf_parser_ctx.pass == 2)
3144  {
3145    ConfigFileEntry.compression_level = $3;
3146 #ifndef HAVE_LIBZ
3147    yyerror("Ignoring compression_level -- no zlib support");
3148 #else
3149    if ((ConfigFileEntry.compression_level < 1) ||
3150        (ConfigFileEntry.compression_level > 9))
3151    {
3152      yyerror("Ignoring invalid compression_level, using default");
3153      ConfigFileEntry.compression_level = 0;
3154    }
3155 #endif
3156  }
3157 };
3158
2877   general_use_egd: USE_EGD '=' TBOOL ';'
2878   {
2879    ConfigFileEntry.use_egd = yylval.number;
# Line 3218 | Line 2936 | umode_oitem:     T_BOTS
2936   } | T_FULL
2937   {
2938    ConfigFileEntry.oper_umodes |= UMODE_FULL;
2939 + } | HIDDEN
2940 + {
2941 +  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2942   } | T_SKILL
2943   {
2944    ConfigFileEntry.oper_umodes |= UMODE_SKILL;
# Line 3286 | Line 3007 | umode_item:    T_BOTS
3007   } | T_SKILL
3008   {
3009    ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
3010 + } | HIDDEN
3011 + {
3012 +  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
3013   } | T_NCHANGE
3014   {
3015    ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
# Line 3393 | Line 3117 | gline_duration: DURATION '=' timespec ';
3117      ConfigFileEntry.gline_time = $3;
3118   };
3119  
3120 < gline_logging: LOGGING
3120 > gline_logging: T_LOG
3121   {
3122    if (conf_parser_ctx.pass == 2)
3123      ConfigFileEntry.gline_logging = 0;

Diff Legend

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