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-7.3/src/ircd_parser.y (file contents), Revision 1121 by michael, Sun Jan 9 11:03:03 2011 UTC vs.
ircd-hybrid-8/src/ircd_parser.y (file contents), Revision 1306 by michael, Sat Mar 24 07:43:04 2012 UTC

# Line 37 | Line 37
37   #include "s_log.h"
38   #include "client.h"     /* for UMODE_ALL only */
39   #include "irc_string.h"
40 – #include "irc_getaddrinfo.h"
40   #include "sprintf_irc.h"
41   #include "memory.h"
42   #include "modules.h"
# Line 53 | 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   static char *class_name = NULL;
# Line 71 | Line 71 | static char userbuf[IRCD_BUFSIZE];
71   static char hostbuf[IRCD_BUFSIZE];
72   static char reasonbuf[REASONLEN + 1];
73   static char gecos_name[REALLEN * 4];
74 <
74 > static char lfile[IRCD_BUFSIZE];
75 > static unsigned int ltype = 0;
76 > static unsigned int lsize = 0;
77   static char *resv_reason = NULL;
78   static char *listener_address = NULL;
77 – static int not_atom = 0;
79  
80   struct CollectItem
81   {
# Line 148 | Line 149 | unhook_hub_leaf_confs(void)
149   %token  BYTES KBYTES MBYTES GBYTES TBYTES
150   %token  CALLER_ID_WAIT
151   %token  CAN_FLOOD
151 – %token  CAN_IDLE
152   %token  CHANNEL
153   %token  CIDR_BITLEN_IPV4
154   %token  CIDR_BITLEN_IPV6
155 – %token  CIPHER_PREFERENCE
155   %token  CLASS
157 – %token  COMPRESSED
158 – %token  COMPRESSION_LEVEL
156   %token  CONNECT
157   %token  CONNECTFREQ
161 – %token  CRYPTLINK
162 – %token  DEFAULT_CIPHER_PREFERENCE
158   %token  DEFAULT_FLOODCOUNT
159   %token  DEFAULT_SPLIT_SERVER_COUNT
160   %token  DEFAULT_SPLIT_USER_COUNT
# Line 182 | Line 177 | unhook_hub_leaf_confs(void)
177   %token  FAILED_OPER_NOTICE
178   %token  IRCD_FLAGS
179   %token  FLATTEN_LINKS
185 – %token  FFAILED_OPERLOG
186 – %token  FKILLLOG
187 – %token  FKLINELOG
188 – %token  FGLINELOG
189 – %token  FIOERRLOG
190 – %token  FOPERLOG
191 – %token  FOPERSPYLOG
192 – %token  FUSERLOG
180   %token  GECOS
181   %token  GENERAL
182   %token  GLINE
183   %token  GLINES
184   %token  GLINE_EXEMPT
198 – %token  GLINE_LOG
185   %token  GLINE_TIME
186   %token  GLINE_MIN_CIDR
187   %token  GLINE_MIN_CIDR6
# Line 204 | Line 190 | unhook_hub_leaf_confs(void)
190   %token  NEED_IDENT
191   %token  HAVENT_READ_CONF
192   %token  HIDDEN
207 – %token  HIDDEN_ADMIN
193   %token  HIDDEN_NAME
209 – %token  HIDDEN_OPER
194   %token  HIDE_SERVER_IPS
195   %token  HIDE_SERVERS
196   %token  HIDE_SPOOF_IPS
197   %token  HOST
198   %token  HUB
199   %token  HUB_MASK
216 – %token  IDLETIME
200   %token  IGNORE_BOGUS_TS
201   %token  INVISIBLE_ON_CONNECT
202   %token  IP
# Line 229 | Line 212 | unhook_hub_leaf_confs(void)
212   %token  LINKS_DELAY
213   %token  LISTEN
214   %token  T_LOG
232 – %token  LOGGING
233 – %token  LOG_LEVEL
215   %token  MAX_ACCEPT
216   %token  MAX_BANS
217   %token  MAX_CHANS_PER_USER
# Line 257 | Line 238 | unhook_hub_leaf_confs(void)
238   %token  NO_JOIN_ON_SPLIT
239   %token  NO_OPER_FLOOD
240   %token  NO_TILDE
260 – %token  NOT
241   %token  NUMBER
242   %token  NUMBER_PER_IDENT
243   %token  NUMBER_PER_CIDR
# Line 265 | Line 245 | unhook_hub_leaf_confs(void)
245   %token  NUMBER_PER_IP_GLOBAL
246   %token  OPERATOR
247   %token  OPERS_BYPASS_CALLERID
268 – %token  OPER_LOG
248   %token  OPER_ONLY_UMODES
249   %token  OPER_PASS_RESV
250   %token  OPER_SPY_T
# Line 295 | Line 274 | unhook_hub_leaf_confs(void)
274   %token  RSA_PRIVATE_KEY_FILE
275   %token  RSA_PUBLIC_KEY_FILE
276   %token  SSL_CERTIFICATE_FILE
277 + %token  SSL_DH_PARAM_FILE
278   %token  T_SSL_CONNECTION_METHOD
279   %token  T_SSLV3
280   %token  T_TLSV1
# Line 305 | Line 285 | unhook_hub_leaf_confs(void)
285   %token  SEND_PASSWORD
286   %token  SERVERHIDE
287   %token  SERVERINFO
308 – %token  SERVLINK_PATH
288   %token  IRCD_SID
289   %token  TKLINE_EXPIRE_NOTICES
290   %token  T_SHARED
# Line 332 | Line 311 | unhook_hub_leaf_confs(void)
311   %token  T_CALLERID
312   %token  T_CCONN
313   %token  T_CCONN_FULL
314 + %token  T_SSL_CIPHER_LIST
315   %token  T_CLIENT_FLOOD
316   %token  T_DEAF
317   %token  T_DEBUG
318 + %token  T_DLINE
319   %token  T_DRONE
320   %token  T_EXTERNAL
321   %token  T_FULL
# Line 342 | Line 323 | unhook_hub_leaf_confs(void)
323   %token  T_IPV4
324   %token  T_IPV6
325   %token  T_LOCOPS
345 – %token  T_LOGPATH
346 – %token  T_L_CRIT
347 – %token  T_L_DEBUG
348 – %token  T_L_ERROR
349 – %token  T_L_INFO
350 – %token  T_L_NOTICE
351 – %token  T_L_TRACE
352 – %token  T_L_WARN
326   %token  T_MAX_CLIENTS
327   %token  T_NCHANGE
328   %token  T_OPERWALL
# Line 361 | Line 334 | unhook_hub_leaf_confs(void)
334   %token  T_SSL
335   %token  T_UMODES
336   %token  T_UNAUTH
337 + %token  T_UNDLINE
338 + %token  T_UNLIMITED
339   %token  T_UNRESV
340   %token  T_UNXLINE
341 + %token  T_GLOBOPS
342   %token  T_WALLOP
343 + %token  T_RESTART
344 + %token  T_SERVICE
345 + %token  T_SERVICES_NAME
346 + %token  T_TIMESTAMP
347   %token  THROTTLE_TIME
348   %token  TOPICBURST
349   %token  TRUE_NO_OPER_FLOOD
# Line 383 | Line 363 | unhook_hub_leaf_confs(void)
363   %token  XLINE
364   %token  WARN
365   %token  WARN_NO_NLINE
366 + %token  T_SIZE
367 + %token  T_FILE
368  
369   %type <string> QSTRING
370   %type <number> NUMBER
# Line 406 | Line 388 | conf_item:        admin_entry
388                  | serverinfo_entry
389                  | serverhide_entry
390                  | resv_entry
391 +                | service_entry
392                  | shared_entry
393                  | cluster_entry
394                  | connect_entry
# Line 484 | Line 467 | serverinfo_items:       serverinfo_items
467   serverinfo_item:        serverinfo_name | serverinfo_vhost |
468                          serverinfo_hub | serverinfo_description |
469                          serverinfo_network_name | serverinfo_network_desc |
470 <                        serverinfo_max_clients |
470 >                        serverinfo_max_clients | serverinfo_ssl_dh_param_file |
471                          serverinfo_rsa_private_key_file | serverinfo_vhost6 |
472                          serverinfo_sid | serverinfo_ssl_certificate_file |
473 <                        serverinfo_ssl_connection_method |
473 >                        serverinfo_ssl_connection_method | serverinfo_ssl_cipher_list |
474                          error ';' ;
475  
476  
# Line 503 | Line 486 | serverinfo_ssl_connection_method: T_SSL_
486    if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
487    {
488      if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
489 +    {
490        SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
491 +      SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
492 +    }
493 +
494      if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
495 +    {
496        SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
497 +      SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
498 +    }
499    }
500   #endif
501   };
# Line 537 | Line 527 | serverinfo_ssl_certificate_file: SSL_CER
527      }
528  
529      if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
530 +                                     SSL_FILETYPE_PEM) <= 0 ||
531 +        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
532                                       SSL_FILETYPE_PEM) <= 0)
533      {
534        yyerror(ERR_lib_error_string(ERR_get_error()));
# Line 544 | Line 536 | serverinfo_ssl_certificate_file: SSL_CER
536      }
537  
538      if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
539 +                                    SSL_FILETYPE_PEM) <= 0 ||
540 +        SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
541                                      SSL_FILETYPE_PEM) <= 0)
542      {
543        yyerror(ERR_lib_error_string(ERR_get_error()));
544        break;
545      }
546  
547 <    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx))
547 >    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
548 >        !SSL_CTX_check_private_key(ServerInfo.client_ctx))
549      {
550        yyerror(ERR_lib_error_string(ERR_get_error()));
551        break;
# Line 586 | Line 581 | serverinfo_rsa_private_key_file: RSA_PRI
581        break;
582      }
583  
584 <    ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL,
590 <      0, NULL);
584 >    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
585  
586      BIO_set_close(file, BIO_CLOSE);
587      BIO_free(file);
# Line 619 | Line 613 | serverinfo_rsa_private_key_file: RSA_PRI
613   #endif
614   };
615  
616 + serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
617 + {
618 + /* TBD - XXX: error reporting */
619 + #ifdef HAVE_LIBCRYPTO
620 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
621 +  {
622 +    BIO *file = BIO_new_file(yylval.string, "r");
623 +
624 +    if (file)
625 +    {
626 +      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
627 +
628 +      BIO_free(file);
629 +
630 +      if (dh)
631 +      {
632 +        SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
633 +        DH_free(dh);
634 +      }
635 +    }
636 +  }
637 + #endif
638 + };
639 +
640 + serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
641 + {
642 + #ifdef HAVE_LIBCRYPTO
643 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
644 +  {
645 +    SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
646 +  }
647 + #endif
648 + };
649 +
650   serverinfo_name: NAME '=' QSTRING ';'
651   {
652    /* this isn't rehashable */
# Line 628 | Line 656 | serverinfo_name: NAME '=' QSTRING ';'
656        DupString(ServerInfo.name, yylval.string);
657      else
658      {
659 <      ilog(L_ERROR, "Ignoring serverinfo::name -- invalid name. Aborting.");
659 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
660        exit(0);
661      }
662    }
# Line 643 | Line 671 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
671        DupString(ServerInfo.sid, yylval.string);
672      else
673      {
674 <      ilog(L_ERROR, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
674 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
675        exit(0);
676      }
677    }
# Line 693 | Line 721 | serverinfo_vhost: VHOST '=' QSTRING ';'
721      hints.ai_socktype = SOCK_STREAM;
722      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
723  
724 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
725 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
724 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
725 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
726      else
727      {
728        assert(res != NULL);
# Line 702 | Line 730 | serverinfo_vhost: VHOST '=' QSTRING ';'
730        memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
731        ServerInfo.ip.ss.ss_family = res->ai_family;
732        ServerInfo.ip.ss_len = res->ai_addrlen;
733 <      irc_freeaddrinfo(res);
733 >      freeaddrinfo(res);
734  
735        ServerInfo.specific_ipv4_vhost = 1;
736      }
# Line 722 | Line 750 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
750      hints.ai_socktype = SOCK_STREAM;
751      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
752  
753 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
754 <      ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
753 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
754 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
755      else
756      {
757        assert(res != NULL);
# Line 731 | Line 759 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
759        memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
760        ServerInfo.ip6.ss.ss_family = res->ai_family;
761        ServerInfo.ip6.ss_len = res->ai_addrlen;
762 <      irc_freeaddrinfo(res);
762 >      freeaddrinfo(res);
763  
764        ServerInfo.specific_ipv6_vhost = 1;
765      }
# Line 807 | Line 835 | admin_description: DESCRIPTION '=' QSTRI
835   /***************************************************************************
836   *  section logging
837   ***************************************************************************/
838 < /* XXX */
839 < logging_entry:          LOGGING  '{' logging_items '}' ';' ;
838 > logging_entry:          T_LOG  '{' logging_items '}' ';' ;
839 > logging_items:          logging_items logging_item | logging_item ;
840  
841 < logging_items:          logging_items logging_item |
814 <                        logging_item ;
815 <
816 < 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 |
841 > logging_item:           logging_use_logging | logging_timestamp | logging_file_entry |
842                          error ';' ;
843  
844 < logging_path:           T_LOGPATH '=' QSTRING ';'
826 <                        {
827 <                        };
828 <
829 < logging_oper_log:       OPER_LOG '=' QSTRING ';'
830 <                        {
831 <                        };
832 <
833 < logging_fuserlog: FUSERLOG '=' QSTRING ';'
844 > logging_use_logging: USE_LOGGING '=' TBOOL ';'
845   {
846    if (conf_parser_ctx.pass == 2)
847 <    strlcpy(ConfigLoggingEntry.userlog, yylval.string,
837 <            sizeof(ConfigLoggingEntry.userlog));
847 >    ConfigLoggingEntry.use_logging = yylval.number;
848   };
849  
850 < logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
850 > logging_timestamp: T_TIMESTAMP '=' TBOOL ';'
851   {
852    if (conf_parser_ctx.pass == 2)
853 <    strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
844 <            sizeof(ConfigLoggingEntry.failed_operlog));
853 >    ConfigLoggingEntry.timestamp = yylval.number;
854   };
855  
856 < logging_foperlog: FOPERLOG '=' QSTRING ';'
856 > logging_file_entry:
857   {
858 <  if (conf_parser_ctx.pass == 2)
859 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
860 <            sizeof(ConfigLoggingEntry.operlog));
861 < };
853 <
854 < logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
858 >  lfile[0] = '\0';
859 >  ltype = 0;
860 >  lsize = 0;
861 > } T_FILE  '{' logging_file_items '}' ';'
862   {
863 <  if (conf_parser_ctx.pass == 2)
864 <    strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
858 <            sizeof(ConfigLoggingEntry.operspylog));
863 >  if (conf_parser_ctx.pass == 2 && ltype > 0)
864 >    log_add_file(ltype, lsize, lfile);
865   };
866  
867 < logging_fglinelog: FGLINELOG '=' QSTRING ';'
868 < {
869 <  if (conf_parser_ctx.pass == 2)
870 <    strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
871 <            sizeof(ConfigLoggingEntry.glinelog));
866 < };
867 > logging_file_items: logging_file_items logging_file_item |
868 >                    logging_file_item ;
869 >
870 > logging_file_item:  logging_file_name | logging_file_type |
871 >                    logging_file_size | error ';' ;
872  
873 < logging_fklinelog: FKLINELOG '=' QSTRING ';'
873 > logging_file_name: NAME '=' QSTRING ';'
874   {
875 <  if (conf_parser_ctx.pass == 2)
876 <    strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
872 <            sizeof(ConfigLoggingEntry.klinelog));
873 < };
875 >  strlcpy(lfile, yylval.string, sizeof(lfile));
876 > }
877  
878 < logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
878 > logging_file_size: T_SIZE '=' sizespec ';'
879   {
880 <  if (conf_parser_ctx.pass == 2)
881 <    strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
882 <            sizeof(ConfigLoggingEntry.ioerrlog));
880 >  lsize = $3;
881 > } | T_SIZE '=' T_UNLIMITED ';'
882 > {
883 >  lsize = 0;
884   };
885  
886 < logging_killlog: FKILLLOG '=' QSTRING ';'
886 > logging_file_type: TYPE
887   {
888    if (conf_parser_ctx.pass == 2)
889 <    strlcpy(ConfigLoggingEntry.killlog, yylval.string,
890 <            sizeof(ConfigLoggingEntry.killlog));
887 < };
889 >    ltype = 0;
890 > } '='  logging_file_type_items ';' ;
891  
892 < logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
893 < {
891 <  if (conf_parser_ctx.pass == 2)
892 <    set_log_level(L_CRIT);
893 < } | LOG_LEVEL '=' T_L_ERROR ';'
892 > logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
893 > logging_file_type_item:  USER
894   {
895    if (conf_parser_ctx.pass == 2)
896 <    set_log_level(L_ERROR);
897 < } | LOG_LEVEL '=' T_L_WARN ';'
896 >    ltype = LOG_TYPE_USER;
897 > } | OPERATOR
898   {
899    if (conf_parser_ctx.pass == 2)
900 <    set_log_level(L_WARN);
901 < } | LOG_LEVEL '=' T_L_NOTICE ';'
900 >    ltype = LOG_TYPE_OPER;
901 > } | GLINE
902   {
903    if (conf_parser_ctx.pass == 2)
904 <    set_log_level(L_NOTICE);
905 < } | LOG_LEVEL '=' T_L_TRACE ';'
904 >    ltype = LOG_TYPE_GLINE;
905 > } | T_DLINE
906   {
907    if (conf_parser_ctx.pass == 2)
908 <    set_log_level(L_TRACE);
909 < } | LOG_LEVEL '=' T_L_INFO ';'
908 >    ltype = LOG_TYPE_DLINE;
909 > } | KLINE
910   {
911    if (conf_parser_ctx.pass == 2)
912 <    set_log_level(L_INFO);
913 < } | LOG_LEVEL '=' T_L_DEBUG ';'
912 >    ltype = LOG_TYPE_KLINE;
913 > } | KILL
914   {
915    if (conf_parser_ctx.pass == 2)
916 <    set_log_level(L_DEBUG);
917 < };
918 <
919 < logging_use_logging: USE_LOGGING '=' TBOOL ';'
916 >    ltype = LOG_TYPE_KILL;
917 > } | T_DEBUG
918   {
919    if (conf_parser_ctx.pass == 2)
920 <    ConfigLoggingEntry.use_logging = yylval.number;
920 >    ltype = LOG_TYPE_DEBUG;
921   };
922  
923 +
924   /***************************************************************************
925   * section oper
926   ***************************************************************************/
# Line 938 | Line 937 | oper_entry: OPERATOR
937      MyFree(class_name);
938      class_name = NULL;
939    }
940 < } oper_name_b '{' oper_items '}' ';'
940 > } '{' oper_items '}' ';'
941   {
942    if (conf_parser_ctx.pass == 2)
943    {
# Line 973 | Line 972 | oper_entry: OPERATOR
972          DupString(new_aconf->host, yy_tmp->host);
973        else
974          DupString(new_aconf->host, "*");
975 +
976 +      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->ipnum,
977 +                                     &new_aconf->bits);
978 +
979        conf_add_class_to_conf(new_conf, class_name);
980        if (yy_aconf->passwd != NULL)
981          DupString(new_aconf->passwd, yy_aconf->passwd);
# Line 1019 | Line 1022 | oper_entry: OPERATOR
1022    }
1023   };
1024  
1022 – oper_name_b: | oper_name_t;
1025   oper_items:     oper_items oper_item | oper_item;
1026   oper_item:      oper_name | oper_user | oper_password |
1027                  oper_umodes | oper_class | oper_encrypted |
# Line 1037 | Line 1039 | oper_name: NAME '=' QSTRING ';'
1039    }
1040   };
1041  
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 –
1042   oper_user: USER '=' QSTRING ';'
1043   {
1044    if (conf_parser_ctx.pass == 2)
# Line 1070 | Line 1060 | oper_user: USER '=' QSTRING ';'
1060      {
1061        DupString(yy_aconf->user, userbuf);
1062        DupString(yy_aconf->host, hostbuf);
1063 +
1064 +      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->ipnum,
1065 +                                    &yy_aconf->bits);
1066      }
1067      else
1068      {
# Line 1188 | Line 1181 | oper_umodes_item:  T_BOTS
1181   {
1182    if (conf_parser_ctx.pass == 2)
1183      yy_aconf->modes |= UMODE_FULL;
1184 + } | HIDDEN
1185 + {
1186 +  if (conf_parser_ctx.pass == 2)
1187 +    yy_aconf->modes |= UMODE_HIDDEN;
1188   } | T_SKILL
1189   {
1190    if (conf_parser_ctx.pass == 2)
# Line 1244 | Line 1241 | oper_umodes_item:  T_BOTS
1241  
1242   oper_flags: IRCD_FLAGS
1243   {
1244 +  if (conf_parser_ctx.pass == 2)
1245 +    yy_aconf->port = 0;
1246   } '='  oper_flags_items ';';
1247  
1248   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1249 < 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
1249 > oper_flags_item: GLOBAL_KILL
1250   {
1251    if (conf_parser_ctx.pass == 2)
1252 <  {
1257 <    if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1258 <    else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1259 <  }
1252 >    yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1253   } | REMOTE
1254   {
1255    if (conf_parser_ctx.pass == 2)
1256 <  {
1264 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1265 <    else yy_aconf->port |= OPER_FLAG_REMOTE;
1266 <  }
1256 >    yy_aconf->port |= OPER_FLAG_REMOTE;
1257   } | KLINE
1258   {
1259    if (conf_parser_ctx.pass == 2)
1260 <  {
1271 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1272 <    else yy_aconf->port |= OPER_FLAG_K;
1273 <  }
1260 >    yy_aconf->port |= OPER_FLAG_K;
1261   } | UNKLINE
1262   {
1263    if (conf_parser_ctx.pass == 2)
1264 <  {
1265 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1266 <    else yy_aconf->port |= OPER_FLAG_UNKLINE;
1267 <  }
1264 >    yy_aconf->port |= OPER_FLAG_UNKLINE;
1265 > } | T_DLINE
1266 > {
1267 >  if (conf_parser_ctx.pass == 2)
1268 >    yy_aconf->port |= OPER_FLAG_DLINE;
1269 > } | T_UNDLINE
1270 > {
1271 >  if (conf_parser_ctx.pass == 2)
1272 >    yy_aconf->port |= OPER_FLAG_UNDLINE;
1273   } | XLINE
1274   {
1275    if (conf_parser_ctx.pass == 2)
1276 <  {
1285 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1286 <    else yy_aconf->port |= OPER_FLAG_X;
1287 <  }
1276 >    yy_aconf->port |= OPER_FLAG_X;
1277   } | GLINE
1278   {
1279    if (conf_parser_ctx.pass == 2)
1280 <  {
1292 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1293 <    else yy_aconf->port |= OPER_FLAG_GLINE;
1294 <  }
1280 >    yy_aconf->port |= OPER_FLAG_GLINE;
1281   } | DIE
1282   {
1283    if (conf_parser_ctx.pass == 2)
1284 <  {
1285 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1300 <    else yy_aconf->port |= OPER_FLAG_DIE;
1301 <  }
1302 < } | REHASH
1284 >    yy_aconf->port |= OPER_FLAG_DIE;
1285 > } | T_RESTART
1286   {
1287    if (conf_parser_ctx.pass == 2)
1288 <  {
1289 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1307 <    else yy_aconf->port |= OPER_FLAG_REHASH;
1308 <  }
1309 < } | ADMIN
1288 >    yy_aconf->port |= OPER_FLAG_RESTART;
1289 > } | REHASH
1290   {
1291    if (conf_parser_ctx.pass == 2)
1292 <  {
1293 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1314 <    else yy_aconf->port |= OPER_FLAG_ADMIN;
1315 <  }
1316 < } | HIDDEN_ADMIN
1292 >    yy_aconf->port |= OPER_FLAG_REHASH;
1293 > } | ADMIN
1294   {
1295    if (conf_parser_ctx.pass == 2)
1296 <  {
1320 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1321 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1322 <  }
1296 >    yy_aconf->port |= OPER_FLAG_ADMIN;
1297   } | NICK_CHANGES
1298   {
1299    if (conf_parser_ctx.pass == 2)
1300 <  {
1327 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1328 <    else yy_aconf->port |= OPER_FLAG_N;
1329 <  }
1300 >    yy_aconf->port |= OPER_FLAG_N;
1301   } | T_OPERWALL
1302   {
1303    if (conf_parser_ctx.pass == 2)
1304 <  {
1305 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1335 <    else yy_aconf->port |= OPER_FLAG_OPERWALL;
1336 <  }
1337 < } | OPER_SPY_T
1304 >    yy_aconf->port |= OPER_FLAG_OPERWALL;
1305 > } | T_GLOBOPS
1306   {
1307    if (conf_parser_ctx.pass == 2)
1308 <  {
1309 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1342 <    else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1343 <  }
1344 < } | HIDDEN_OPER
1308 >    yy_aconf->port |= OPER_FLAG_GLOBOPS;
1309 > } | OPER_SPY_T
1310   {
1311    if (conf_parser_ctx.pass == 2)
1312 <  {
1348 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1349 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1350 <  }
1312 >    yy_aconf->port |= OPER_FLAG_OPER_SPY;
1313   } | REMOTEBAN
1314   {
1315    if (conf_parser_ctx.pass == 2)
1316 <  {
1317 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1356 <    else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1357 <  }
1358 < } | ENCRYPTED
1316 >    yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1317 > } | MODULE
1318   {
1319    if (conf_parser_ctx.pass == 2)
1320 <  {
1362 <    if (not_atom) ClearConfEncrypted(yy_aconf);
1363 <    else SetConfEncrypted(yy_aconf);
1364 <  }
1320 >    yy_aconf->port |= OPER_FLAG_MODULE;
1321   };
1322  
1323  
# Line 1375 | Line 1331 | class_entry: CLASS
1331      yy_conf = make_conf_item(CLASS_TYPE);
1332      yy_class = map_to_conf(yy_conf);
1333    }
1334 < } class_name_b '{' class_items '}' ';'
1334 > } '{' class_items '}' ';'
1335   {
1336    if (conf_parser_ctx.pass == 1)
1337    {
# Line 1386 | Line 1342 | class_entry: CLASS
1342        delete_conf_item(yy_conf);
1343      else
1344      {
1345 <      cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1345 >      cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1346  
1347        if (cconf != NULL)                /* The class existed already */
1348        {
# Line 1418 | Line 1374 | class_entry: CLASS
1374    }
1375   };
1376  
1421 – class_name_b: | class_name_t;
1422 –
1377   class_items:    class_items class_item | class_item;
1378   class_item:     class_name |
1379                  class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
# Line 1444 | Line 1398 | class_name: NAME '=' QSTRING ';'
1398    }
1399   };
1400  
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 –
1401   class_ping_time: PING_TIME '=' timespec ';'
1402   {
1403    if (conf_parser_ctx.pass == 1)
# Line 1777 | Line 1722 | auth_flags: IRCD_FLAGS
1722   } '='  auth_flags_items ';';
1723  
1724   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1725 < 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
1725 > auth_flags_item: SPOOF_NOTICE
1726   {
1727    if (conf_parser_ctx.pass == 2)
1728 <  {
1787 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1788 <    else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1789 <  }
1728 >    yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1729   } | EXCEED_LIMIT
1730   {
1731    if (conf_parser_ctx.pass == 2)
1732 <  {
1794 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1795 <    else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1796 <  }
1732 >    yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1733   } | KLINE_EXEMPT
1734   {
1735    if (conf_parser_ctx.pass == 2)
1736 <  {
1801 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1802 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1803 <  }
1736 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1737   } | NEED_IDENT
1738   {
1739    if (conf_parser_ctx.pass == 2)
1740 <  {
1808 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1809 <    else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1810 <  }
1740 >    yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1741   } | CAN_FLOOD
1742   {
1743    if (conf_parser_ctx.pass == 2)
1744 <  {
1815 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
1816 <    else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1817 <  }
1818 < } | CAN_IDLE
1819 < {
1820 <  if (conf_parser_ctx.pass == 2)
1821 <  {
1822 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED;
1823 <    else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED;
1824 <  }
1744 >    yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1745   } | NO_TILDE
1746   {
1747    if (conf_parser_ctx.pass == 2)
1748 <  {
1829 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
1830 <    else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1831 <  }
1748 >    yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1749   } | GLINE_EXEMPT
1750   {
1751    if (conf_parser_ctx.pass == 2)
1752 <  {
1836 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
1837 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1838 <  }
1752 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1753   } | RESV_EXEMPT
1754   {
1755    if (conf_parser_ctx.pass == 2)
1756 <  {
1843 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
1844 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1845 <  }
1756 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1757   } | NEED_PASSWORD
1758   {
1759    if (conf_parser_ctx.pass == 2)
1760 <  {
1850 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
1851 <    else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1852 <  }
1760 >    yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1761   };
1762  
1763   /* XXX - need check for illegal hostnames here */
# Line 1866 | Line 1774 | auth_spoof: SPOOF '=' QSTRING ';'
1774      }
1775      else
1776      {
1777 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1777 >      ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1778        yy_conf->name = NULL;
1779      }
1780    }
# Line 1949 | Line 1857 | resv_nick: NICK '=' QSTRING ';'
1857   };
1858  
1859   /***************************************************************************
1860 + *  section service
1861 + ***************************************************************************/
1862 + service_entry: T_SERVICE '{' service_items '}' ';';
1863 +
1864 + service_items:     service_items service_item | service_item;
1865 + service_item:      service_name | error;
1866 +
1867 + service_name: NAME '=' QSTRING ';'
1868 + {
1869 +  if (conf_parser_ctx.pass == 2)
1870 +  {
1871 +    if (valid_servname(yylval.string))
1872 +    {
1873 +      yy_conf = make_conf_item(SERVICE_TYPE);
1874 +      DupString(yy_conf->name, yylval.string);
1875 +    }
1876 +  }
1877 + };
1878 +
1879 + /***************************************************************************
1880   *  section shared, for sharing remote klines etc.
1881   ***************************************************************************/
1882   shared_entry: T_SHARED
# Line 2012 | Line 1940 | shared_type_item: KLINE
1940   {
1941    if (conf_parser_ctx.pass == 2)
1942      yy_match_item->action |= SHARED_KLINE;
2015 – } | TKLINE
2016 – {
2017 –  if (conf_parser_ctx.pass == 2)
2018 –    yy_match_item->action |= SHARED_TKLINE;
1943   } | UNKLINE
1944   {
1945    if (conf_parser_ctx.pass == 2)
1946      yy_match_item->action |= SHARED_UNKLINE;
1947 < } | XLINE
1947 > } | T_DLINE
1948   {
1949    if (conf_parser_ctx.pass == 2)
1950 <    yy_match_item->action |= SHARED_XLINE;
1951 < } | TXLINE
1950 >    yy_match_item->action |= SHARED_DLINE;
1951 > } | T_UNDLINE
1952 > {
1953 >  if (conf_parser_ctx.pass == 2)
1954 >    yy_match_item->action |= SHARED_UNDLINE;
1955 > } | XLINE
1956   {
1957    if (conf_parser_ctx.pass == 2)
1958 <    yy_match_item->action |= SHARED_TXLINE;
1958 >    yy_match_item->action |= SHARED_XLINE;
1959   } | T_UNXLINE
1960   {
1961    if (conf_parser_ctx.pass == 2)
# Line 2036 | Line 1964 | shared_type_item: KLINE
1964   {
1965    if (conf_parser_ctx.pass == 2)
1966      yy_match_item->action |= SHARED_RESV;
2039 – } | TRESV
2040 – {
2041 –  if (conf_parser_ctx.pass == 2)
2042 –    yy_match_item->action |= SHARED_TRESV;
1967   } | T_UNRESV
1968   {
1969    if (conf_parser_ctx.pass == 2)
# Line 2094 | Line 2018 | cluster_type_item: KLINE
2018   {
2019    if (conf_parser_ctx.pass == 2)
2020      yy_conf->flags |= SHARED_KLINE;
2097 – } | TKLINE
2098 – {
2099 –  if (conf_parser_ctx.pass == 2)
2100 –    yy_conf->flags |= SHARED_TKLINE;
2021   } | UNKLINE
2022   {
2023    if (conf_parser_ctx.pass == 2)
2024      yy_conf->flags |= SHARED_UNKLINE;
2025 < } | XLINE
2025 > } | T_DLINE
2026   {
2027    if (conf_parser_ctx.pass == 2)
2028 <    yy_conf->flags |= SHARED_XLINE;
2029 < } | TXLINE
2028 >    yy_conf->flags |= SHARED_DLINE;
2029 > } | T_UNDLINE
2030   {
2031    if (conf_parser_ctx.pass == 2)
2032 <    yy_conf->flags |= SHARED_TXLINE;
2032 >    yy_conf->flags |= SHARED_UNDLINE;
2033 > } | XLINE
2034 > {
2035 >  if (conf_parser_ctx.pass == 2)
2036 >    yy_conf->flags |= SHARED_XLINE;
2037   } | T_UNXLINE
2038   {
2039    if (conf_parser_ctx.pass == 2)
# Line 2118 | Line 2042 | cluster_type_item: KLINE
2042   {
2043    if (conf_parser_ctx.pass == 2)
2044      yy_conf->flags |= SHARED_RESV;
2121 – } | TRESV
2122 – {
2123 –  if (conf_parser_ctx.pass == 2)
2124 –    yy_conf->flags |= SHARED_TRESV;
2045   } | T_UNRESV
2046   {
2047    if (conf_parser_ctx.pass == 2)
# Line 2144 | Line 2064 | connect_entry: CONNECT
2064    if (conf_parser_ctx.pass == 2)
2065    {
2066      yy_conf = make_conf_item(SERVER_TYPE);
2067 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2068 <    yy_aconf->passwd = NULL;
2067 >    yy_aconf = map_to_conf(yy_conf);
2068 >
2069      /* defaults */
2070      yy_aconf->port = PORTNUM;
2151 –
2152 –    if (ConfigFileEntry.burst_away)
2153 –      yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2071    }
2072    else
2073    {
2074      MyFree(class_name);
2075      class_name = NULL;
2076    }
2077 < } connect_name_b '{' connect_items '}' ';'
2077 > } '{' connect_items '}' ';'
2078   {
2079    if (conf_parser_ctx.pass == 2)
2080    {
2081      struct CollectItem *yy_hconf=NULL;
2082      struct CollectItem *yy_lconf=NULL;
2083 <    dlink_node *ptr;
2084 <    dlink_node *next_ptr;
2168 < #ifdef HAVE_LIBCRYPTO
2083 >    dlink_node *ptr = NULL, *next_ptr = NULL;
2084 >
2085      if (yy_aconf->host &&
2086 <        ((yy_aconf->passwd && yy_aconf->spasswd) ||
2087 <         (yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf))))
2088 < #else /* !HAVE_LIBCRYPTO */
2089 <      if (yy_aconf->host && !IsConfCryptLink(yy_aconf) &&
2090 <          yy_aconf->passwd && yy_aconf->spasswd)
2091 < #endif /* !HAVE_LIBCRYPTO */
2092 <        {
2093 <          if (conf_add_server(yy_conf, class_name) == -1)
2094 <          {
2095 <            delete_conf_item(yy_conf);
2096 <            yy_conf = NULL;
2097 <            yy_aconf = NULL;
2098 <          }
2099 <        }
2100 <        else
2185 <        {
2186 <          /* Even if yy_conf ->name is NULL
2187 <           * should still unhook any hub/leaf confs still pending
2188 <           */
2189 <          unhook_hub_leaf_confs();
2190 <
2191 <          if (yy_conf->name != NULL)
2192 <          {
2193 < #ifndef HAVE_LIBCRYPTO
2194 <            if (IsConfCryptLink(yy_aconf))
2195 <              yyerror("Ignoring connect block -- no OpenSSL support");
2196 < #else
2197 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2198 <              yyerror("Ignoring connect block -- missing key");
2199 < #endif
2200 <            if (yy_aconf->host == NULL)
2201 <              yyerror("Ignoring connect block -- missing host");
2202 <            else if (!IsConfCryptLink(yy_aconf) &&
2203 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2204 <              yyerror("Ignoring connect block -- missing password");
2205 <          }
2206 <
2207 <
2208 <          /* XXX
2209 <           * This fixes a try_connections() core (caused by invalid class_ptr
2210 <           * pointers) reported by metalrock. That's an ugly fix, but there
2211 <           * is currently no better way. The entire config subsystem needs an
2212 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2213 <           * a doubly linked list immediately without any sanity checks!  -Michael
2214 <           */
2215 <          delete_conf_item(yy_conf);
2086 >        yy_aconf->passwd && yy_aconf->spasswd)
2087 >    {
2088 >      if (conf_add_server(yy_conf, class_name) == -1)
2089 >      {
2090 >        delete_conf_item(yy_conf);
2091 >        yy_conf = NULL;
2092 >        yy_aconf = NULL;
2093 >      }
2094 >    }
2095 >    else
2096 >    {
2097 >      /* Even if yy_conf ->name is NULL
2098 >       * should still unhook any hub/leaf confs still pending
2099 >       */
2100 >      unhook_hub_leaf_confs();
2101  
2102 <          yy_aconf = NULL;
2103 <          yy_conf = NULL;
2104 <        }
2102 >      if (yy_conf->name != NULL)
2103 >      {
2104 >        if (yy_aconf->host == NULL)
2105 >          yyerror("Ignoring connect block -- missing host");
2106 >        else if (!yy_aconf->passwd || !yy_aconf->spasswd)
2107 >          yyerror("Ignoring connect block -- missing password");
2108 >      }
2109 >
2110 >
2111 >      /* XXX
2112 >       * This fixes a try_connections() core (caused by invalid class_ptr
2113 >       * pointers) reported by metalrock. That's an ugly fix, but there
2114 >       * is currently no better way. The entire config subsystem needs an
2115 >       * rewrite ASAP. make_conf_item() shouldn't really add things onto
2116 >       * a doubly linked list immediately without any sanity checks!  -Michael
2117 >       */
2118 >      delete_conf_item(yy_conf);
2119 >
2120 >      yy_aconf = NULL;
2121 >      yy_conf = NULL;
2122 >    }
2123  
2124        /*
2125         * yy_conf is still pointing at the server that is having
# Line 2285 | Line 2188 | connect_entry: CONNECT
2188    }
2189   };
2190  
2288 – connect_name_b: | connect_name_t;
2191   connect_items:  connect_items connect_item | connect_item;
2192   connect_item:   connect_name | connect_host | connect_vhost |
2193                  connect_send_password | connect_accept_password |
2194 <                connect_aftype | connect_port |
2194 >                connect_aftype | connect_port | connect_ssl_cipher_list |
2195                  connect_flags | connect_hub_mask | connect_leaf_mask |
2196 <                connect_class | connect_encrypted |
2295 <                connect_rsa_public_key_file | connect_cipher_preference |
2196 >                connect_class | connect_encrypted |
2197                  error ';' ;
2198  
2199   connect_name: NAME '=' QSTRING ';'
# Line 2307 | Line 2208 | connect_name: NAME '=' QSTRING ';'
2208    }
2209   };
2210  
2310 – connect_name_t: QSTRING
2311 – {
2312 –  if (conf_parser_ctx.pass == 2)
2313 –  {
2314 –    if (yy_conf->name != NULL)
2315 –      yyerror("Multiple connect name entry");
2316 –
2317 –    MyFree(yy_conf->name);
2318 –    DupString(yy_conf->name, yylval.string);
2319 –  }
2320 – };
2321 –
2211   connect_host: HOST '=' QSTRING ';'
2212   {
2213    if (conf_parser_ctx.pass == 2)
# Line 2340 | Line 2229 | connect_vhost: VHOST '=' QSTRING ';'
2229      hints.ai_socktype = SOCK_STREAM;
2230      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2231  
2232 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
2233 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2232 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
2233 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2234      else
2235      {
2236        assert(res != NULL);
# Line 2349 | Line 2238 | connect_vhost: VHOST '=' QSTRING ';'
2238        memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2239        yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2240        yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2241 <      irc_freeaddrinfo(res);
2241 >      freeaddrinfo(res);
2242      }
2243    }
2244   };
# Line 2413 | Line 2302 | connect_flags: IRCD_FLAGS
2302   } '='  connect_flags_items ';';
2303  
2304   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2305 < connect_flags_item: NOT  { not_atom = 1; } connect_flags_item_atom
2417 <                        |  { not_atom = 0; } connect_flags_item_atom;
2418 <
2419 < connect_flags_item_atom: COMPRESSED
2420 < {
2421 <  if (conf_parser_ctx.pass == 2)
2422 < #ifndef HAVE_LIBZ
2423 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2424 < #else
2425 < {
2426 <   if (not_atom)ClearConfCompressed(yy_aconf);
2427 <   else SetConfCompressed(yy_aconf);
2428 < }
2429 < #endif
2430 < } | CRYPTLINK
2305 > connect_flags_item: AUTOCONN
2306   {
2307    if (conf_parser_ctx.pass == 2)
2308 <  {
2434 <    if (not_atom)ClearConfCryptLink(yy_aconf);
2435 <    else SetConfCryptLink(yy_aconf);
2436 <  }
2437 < } | AUTOCONN
2438 < {
2439 <  if (conf_parser_ctx.pass == 2)
2440 <  {
2441 <    if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2442 <    else SetConfAllowAutoConn(yy_aconf);
2443 <  }
2308 >    SetConfAllowAutoConn(yy_aconf);
2309   } | BURST_AWAY
2310   {
2311    if (conf_parser_ctx.pass == 2)
2312 <  {
2448 <    if (not_atom)ClearConfAwayBurst(yy_aconf);
2449 <    else SetConfAwayBurst(yy_aconf);
2450 <  }
2312 >    SetConfAwayBurst(yy_aconf);
2313   } | TOPICBURST
2314   {
2315    if (conf_parser_ctx.pass == 2)
2316 <  {
2317 <    if (not_atom)ClearConfTopicBurst(yy_aconf);
2456 <    else SetConfTopicBurst(yy_aconf);
2457 <  }
2458 < }
2459 < ;
2460 <
2461 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2316 >    SetConfTopicBurst(yy_aconf);
2317 > } | T_SSL
2318   {
2463 – #ifdef HAVE_LIBCRYPTO
2319    if (conf_parser_ctx.pass == 2)
2320 <  {
2466 <    BIO *file;
2467 <
2468 <    if (yy_aconf->rsa_public_key != NULL)
2469 <    {
2470 <      RSA_free(yy_aconf->rsa_public_key);
2471 <      yy_aconf->rsa_public_key = NULL;
2472 <    }
2473 <
2474 <    if (yy_aconf->rsa_public_key_file != NULL)
2475 <    {
2476 <      MyFree(yy_aconf->rsa_public_key_file);
2477 <      yy_aconf->rsa_public_key_file = NULL;
2478 <    }
2479 <
2480 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2481 <
2482 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2483 <    {
2484 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2485 <      break;
2486 <    }
2487 <
2488 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2489 <
2490 <    if (yy_aconf->rsa_public_key == NULL)
2491 <    {
2492 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2493 <      break;
2494 <    }
2495 <      
2496 <    BIO_set_close(file, BIO_CLOSE);
2497 <    BIO_free(file);
2498 <  }
2499 < #endif /* HAVE_LIBCRYPTO */
2320 >    SetConfSSL(yy_aconf);
2321   };
2322  
2323   connect_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 2545 | Line 2366 | connect_class: CLASS '=' QSTRING ';'
2366    }
2367   };
2368  
2369 < connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2369 > connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2370   {
2371   #ifdef HAVE_LIBCRYPTO
2372    if (conf_parser_ctx.pass == 2)
2373    {
2374 <    struct EncCapability *ecap;
2375 <    const char *cipher_name;
2555 <    int found = 0;
2556 <
2557 <    yy_aconf->cipher_preference = NULL;
2558 <    cipher_name = yylval.string;
2559 <
2560 <    for (ecap = CipherTable; ecap->name; ecap++)
2561 <    {
2562 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2563 <          (ecap->cap & CAP_ENC_MASK))
2564 <      {
2565 <        yy_aconf->cipher_preference = ecap;
2566 <        found = 1;
2567 <        break;
2568 <      }
2569 <    }
2570 <
2571 <    if (!found)
2572 <      yyerror("Invalid cipher");
2374 >    MyFree(yy_aconf->cipher_list);
2375 >    DupString(yy_aconf->cipher_list, yylval.string);
2376    }
2377   #else
2378    if (conf_parser_ctx.pass == 2)
2379 <    yyerror("Ignoring cipher_preference -- no OpenSSL support");
2379 >    yyerror("Ignoring connect::ciphers -- no OpenSSL support");
2380   #endif
2381   };
2382  
2383 +
2384   /***************************************************************************
2385   *  section kill
2386   ***************************************************************************/
# Line 2603 | Line 2407 | kill_entry: KILL
2407          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2408              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2409          {
2410 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2410 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2411                 errptr);
2412            break;
2413          }
# Line 2620 | Line 2424 | kill_entry: KILL
2424          else
2425            DupString(yy_aconf->reason, "No reason");
2426   #else
2427 <        ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support");
2427 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2428          break;
2429   #endif
2430        }
# Line 2770 | Line 2574 | gecos_entry: GECOS
2574  
2575          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2576          {
2577 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
2577 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2578                 errptr);
2579            break;
2580          }
# Line 2778 | Line 2582 | gecos_entry: GECOS
2582          yy_conf = make_conf_item(RXLINE_TYPE);
2583          yy_conf->regexpname = exp_p;
2584   #else
2585 <        ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support");
2585 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2586          break;
2587   #endif
2588        }
# Line 2842 | Line 2646 | general_item:       general_hide_spoof_i
2646                      general_pace_wait_simple | general_stats_P_oper_only |
2647                      general_short_motd | general_no_oper_flood |
2648                      general_true_no_oper_flood | general_oper_pass_resv |
2649 <                    general_idletime | general_message_locale |
2649 >                    general_message_locale |
2650                      general_oper_only_umodes | general_max_targets |
2651                      general_use_egd | general_egdpool_path |
2652                      general_oper_umodes | general_caller_id_wait |
2653                      general_opers_bypass_callerid | general_default_floodcount |
2654                      general_min_nonwildcard | general_min_nonwildcard_simple |
2655 <                    general_servlink_path | general_disable_remote_commands |
2656 <                    general_default_cipher_preference |
2853 <                    general_compression_level | general_client_flood |
2655 >                    general_disable_remote_commands |
2656 >                    general_client_flood |
2657                      general_throttle_time | general_havent_read_conf |
2658                      general_ping_cookie |
2659 <                    general_disable_auth | general_burst_away |
2659 >                    general_disable_auth |
2660                      general_tkline_expire_notices | general_gline_min_cidr |
2661                      general_gline_min_cidr6 | general_use_whois_actually |
2662                      general_reject_hold_time | general_stats_e_disabled |
2663 <                    general_max_watch |
2663 >                    general_max_watch | general_services_name |
2664                      error;
2665  
2666  
# Line 2876 | Line 2679 | general_gline_min_cidr6: GLINE_MIN_CIDR6
2679    ConfigFileEntry.gline_min_cidr6 = $3;
2680   };
2681  
2879 – general_burst_away: BURST_AWAY '=' TBOOL ';'
2880 – {
2881 –  ConfigFileEntry.burst_away = yylval.number;
2882 – };
2883 –
2682   general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2683   {
2684    ConfigFileEntry.use_whois_actually = yylval.number;
# Line 2961 | Line 2759 | general_havent_read_conf: HAVENT_READ_CO
2759   {
2760    if (($3 > 0) && conf_parser_ctx.pass == 1)
2761    {
2762 <    ilog(L_CRIT, "You haven't read your config file properly.");
2763 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
2764 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
2762 >    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2763 >    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2764 >    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2765      exit(0);
2766    }
2767   };
# Line 3074 | Line 2872 | general_message_locale: MESSAGE_LOCALE '
2872    }
2873   };
2874  
3077 – general_idletime: IDLETIME '=' timespec ';'
3078 – {
3079 –  ConfigFileEntry.idletime = $3;
3080 – };
3081 –
2875   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2876   {
2877    ConfigFileEntry.dots_in_ident = $3;
# Line 3089 | Line 2882 | general_max_targets: MAX_TARGETS '=' NUM
2882    ConfigFileEntry.max_targets = $3;
2883   };
2884  
3092 – general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3093 – {
3094 –  if (conf_parser_ctx.pass == 2)
3095 –  {
3096 –    MyFree(ConfigFileEntry.servlink_path);
3097 –    DupString(ConfigFileEntry.servlink_path, yylval.string);
3098 –  }
3099 – };
3100 –
3101 – general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3102 – {
3103 – #ifdef HAVE_LIBCRYPTO
3104 –  if (conf_parser_ctx.pass == 2)
3105 –  {
3106 –    struct EncCapability *ecap;
3107 –    const char *cipher_name;
3108 –    int found = 0;
3109 –
3110 –    ConfigFileEntry.default_cipher_preference = NULL;
3111 –    cipher_name = yylval.string;
3112 –
3113 –    for (ecap = CipherTable; ecap->name; ecap++)
3114 –    {
3115 –      if ((irccmp(ecap->name, cipher_name) == 0) &&
3116 –          (ecap->cap & CAP_ENC_MASK))
3117 –      {
3118 –        ConfigFileEntry.default_cipher_preference = ecap;
3119 –        found = 1;
3120 –        break;
3121 –      }
3122 –    }
3123 –
3124 –    if (!found)
3125 –      yyerror("Invalid cipher");
3126 –  }
3127 – #else
3128 –  if (conf_parser_ctx.pass == 2)
3129 –    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3130 – #endif
3131 – };
3132 –
3133 – general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3134 – {
3135 –  if (conf_parser_ctx.pass == 2)
3136 –  {
3137 –    ConfigFileEntry.compression_level = $3;
3138 – #ifndef HAVE_LIBZ
3139 –    yyerror("Ignoring compression_level -- no zlib support");
3140 – #else
3141 –    if ((ConfigFileEntry.compression_level < 1) ||
3142 –        (ConfigFileEntry.compression_level > 9))
3143 –    {
3144 –      yyerror("Ignoring invalid compression_level, using default");
3145 –      ConfigFileEntry.compression_level = 0;
3146 –    }
3147 – #endif
3148 –  }
3149 – };
3150 –
2885   general_use_egd: USE_EGD '=' TBOOL ';'
2886   {
2887    ConfigFileEntry.use_egd = yylval.number;
# Line 3162 | Line 2896 | general_egdpool_path: EGDPOOL_PATH '=' Q
2896    }
2897   };
2898  
2899 + general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2900 + {
2901 +  if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2902 +  {
2903 +    MyFree(ConfigFileEntry.service_name);
2904 +    DupString(ConfigFileEntry.service_name, yylval.string);
2905 +  }
2906 + };
2907 +
2908   general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2909   {
2910    ConfigFileEntry.ping_cookie = yylval.number;
# Line 3201 | Line 2944 | umode_oitem:     T_BOTS
2944   } | T_FULL
2945   {
2946    ConfigFileEntry.oper_umodes |= UMODE_FULL;
2947 + } | HIDDEN
2948 + {
2949 +  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2950   } | T_SKILL
2951   {
2952    ConfigFileEntry.oper_umodes |= UMODE_SKILL;
# Line 3269 | Line 3015 | umode_item:    T_BOTS
3015   } | T_SKILL
3016   {
3017    ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
3018 + } | HIDDEN
3019 + {
3020 +  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
3021   } | T_NCHANGE
3022   {
3023    ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
# Line 3376 | Line 3125 | gline_duration: DURATION '=' timespec ';
3125      ConfigFileEntry.gline_time = $3;
3126   };
3127  
3128 < gline_logging: LOGGING
3128 > gline_logging: T_LOG
3129   {
3130    if (conf_parser_ctx.pass == 2)
3131      ConfigFileEntry.gline_logging = 0;

Diff Legend

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