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

Comparing ircd-hybrid/trunk/src/conf_parser.y (file contents):
Revision 2252 by michael, Sun Jun 16 13:29:13 2013 UTC vs.
Revision 2916 by michael, Sat Jan 25 21:09:18 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  conf_parser.y: Parses the ircd configuration file.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2005 by the past and present ircd coders, and others.
4 > *  Copyright (c) 2000-2014 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 18 | Line 17
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   *  USA
21 *
22 *  $Id$
20   */
21  
22 + /*! \file conf_parser.y
23 + * \brief Parses the ircd configuration file.
24 + * \version $Id$
25 + */
26 +
27 +
28   %{
29  
30   #define YY_NO_UNPUT
# Line 157 | Line 160 | reset_block_state(void)
160   %token  CLASS
161   %token  CONNECT
162   %token  CONNECTFREQ
163 + %token  CYCLE_ON_HOST_CHANGE
164   %token  DEFAULT_FLOODCOUNT
165   %token  DEFAULT_SPLIT_SERVER_COUNT
166   %token  DEFAULT_SPLIT_USER_COUNT
# Line 289 | Line 293 | reset_block_state(void)
293   %token  STATS_K_OPER_ONLY
294   %token  STATS_O_OPER_ONLY
295   %token  STATS_P_OPER_ONLY
296 + %token  STATS_U_OPER_ONLY
297   %token  T_ALL
298   %token  T_BOTS
299   %token  T_CALLERID
# Line 365 | Line 370 | reset_block_state(void)
370   %type  <number> sizespec_
371  
372   %%
373 < conf:  
373 > conf:
374          | conf conf_item
375          ;
376  
# Line 373 | Line 378 | conf_item:        admin_entry
378                  | logging_entry
379                  | oper_entry
380                  | channel_entry
381 <                | class_entry
381 >                | class_entry
382                  | listen_entry
383                  | auth_entry
384                  | serverinfo_entry
# Line 511 | Line 516 | server_method_type_item: T_SSLV3
516   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
517   {
518   #ifdef HAVE_LIBCRYPTO
519 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
519 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
520    {
521      if (!ServerInfo.rsa_private_key_file)
522      {
# Line 598 | Line 603 | serverinfo_rsa_private_key_file: RSA_PRI
603      break;
604    }
605  
606 <  /* require 2048 bit (256 byte) key */
602 <  if (RSA_size(ServerInfo.rsa_private_key) != 256)
606 >  if (RSA_size(ServerInfo.rsa_private_key) < 128)
607    {
608      RSA_free(ServerInfo.rsa_private_key);
609      ServerInfo.rsa_private_key = NULL;
610  
611 <    conf_error_report("Not a 2048 bit key, ignoring");
611 >    conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size");
612    }
613   #endif
614   };
# Line 645 | Line 649 | serverinfo_ssl_cipher_list: T_SSL_CIPHER
649   #endif
650   };
651  
652 < serverinfo_name: NAME '=' QSTRING ';'
652 > serverinfo_name: NAME '=' QSTRING ';'
653   {
654    /* this isn't rehashable */
655    if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
# Line 660 | Line 664 | serverinfo_name: NAME '=' QSTRING ';'
664    }
665   };
666  
667 < serverinfo_sid: IRCD_SID '=' QSTRING ';'
667 > serverinfo_sid: IRCD_SID '=' QSTRING ';'
668   {
669    /* this isn't rehashable */
670    if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
# Line 834 | Line 838 | serverinfo_max_topic_length: MAX_TOPIC_L
838      ServerInfo.max_topic_length = $3;
839   };
840  
841 < serverinfo_hub: HUB '=' TBOOL ';'
841 > serverinfo_hub: HUB '=' TBOOL ';'
842   {
843    if (conf_parser_ctx.pass == 2)
844      ServerInfo.hub = yylval.number;
# Line 849 | Line 853 | admin_items: admin_items admin_item | ad
853   admin_item:  admin_name | admin_description |
854               admin_email | error ';' ;
855  
856 < admin_name: NAME '=' QSTRING ';'
856 > admin_name: NAME '=' QSTRING ';'
857   {
858    if (conf_parser_ctx.pass != 2)
859      break;
# Line 879 | Line 883 | admin_description: DESCRIPTION '=' QSTRI
883   /***************************************************************************
884   * motd section
885   ***************************************************************************/
886 < motd_entry: MOTD
886 > motd_entry: MOTD
887   {
888    if (conf_parser_ctx.pass == 2)
889      reset_block_state();
# Line 900 | Line 904 | motd_entry: MOTD
904   motd_items: motd_items motd_item | motd_item;
905   motd_item:  motd_mask | motd_file | error ';' ;
906  
907 < motd_mask: MASK '=' QSTRING ';'
907 > motd_mask: MASK '=' QSTRING ';'
908   {
909    if (conf_parser_ctx.pass == 2)
910      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
# Line 982 | Line 986 | logging_file_type_item:  USER
986   {
987    if (conf_parser_ctx.pass == 2)
988      block_state.type.value = LOG_TYPE_GLINE;
989 + } | XLINE
990 + {
991 +  if (conf_parser_ctx.pass == 2)
992 +    block_state.type.value = LOG_TYPE_XLINE;
993 + } | RESV
994 + {
995 +  if (conf_parser_ctx.pass == 2)
996 +    block_state.type.value = LOG_TYPE_RESV;
997   } | T_DLINE
998   {
999    if (conf_parser_ctx.pass == 2)
# Line 1004 | Line 1016 | logging_file_type_item:  USER
1016   /***************************************************************************
1017   * section oper
1018   ***************************************************************************/
1019 < oper_entry: OPERATOR
1019 > oper_entry: OPERATOR
1020   {
1021    if (conf_parser_ctx.pass != 2)
1022      break;
# Line 1292 | Line 1304 | oper_flags_item: KILL ':' REMOTE
1304   } | XLINE
1305   {
1306    if (conf_parser_ctx.pass == 2)
1307 <    block_state.port.value |= OPER_FLAG_X;
1307 >    block_state.port.value |= OPER_FLAG_XLINE;
1308 > } | T_UNXLINE
1309 > {
1310 >  if (conf_parser_ctx.pass == 2)
1311 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1312   } | GLINE
1313   {
1314    if (conf_parser_ctx.pass == 2)
# Line 1425 | Line 1441 | class_item:     class_name |
1441                  class_flags |
1442                  error ';' ;
1443  
1444 < class_name: NAME '=' QSTRING ';'
1444 > class_name: NAME '=' QSTRING ';'
1445   {
1446    if (conf_parser_ctx.pass == 1)
1447      strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
# Line 1665 | Line 1681 | auth_entry: IRCD_AUTH
1681      conf_add_class_to_conf(conf, block_state.class.buf);
1682      add_conf_by_address(CONF_CLIENT, conf);
1683    }
1684 < };
1684 > };
1685  
1686   auth_items:     auth_items auth_item | auth_item;
1687   auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
# Line 1750 | Line 1766 | auth_flags_item: SPOOF_NOTICE
1766      block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1767   };
1768  
1769 < auth_spoof: SPOOF '=' QSTRING ';'
1769 > auth_spoof: SPOOF '=' QSTRING ';'
1770   {
1771    if (conf_parser_ctx.pass != 2)
1772      break;
# Line 2033 | Line 2049 | cluster_type_item: KLINE
2049   /***************************************************************************
2050   *  section connect
2051   ***************************************************************************/
2052 < connect_entry: CONNECT  
2052 > connect_entry: CONNECT
2053   {
2054  
2055    if (conf_parser_ctx.pass != 2)
2056      break;
2057  
2058    reset_block_state();
2059 +  block_state.aftype.value = AF_INET;
2060    block_state.port.value = PORTNUM;
2061   } '{' connect_items '}' ';'
2062   {
# Line 2110 | Line 2127 | connect_item:   connect_name | connect_h
2127                  connect_ssl_certificate_fingerprint |
2128                  connect_aftype | connect_port | connect_ssl_cipher_list |
2129                  connect_flags | connect_hub_mask | connect_leaf_mask |
2130 <                connect_class | connect_encrypted |
2130 >                connect_class | connect_encrypted |
2131                  error ';' ;
2132  
2133   connect_name: NAME '=' QSTRING ';'
# Line 2119 | Line 2136 | connect_name: NAME '=' QSTRING ';'
2136      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2137   };
2138  
2139 < connect_host: HOST '=' QSTRING ';'
2139 > connect_host: HOST '=' QSTRING ';'
2140   {
2141    if (conf_parser_ctx.pass == 2)
2142      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2143   };
2144  
2145 < connect_vhost: VHOST '=' QSTRING ';'
2145 > connect_vhost: VHOST '=' QSTRING ';'
2146   {
2147    if (conf_parser_ctx.pass == 2)
2148      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2149   };
2150 <
2150 >
2151   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2152   {
2153    if (conf_parser_ctx.pass != 2)
# Line 2208 | Line 2225 | connect_encrypted: ENCRYPTED '=' TBOOL '
2225    }
2226   };
2227  
2228 < connect_hub_mask: HUB_MASK '=' QSTRING ';'
2228 > connect_hub_mask: HUB_MASK '=' QSTRING ';'
2229   {
2230    if (conf_parser_ctx.pass == 2)
2231      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2232   };
2233  
2234 < connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2234 > connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2235   {
2236    if (conf_parser_ctx.pass == 2)
2237      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
# Line 2265 | Line 2282 | kill_entry: KILL
2282    else
2283      conf->reason = xstrdup(CONF_NOREASON);
2284    add_conf_by_address(CONF_KLINE, conf);
2285 < };
2285 > };
2286  
2287   kill_items:     kill_items kill_item | kill_item;
2288   kill_item:      kill_user | kill_reason | error;
# Line 2290 | Line 2307 | kill_user: USER '=' QSTRING ';'
2307    }
2308   };
2309  
2310 < kill_reason: REASON '=' QSTRING ';'
2310 > kill_reason: REASON '=' QSTRING ';'
2311   {
2312    if (conf_parser_ctx.pass == 2)
2313      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2299 | Line 2316 | kill_reason: REASON '=' QSTRING ';'
2316   /***************************************************************************
2317   *  section deny
2318   ***************************************************************************/
2319 < deny_entry: DENY
2319 > deny_entry: DENY
2320   {
2321    if (conf_parser_ctx.pass == 2)
2322      reset_block_state();
# Line 2324 | Line 2341 | deny_entry: DENY
2341        conf->reason = xstrdup(CONF_NOREASON);
2342      add_conf_by_address(CONF_DLINE, conf);
2343    }
2344 < };
2344 > };
2345  
2346   deny_items:     deny_items deny_item | deny_item;
2347   deny_item:      deny_ip | deny_reason | error;
# Line 2335 | Line 2352 | deny_ip: IP '=' QSTRING ';'
2352      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2353   };
2354  
2355 < deny_reason: REASON '=' QSTRING ';'
2355 > deny_reason: REASON '=' QSTRING ';'
2356   {
2357    if (conf_parser_ctx.pass == 2)
2358      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2392 | Line 2409 | gecos_entry: GECOS
2409   gecos_items: gecos_items gecos_item | gecos_item;
2410   gecos_item:  gecos_name | gecos_reason | error;
2411  
2412 < gecos_name: NAME '=' QSTRING ';'
2412 > gecos_name: NAME '=' QSTRING ';'
2413   {
2414    if (conf_parser_ctx.pass == 2)
2415      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2416   };
2417  
2418 < gecos_reason: REASON '=' QSTRING ';'
2418 > gecos_reason: REASON '=' QSTRING ';'
2419   {
2420    if (conf_parser_ctx.pass == 2)
2421      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
# Line 2422 | Line 2439 | general_item:       general_hide_spoof_i
2439                      general_stats_o_oper_only | general_stats_k_oper_only |
2440                      general_pace_wait | general_stats_i_oper_only |
2441                      general_pace_wait_simple | general_stats_P_oper_only |
2442 +                    general_stats_u_oper_only |
2443                      general_short_motd | general_no_oper_flood |
2444                      general_true_no_oper_flood | general_oper_pass_resv |
2445                      general_oper_only_umodes | general_max_targets |
# Line 2431 | Line 2449 | general_item:       general_hide_spoof_i
2449                      general_min_nonwildcard | general_min_nonwildcard_simple |
2450                      general_throttle_time | general_havent_read_conf |
2451                      general_ping_cookie |
2452 <                    general_disable_auth |
2452 >                    general_disable_auth |
2453                      general_tkline_expire_notices | general_gline_enable |
2454                      general_gline_duration | general_gline_request_duration |
2455                      general_gline_min_cidr |
2456                      general_gline_min_cidr6 |
2457                      general_stats_e_disabled |
2458                      general_max_watch | general_services_name |
2459 +                    general_cycle_on_host_change |
2460                      error;
2461  
2462  
# Line 2446 | Line 2465 | general_max_watch: MAX_WATCH '=' NUMBER
2465    ConfigFileEntry.max_watch = $3;
2466   };
2467  
2468 + general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2469 + {
2470 +  if (conf_parser_ctx.pass == 2)
2471 +    ConfigFileEntry.cycle_on_host_change = yylval.number;
2472 + };
2473 +
2474   general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2475   {
2476    if (conf_parser_ctx.pass == 2)
# Line 2506 | Line 2531 | general_anti_nick_flood: ANTI_NICK_FLOOD
2531  
2532   general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2533   {
2534 <  ConfigFileEntry.max_nick_time = $3;
2534 >  ConfigFileEntry.max_nick_time = $3;
2535   };
2536  
2537   general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
# Line 2571 | Line 2596 | general_stats_P_oper_only: STATS_P_OPER_
2596    ConfigFileEntry.stats_P_oper_only = yylval.number;
2597   };
2598  
2599 + general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2600 + {
2601 +  ConfigFileEntry.stats_u_oper_only = yylval.number;
2602 + };
2603 +
2604   general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2605   {
2606    ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
# Line 2611 | Line 2641 | general_short_motd: SHORT_MOTD '=' TBOOL
2641   {
2642    ConfigFileEntry.short_motd = yylval.number;
2643   };
2644 <  
2644 >
2645   general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2646   {
2647    ConfigFileEntry.no_oper_flood = yylval.number;
# Line 2746 | Line 2776 | umode_oitem:     T_BOTS
2776    ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT;
2777   };
2778  
2779 < general_oper_only_umodes: OPER_ONLY_UMODES
2779 > general_oper_only_umodes: OPER_ONLY_UMODES
2780   {
2781    ConfigFileEntry.oper_only_umodes = 0;
2782   } '='  umode_items ';' ;
2783  
2784   umode_items:    umode_items ',' umode_item | umode_item;
2785 < umode_item:     T_BOTS
2785 > umode_item:     T_BOTS
2786   {
2787    ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2788   } | T_CCONN
# Line 2765 | Line 2795 | umode_item:    T_BOTS
2795   {
2796    ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2797   } | T_FULL
2798 < {
2798 > {
2799    ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2800   } | T_SKILL
2801   {
# Line 2917 | Line 2947 | serverhide_entry: SERVERHIDE
2947    '{' serverhide_items '}' ';';
2948  
2949   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2950 < serverhide_item:    serverhide_flatten_links | serverhide_disable_remote_commands |
2950 > serverhide_item:    serverhide_flatten_links | serverhide_disable_remote_commands |
2951                      serverhide_hide_servers |
2952                      serverhide_hide_services |
2953                      serverhide_links_delay |

Diff Legend

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