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 1264 by michael, Tue Jan 17 12:30:57 2012 UTC vs.
Revision 1306 by michael, Sat Mar 24 07:43:04 2012 UTC

# 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   static char *class_name = NULL;
# Line 151 | Line 152 | unhook_hub_leaf_confs(void)
152   %token  CHANNEL
153   %token  CIDR_BITLEN_IPV4
154   %token  CIDR_BITLEN_IPV6
154 %token  CIPHER_PREFERENCE
155   %token  CLASS
156 %token  COMPRESSED
157 %token  COMPRESSION_LEVEL
156   %token  CONNECT
157   %token  CONNECTFREQ
160 %token  CRYPTLINK
161 %token  DEFAULT_CIPHER_PREFERENCE
158   %token  DEFAULT_FLOODCOUNT
159   %token  DEFAULT_SPLIT_SERVER_COUNT
160   %token  DEFAULT_SPLIT_USER_COUNT
# Line 194 | Line 190 | unhook_hub_leaf_confs(void)
190   %token  NEED_IDENT
191   %token  HAVENT_READ_CONF
192   %token  HIDDEN
197 %token  HIDDEN_ADMIN
193   %token  HIDDEN_NAME
199 %token  HIDDEN_OPER
194   %token  HIDE_SERVER_IPS
195   %token  HIDE_SERVERS
196   %token  HIDE_SPOOF_IPS
# Line 280 | 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 290 | Line 285 | unhook_hub_leaf_confs(void)
285   %token  SEND_PASSWORD
286   %token  SERVERHIDE
287   %token  SERVERINFO
293 %token  SERVLINK_PATH
288   %token  IRCD_SID
289   %token  TKLINE_EXPIRE_NOTICES
290   %token  T_SHARED
# Line 317 | 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
# Line 339 | 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
# Line 471 | 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 490 | 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 524 | 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 531 | 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 573 | 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,
577 <      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 606 | 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 896 | 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 931 | 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 977 | Line 1022 | oper_entry: OPERATOR
1022    }
1023   };
1024  
980 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 995 | Line 1039 | oper_name: NAME '=' QSTRING ';'
1039    }
1040   };
1041  
998 oper_name_t: QSTRING
999 {
1000  if (conf_parser_ctx.pass == 2)
1001  {
1002    if (strlen(yylval.string) > OPERNICKLEN)
1003      yylval.string[OPERNICKLEN] = '\0';
1004
1005    MyFree(yy_conf->name);
1006    DupString(yy_conf->name, yylval.string);
1007  }
1008 };
1009
1042   oper_user: USER '=' QSTRING ';'
1043   {
1044    if (conf_parser_ctx.pass == 2)
# Line 1028 | 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 1146 | 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 1223 | Line 1262 | oper_flags_item: GLOBAL_KILL
1262   {
1263    if (conf_parser_ctx.pass == 2)
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)
# Line 1247 | Line 1294 | oper_flags_item: GLOBAL_KILL
1294   {
1295    if (conf_parser_ctx.pass == 2)
1296      yy_aconf->port |= OPER_FLAG_ADMIN;
1250 } | HIDDEN_ADMIN
1251 {
1252  if (conf_parser_ctx.pass == 2)
1253    yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1297   } | NICK_CHANGES
1298   {
1299    if (conf_parser_ctx.pass == 2)
# Line 1267 | Line 1310 | oper_flags_item: GLOBAL_KILL
1310   {
1311    if (conf_parser_ctx.pass == 2)
1312      yy_aconf->port |= OPER_FLAG_OPER_SPY;
1270 } | HIDDEN_OPER
1271 {
1272  if (conf_parser_ctx.pass == 2)
1273    yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1313   } | REMOTEBAN
1314   {
1315    if (conf_parser_ctx.pass == 2)
# Line 1292 | 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 1303 | 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 1335 | Line 1374 | class_entry: CLASS
1374    }
1375   };
1376  
1338 class_name_b: | class_name_t;
1339
1377   class_items:    class_items class_item | class_item;
1378   class_item:     class_name |
1379                  class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
# Line 1361 | Line 1398 | class_name: NAME '=' QSTRING ';'
1398    }
1399   };
1400  
1364 class_name_t: QSTRING
1365 {
1366  if (conf_parser_ctx.pass == 1)
1367  {
1368    MyFree(yy_class_name);
1369    DupString(yy_class_name, yylval.string);
1370  }
1371 };
1372
1401   class_ping_time: PING_TIME '=' timespec ';'
1402   {
1403    if (conf_parser_ctx.pass == 1)
# Line 1912 | Line 1940 | shared_type_item: KLINE
1940   {
1941    if (conf_parser_ctx.pass == 2)
1942      yy_match_item->action |= SHARED_KLINE;
1915 } | TKLINE
1916 {
1917  if (conf_parser_ctx.pass == 2)
1918    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_TXLINE;
1954 >    yy_match_item->action |= SHARED_UNDLINE;
1955 > } | XLINE
1956 > {
1957 >  if (conf_parser_ctx.pass == 2)
1958 >    yy_match_item->action |= SHARED_XLINE;
1959   } | T_UNXLINE
1960   {
1961    if (conf_parser_ctx.pass == 2)
# Line 1936 | Line 1964 | shared_type_item: KLINE
1964   {
1965    if (conf_parser_ctx.pass == 2)
1966      yy_match_item->action |= SHARED_RESV;
1939 } | TRESV
1940 {
1941  if (conf_parser_ctx.pass == 2)
1942    yy_match_item->action |= SHARED_TRESV;
1967   } | T_UNRESV
1968   {
1969    if (conf_parser_ctx.pass == 2)
# Line 1994 | Line 2018 | cluster_type_item: KLINE
2018   {
2019    if (conf_parser_ctx.pass == 2)
2020      yy_conf->flags |= SHARED_KLINE;
1997 } | TKLINE
1998 {
1999  if (conf_parser_ctx.pass == 2)
2000    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_UNDLINE;
2033 > } | XLINE
2034   {
2035    if (conf_parser_ctx.pass == 2)
2036 <    yy_conf->flags |= SHARED_TXLINE;
2036 >    yy_conf->flags |= SHARED_XLINE;
2037   } | T_UNXLINE
2038   {
2039    if (conf_parser_ctx.pass == 2)
# Line 2018 | Line 2042 | cluster_type_item: KLINE
2042   {
2043    if (conf_parser_ctx.pass == 2)
2044      yy_conf->flags |= SHARED_RESV;
2021 } | TRESV
2022 {
2023  if (conf_parser_ctx.pass == 2)
2024    yy_conf->flags |= SHARED_TRESV;
2045   } | T_UNRESV
2046   {
2047    if (conf_parser_ctx.pass == 2)
# Line 2044 | 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;
2071    }
# Line 2054 | Line 2074 | connect_entry: CONNECT
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;
2065 < #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
2101 <        {
2102 <          /* Even if yy_conf ->name is NULL
2103 <           * should still unhook any hub/leaf confs still pending
2104 <           */
2105 <          unhook_hub_leaf_confs();
2106 <
2107 <          if (yy_conf->name != NULL)
2108 <          {
2090 < #ifndef HAVE_LIBCRYPTO
2091 <            if (IsConfCryptLink(yy_aconf))
2092 <              yyerror("Ignoring connect block -- no OpenSSL support");
2093 < #else
2094 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2095 <              yyerror("Ignoring connect block -- missing key");
2096 < #endif
2097 <            if (yy_aconf->host == NULL)
2098 <              yyerror("Ignoring connect block -- missing host");
2099 <            else if (!IsConfCryptLink(yy_aconf) &&
2100 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2101 <              yyerror("Ignoring connect block -- missing password");
2102 <          }
2103 <
2104 <
2105 <          /* XXX
2106 <           * This fixes a try_connections() core (caused by invalid class_ptr
2107 <           * pointers) reported by metalrock. That's an ugly fix, but there
2108 <           * is currently no better way. The entire config subsystem needs an
2109 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2110 <           * a doubly linked list immediately without any sanity checks!  -Michael
2111 <           */
2112 <          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 >      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 <          yy_aconf = NULL;
2111 <          yy_conf = NULL;
2112 <        }
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 2182 | Line 2188 | connect_entry: CONNECT
2188    }
2189   };
2190  
2185 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 |
2192 <                connect_rsa_public_key_file | connect_cipher_preference |
2196 >                connect_class | connect_encrypted |
2197                  error ';' ;
2198  
2199   connect_name: NAME '=' QSTRING ';'
# Line 2204 | Line 2208 | connect_name: NAME '=' QSTRING ';'
2208    }
2209   };
2210  
2207 connect_name_t: QSTRING
2208 {
2209  if (conf_parser_ctx.pass == 2)
2210  {
2211    if (yy_conf->name != NULL)
2212      yyerror("Multiple connect name entry");
2213
2214    MyFree(yy_conf->name);
2215    DupString(yy_conf->name, yylval.string);
2216  }
2217 };
2218
2211   connect_host: HOST '=' QSTRING ';'
2212   {
2213    if (conf_parser_ctx.pass == 2)
# Line 2310 | 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: COMPRESSED
2314 < {
2315 <  if (conf_parser_ctx.pass == 2)
2316 < #ifndef HAVE_LIBZ
2317 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2318 < #else
2319 < {
2320 <   SetConfCompressed(yy_aconf);
2321 < }
2322 < #endif
2323 < } | CRYPTLINK
2324 < {
2325 <  if (conf_parser_ctx.pass == 2)
2326 <    SetConfCryptLink(yy_aconf);
2327 < } | AUTOCONN
2305 > connect_flags_item: AUTOCONN
2306   {
2307    if (conf_parser_ctx.pass == 2)
2308      SetConfAllowAutoConn(yy_aconf);
# Line 2336 | Line 2314 | connect_flags_item: COMPRESSED
2314   {
2315    if (conf_parser_ctx.pass == 2)
2316      SetConfTopicBurst(yy_aconf);
2317 < };
2340 <
2341 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2317 > } | T_SSL
2318   {
2343 #ifdef HAVE_LIBCRYPTO
2319    if (conf_parser_ctx.pass == 2)
2320 <  {
2346 <    BIO *file;
2347 <
2348 <    if (yy_aconf->rsa_public_key != NULL)
2349 <    {
2350 <      RSA_free(yy_aconf->rsa_public_key);
2351 <      yy_aconf->rsa_public_key = NULL;
2352 <    }
2353 <
2354 <    if (yy_aconf->rsa_public_key_file != NULL)
2355 <    {
2356 <      MyFree(yy_aconf->rsa_public_key_file);
2357 <      yy_aconf->rsa_public_key_file = NULL;
2358 <    }
2359 <
2360 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2361 <
2362 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2363 <    {
2364 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2365 <      break;
2366 <    }
2367 <
2368 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2369 <
2370 <    if (yy_aconf->rsa_public_key == NULL)
2371 <    {
2372 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2373 <      break;
2374 <    }
2375 <      
2376 <    BIO_set_close(file, BIO_CLOSE);
2377 <    BIO_free(file);
2378 <  }
2379 < #endif /* HAVE_LIBCRYPTO */
2320 >    SetConfSSL(yy_aconf);
2321   };
2322  
2323   connect_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 2425 | 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;
2435 <    int found = 0;
2436 <
2437 <    yy_aconf->cipher_preference = NULL;
2438 <    cipher_name = yylval.string;
2439 <
2440 <    for (ecap = CipherTable; ecap->name; ecap++)
2441 <    {
2442 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2443 <          (ecap->cap & CAP_ENC_MASK))
2444 <      {
2445 <        yy_aconf->cipher_preference = ecap;
2446 <        found = 1;
2447 <        break;
2448 <      }
2449 <    }
2450 <
2451 <    if (!found)
2452 <      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 2728 | Line 2652 | general_item:       general_hide_spoof_i
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 |
2733 <                    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 |
# Line 2959 | Line 2882 | general_max_targets: MAX_TARGETS '=' NUM
2882    ConfigFileEntry.max_targets = $3;
2883   };
2884  
2962 general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
2963 {
2964  if (conf_parser_ctx.pass == 2)
2965  {
2966    MyFree(ConfigFileEntry.servlink_path);
2967    DupString(ConfigFileEntry.servlink_path, yylval.string);
2968  }
2969 };
2970
2971 general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
2972 {
2973 #ifdef HAVE_LIBCRYPTO
2974  if (conf_parser_ctx.pass == 2)
2975  {
2976    struct EncCapability *ecap;
2977    const char *cipher_name;
2978    int found = 0;
2979
2980    ConfigFileEntry.default_cipher_preference = NULL;
2981    cipher_name = yylval.string;
2982
2983    for (ecap = CipherTable; ecap->name; ecap++)
2984    {
2985      if ((irccmp(ecap->name, cipher_name) == 0) &&
2986          (ecap->cap & CAP_ENC_MASK))
2987      {
2988        ConfigFileEntry.default_cipher_preference = ecap;
2989        found = 1;
2990        break;
2991      }
2992    }
2993
2994    if (!found)
2995      yyerror("Invalid cipher");
2996  }
2997 #else
2998  if (conf_parser_ctx.pass == 2)
2999    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3000 #endif
3001 };
3002
3003 general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3004 {
3005  if (conf_parser_ctx.pass == 2)
3006  {
3007    ConfigFileEntry.compression_level = $3;
3008 #ifndef HAVE_LIBZ
3009    yyerror("Ignoring compression_level -- no zlib support");
3010 #else
3011    if ((ConfigFileEntry.compression_level < 1) ||
3012        (ConfigFileEntry.compression_level > 9))
3013    {
3014      yyerror("Ignoring invalid compression_level, using default");
3015      ConfigFileEntry.compression_level = 0;
3016    }
3017 #endif
3018  }
3019 };
3020
2885   general_use_egd: USE_EGD '=' TBOOL ';'
2886   {
2887    ConfigFileEntry.use_egd = yylval.number;
# Line 3080 | 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 3148 | 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;

Diff Legend

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