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-8/src/ircd_parser.y (file contents), Revision 1248 by michael, Sat Oct 1 10:02:53 2011 UTC vs.
ircd-hybrid-8/src/conf_parser.y (file contents), Revision 1352 by michael, Fri Apr 13 09:57:08 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 151 | Line 154 | unhook_hub_leaf_confs(void)
154   %token  CHANNEL
155   %token  CIDR_BITLEN_IPV4
156   %token  CIDR_BITLEN_IPV6
154 %token  CIPHER_PREFERENCE
157   %token  CLASS
156 %token  COMPRESSED
157 %token  COMPRESSION_LEVEL
158   %token  CONNECT
159   %token  CONNECTFREQ
160 %token  CRYPTLINK
161 %token  DEFAULT_CIPHER_PREFERENCE
160   %token  DEFAULT_FLOODCOUNT
161   %token  DEFAULT_SPLIT_SERVER_COUNT
162   %token  DEFAULT_SPLIT_USER_COUNT
# Line 194 | Line 192 | unhook_hub_leaf_confs(void)
192   %token  NEED_IDENT
193   %token  HAVENT_READ_CONF
194   %token  HIDDEN
197 %token  HIDDEN_ADMIN
195   %token  HIDDEN_NAME
199 %token  HIDDEN_OPER
196   %token  HIDE_SERVER_IPS
197   %token  HIDE_SERVERS
198   %token  HIDE_SPOOF_IPS
# Line 280 | 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 290 | Line 288 | unhook_hub_leaf_confs(void)
288   %token  SEND_PASSWORD
289   %token  SERVERHIDE
290   %token  SERVERINFO
293 %token  SERVLINK_PATH
291   %token  IRCD_SID
292   %token  TKLINE_EXPIRE_NOTICES
293   %token  T_SHARED
# Line 317 | 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
# Line 339 | 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
# Line 346 | Line 346 | unhook_hub_leaf_confs(void)
346   %token  T_RESTART
347   %token  T_SERVICE
348   %token  T_SERVICES_NAME
349 %token  T_TIMESTAMP
349   %token  THROTTLE_TIME
350   %token  TOPICBURST
351   %token  TRUE_NO_OPER_FLOOD
# Line 470 | 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 <  {
491 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
492 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
493 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
494 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
495 <  }
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 523 | 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 530 | 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 572 | 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,
576 <      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 605 | 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 796 | Line 835 | admin_description: DESCRIPTION '=' QSTRI
835   logging_entry:          T_LOG  '{' logging_items '}' ';' ;
836   logging_items:          logging_items logging_item | logging_item ;
837  
838 < logging_item:           logging_use_logging | logging_timestamp | logging_file_entry |
838 > logging_item:           logging_use_logging | logging_file_entry |
839                          error ';' ;
840  
841   logging_use_logging: USE_LOGGING '=' TBOOL ';'
# Line 805 | Line 844 | logging_use_logging: USE_LOGGING '=' TBO
844      ConfigLoggingEntry.use_logging = yylval.number;
845   };
846  
808 logging_timestamp: T_TIMESTAMP '=' TBOOL ';'
809 {
810  if (conf_parser_ctx.pass == 2)
811    ConfigLoggingEntry.timestamp = yylval.number;
812 };
813
847   logging_file_entry:
848   {
849    lfile[0] = '\0';
# Line 836 | Line 869 | logging_file_name: NAME '=' QSTRING ';'
869   logging_file_size: T_SIZE '=' sizespec ';'
870   {
871    lsize = $3;
872 + } | T_SIZE '=' T_UNLIMITED ';'
873 + {
874 +  lsize = 0;
875   };
876  
877   logging_file_type: TYPE
# Line 892 | 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 927 | 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 973 | Line 1013 | oper_entry: OPERATOR
1013    }
1014   };
1015  
976 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 991 | Line 1030 | oper_name: NAME '=' QSTRING ';'
1030    }
1031   };
1032  
994 oper_name_t: QSTRING
995 {
996  if (conf_parser_ctx.pass == 2)
997  {
998    if (strlen(yylval.string) > OPERNICKLEN)
999      yylval.string[OPERNICKLEN] = '\0';
1000
1001    MyFree(yy_conf->name);
1002    DupString(yy_conf->name, yylval.string);
1003  }
1004 };
1005
1033   oper_user: USER '=' QSTRING ';'
1034   {
1035    if (conf_parser_ctx.pass == 2)
# Line 1024 | 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 1142 | 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 1219 | Line 1253 | oper_flags_item: GLOBAL_KILL
1253   {
1254    if (conf_parser_ctx.pass == 2)
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)
# Line 1243 | Line 1285 | oper_flags_item: GLOBAL_KILL
1285   {
1286    if (conf_parser_ctx.pass == 2)
1287      yy_aconf->port |= OPER_FLAG_ADMIN;
1246 } | HIDDEN_ADMIN
1247 {
1248  if (conf_parser_ctx.pass == 2)
1249    yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1288   } | NICK_CHANGES
1289   {
1290    if (conf_parser_ctx.pass == 2)
# Line 1263 | Line 1301 | oper_flags_item: GLOBAL_KILL
1301   {
1302    if (conf_parser_ctx.pass == 2)
1303      yy_aconf->port |= OPER_FLAG_OPER_SPY;
1266 } | HIDDEN_OPER
1267 {
1268  if (conf_parser_ctx.pass == 2)
1269    yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1304   } | REMOTEBAN
1305   {
1306    if (conf_parser_ctx.pass == 2)
# Line 1288 | 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 1299 | 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 1331 | Line 1365 | class_entry: CLASS
1365    }
1366   };
1367  
1334 class_name_b: | class_name_t;
1335
1368   class_items:    class_items class_item | class_item;
1369   class_item:     class_name |
1370                  class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
# Line 1357 | Line 1389 | class_name: NAME '=' QSTRING ';'
1389    }
1390   };
1391  
1360 class_name_t: QSTRING
1361 {
1362  if (conf_parser_ctx.pass == 1)
1363  {
1364    MyFree(yy_class_name);
1365    DupString(yy_class_name, yylval.string);
1366  }
1367 };
1368
1392   class_ping_time: PING_TIME '=' timespec ';'
1393   {
1394    if (conf_parser_ctx.pass == 1)
# Line 1908 | Line 1931 | shared_type_item: KLINE
1931   {
1932    if (conf_parser_ctx.pass == 2)
1933      yy_match_item->action |= SHARED_KLINE;
1911 } | TKLINE
1912 {
1913  if (conf_parser_ctx.pass == 2)
1914    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_TXLINE;
1945 >    yy_match_item->action |= SHARED_UNDLINE;
1946 > } | XLINE
1947 > {
1948 >  if (conf_parser_ctx.pass == 2)
1949 >    yy_match_item->action |= SHARED_XLINE;
1950   } | T_UNXLINE
1951   {
1952    if (conf_parser_ctx.pass == 2)
# Line 1932 | Line 1955 | shared_type_item: KLINE
1955   {
1956    if (conf_parser_ctx.pass == 2)
1957      yy_match_item->action |= SHARED_RESV;
1935 } | TRESV
1936 {
1937  if (conf_parser_ctx.pass == 2)
1938    yy_match_item->action |= SHARED_TRESV;
1958   } | T_UNRESV
1959   {
1960    if (conf_parser_ctx.pass == 2)
# Line 1990 | Line 2009 | cluster_type_item: KLINE
2009   {
2010    if (conf_parser_ctx.pass == 2)
2011      yy_conf->flags |= SHARED_KLINE;
1993 } | TKLINE
1994 {
1995  if (conf_parser_ctx.pass == 2)
1996    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 2014 | Line 2033 | cluster_type_item: KLINE
2033   {
2034    if (conf_parser_ctx.pass == 2)
2035      yy_conf->flags |= SHARED_RESV;
2017 } | TRESV
2018 {
2019  if (conf_parser_ctx.pass == 2)
2020    yy_conf->flags |= SHARED_TRESV;
2036   } | T_UNRESV
2037   {
2038    if (conf_parser_ctx.pass == 2)
# Line 2040 | 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;
2047
2048    if (ConfigFileEntry.burst_away)
2049      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;
2064 < #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
2081 <        {
2082 <          /* Even if yy_conf ->name is NULL
2083 <           * should still unhook any hub/leaf confs still pending
2084 <           */
2085 <          unhook_hub_leaf_confs();
2086 <
2087 <          if (yy_conf->name != NULL)
2088 <          {
2089 < #ifndef HAVE_LIBCRYPTO
2090 <            if (IsConfCryptLink(yy_aconf))
2091 <              yyerror("Ignoring connect block -- no OpenSSL support");
2092 < #else
2093 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2094 <              yyerror("Ignoring connect block -- missing key");
2095 < #endif
2096 <            if (yy_aconf->host == NULL)
2097 <              yyerror("Ignoring connect block -- missing host");
2098 <            else if (!IsConfCryptLink(yy_aconf) &&
2099 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2100 <              yyerror("Ignoring connect block -- missing password");
2101 <          }
2102 <
2103 <
2104 <          /* XXX
2105 <           * This fixes a try_connections() core (caused by invalid class_ptr
2106 <           * pointers) reported by metalrock. That's an ugly fix, but there
2107 <           * is currently no better way. The entire config subsystem needs an
2108 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2109 <           * a doubly linked list immediately without any sanity checks!  -Michael
2110 <           */
2111 <          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 2181 | Line 2179 | connect_entry: CONNECT
2179    }
2180   };
2181  
2184 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 |
2191 <                connect_rsa_public_key_file | connect_cipher_preference |
2187 >                connect_class | connect_encrypted |
2188                  error ';' ;
2189  
2190   connect_name: NAME '=' QSTRING ';'
# Line 2203 | Line 2199 | connect_name: NAME '=' QSTRING ';'
2199    }
2200   };
2201  
2206 connect_name_t: QSTRING
2207 {
2208  if (conf_parser_ctx.pass == 2)
2209  {
2210    if (yy_conf->name != NULL)
2211      yyerror("Multiple connect name entry");
2212
2213    MyFree(yy_conf->name);
2214    DupString(yy_conf->name, yylval.string);
2215  }
2216 };
2217
2202   connect_host: HOST '=' QSTRING ';'
2203   {
2204    if (conf_parser_ctx.pass == 2)
# Line 2309 | Line 2293 | connect_flags: IRCD_FLAGS
2293   } '='  connect_flags_items ';';
2294  
2295   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2296 < connect_flags_item: COMPRESSED
2313 < {
2314 <  if (conf_parser_ctx.pass == 2)
2315 < #ifndef HAVE_LIBZ
2316 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2317 < #else
2318 < {
2319 <   SetConfCompressed(yy_aconf);
2320 < }
2321 < #endif
2322 < } | CRYPTLINK
2323 < {
2324 <  if (conf_parser_ctx.pass == 2)
2325 <    SetConfCryptLink(yy_aconf);
2326 < } | AUTOCONN
2296 > connect_flags_item: AUTOCONN
2297   {
2298    if (conf_parser_ctx.pass == 2)
2299      SetConfAllowAutoConn(yy_aconf);
# Line 2335 | Line 2305 | connect_flags_item: COMPRESSED
2305   {
2306    if (conf_parser_ctx.pass == 2)
2307      SetConfTopicBurst(yy_aconf);
2308 < };
2339 <
2340 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2308 > } | T_SSL
2309   {
2342 #ifdef HAVE_LIBCRYPTO
2310    if (conf_parser_ctx.pass == 2)
2311 <  {
2345 <    BIO *file;
2346 <
2347 <    if (yy_aconf->rsa_public_key != NULL)
2348 <    {
2349 <      RSA_free(yy_aconf->rsa_public_key);
2350 <      yy_aconf->rsa_public_key = NULL;
2351 <    }
2352 <
2353 <    if (yy_aconf->rsa_public_key_file != NULL)
2354 <    {
2355 <      MyFree(yy_aconf->rsa_public_key_file);
2356 <      yy_aconf->rsa_public_key_file = NULL;
2357 <    }
2358 <
2359 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2360 <
2361 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2362 <    {
2363 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2364 <      break;
2365 <    }
2366 <
2367 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2368 <
2369 <    if (yy_aconf->rsa_public_key == NULL)
2370 <    {
2371 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2372 <      break;
2373 <    }
2374 <      
2375 <    BIO_set_close(file, BIO_CLOSE);
2376 <    BIO_free(file);
2377 <  }
2378 < #endif /* HAVE_LIBCRYPTO */
2311 >    SetConfSSL(yy_aconf);
2312   };
2313  
2314   connect_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 2424 | Line 2357 | connect_class: CLASS '=' QSTRING ';'
2357    }
2358   };
2359  
2360 < connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2360 > connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2361   {
2362   #ifdef HAVE_LIBCRYPTO
2363    if (conf_parser_ctx.pass == 2)
2364    {
2365 <    struct EncCapability *ecap;
2366 <    const char *cipher_name;
2434 <    int found = 0;
2435 <
2436 <    yy_aconf->cipher_preference = NULL;
2437 <    cipher_name = yylval.string;
2438 <
2439 <    for (ecap = CipherTable; ecap->name; ecap++)
2440 <    {
2441 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2442 <          (ecap->cap & CAP_ENC_MASK))
2443 <      {
2444 <        yy_aconf->cipher_preference = ecap;
2445 <        found = 1;
2446 <        break;
2447 <      }
2448 <    }
2449 <
2450 <    if (!found)
2451 <      yyerror("Invalid cipher");
2365 >    MyFree(yy_aconf->cipher_list);
2366 >    DupString(yy_aconf->cipher_list, yylval.string);
2367    }
2368   #else
2369    if (conf_parser_ctx.pass == 2)
2370 <    yyerror("Ignoring cipher_preference -- no OpenSSL support");
2370 >    yyerror("Ignoring connect::ciphers -- no OpenSSL support");
2371   #endif
2372   };
2373  
2374 +
2375   /***************************************************************************
2376   *  section kill
2377   ***************************************************************************/
# Line 2727 | Line 2643 | general_item:       general_hide_spoof_i
2643                      general_oper_umodes | general_caller_id_wait |
2644                      general_opers_bypass_callerid | general_default_floodcount |
2645                      general_min_nonwildcard | general_min_nonwildcard_simple |
2646 <                    general_servlink_path | general_disable_remote_commands |
2647 <                    general_default_cipher_preference |
2732 <                    general_compression_level | general_client_flood |
2646 >                    general_disable_remote_commands |
2647 >                    general_client_flood |
2648                      general_throttle_time | general_havent_read_conf |
2649                      general_ping_cookie |
2650 <                    general_disable_auth | general_burst_away |
2650 >                    general_disable_auth |
2651                      general_tkline_expire_notices | general_gline_min_cidr |
2652                      general_gline_min_cidr6 | general_use_whois_actually |
2653                      general_reject_hold_time | general_stats_e_disabled |
# Line 2755 | Line 2670 | general_gline_min_cidr6: GLINE_MIN_CIDR6
2670    ConfigFileEntry.gline_min_cidr6 = $3;
2671   };
2672  
2758 general_burst_away: BURST_AWAY '=' TBOOL ';'
2759 {
2760  ConfigFileEntry.burst_away = yylval.number;
2761 };
2762
2673   general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2674   {
2675    ConfigFileEntry.use_whois_actually = yylval.number;
# Line 2963 | Line 2873 | general_max_targets: MAX_TARGETS '=' NUM
2873    ConfigFileEntry.max_targets = $3;
2874   };
2875  
2966 general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
2967 {
2968  if (conf_parser_ctx.pass == 2)
2969  {
2970    MyFree(ConfigFileEntry.servlink_path);
2971    DupString(ConfigFileEntry.servlink_path, yylval.string);
2972  }
2973 };
2974
2975 general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
2976 {
2977 #ifdef HAVE_LIBCRYPTO
2978  if (conf_parser_ctx.pass == 2)
2979  {
2980    struct EncCapability *ecap;
2981    const char *cipher_name;
2982    int found = 0;
2983
2984    ConfigFileEntry.default_cipher_preference = NULL;
2985    cipher_name = yylval.string;
2986
2987    for (ecap = CipherTable; ecap->name; ecap++)
2988    {
2989      if ((irccmp(ecap->name, cipher_name) == 0) &&
2990          (ecap->cap & CAP_ENC_MASK))
2991      {
2992        ConfigFileEntry.default_cipher_preference = ecap;
2993        found = 1;
2994        break;
2995      }
2996    }
2997
2998    if (!found)
2999      yyerror("Invalid cipher");
3000  }
3001 #else
3002  if (conf_parser_ctx.pass == 2)
3003    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3004 #endif
3005 };
3006
3007 general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3008 {
3009  if (conf_parser_ctx.pass == 2)
3010  {
3011    ConfigFileEntry.compression_level = $3;
3012 #ifndef HAVE_LIBZ
3013    yyerror("Ignoring compression_level -- no zlib support");
3014 #else
3015    if ((ConfigFileEntry.compression_level < 1) ||
3016        (ConfigFileEntry.compression_level > 9))
3017    {
3018      yyerror("Ignoring invalid compression_level, using default");
3019      ConfigFileEntry.compression_level = 0;
3020    }
3021 #endif
3022  }
3023 };
3024
2876   general_use_egd: USE_EGD '=' TBOOL ';'
2877   {
2878    ConfigFileEntry.use_egd = yylval.number;
# Line 3084 | Line 2935 | umode_oitem:     T_BOTS
2935   } | T_FULL
2936   {
2937    ConfigFileEntry.oper_umodes |= UMODE_FULL;
2938 + } | HIDDEN
2939 + {
2940 +  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2941   } | T_SKILL
2942   {
2943    ConfigFileEntry.oper_umodes |= UMODE_SKILL;
# Line 3152 | Line 3006 | umode_item:    T_BOTS
3006   } | T_SKILL
3007   {
3008    ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
3009 + } | HIDDEN
3010 + {
3011 +  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
3012   } | T_NCHANGE
3013   {
3014    ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;

Diff Legend

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