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 1228 by michael, Mon Sep 19 09:38:38 2011 UTC vs.
Revision 1285 by michael, Sun Feb 5 15:12:59 2012 UTC

# Line 70 | Line 70 | static char userbuf[IRCD_BUFSIZE];
70   static char hostbuf[IRCD_BUFSIZE];
71   static char reasonbuf[REASONLEN + 1];
72   static char gecos_name[REALLEN * 4];
73 <
73 > static char lfile[IRCD_BUFSIZE];
74 > static unsigned int ltype = 0;
75 > static unsigned int lsize = 0;
76   static char *resv_reason = NULL;
77   static char *listener_address = NULL;
78  
# Line 179 | Line 181 | unhook_hub_leaf_confs(void)
181   %token  FAILED_OPER_NOTICE
182   %token  IRCD_FLAGS
183   %token  FLATTEN_LINKS
182 %token  FFAILED_OPERLOG
183 %token  FKILLLOG
184 %token  FKLINELOG
185 %token  FGLINELOG
186 %token  FIOERRLOG
187 %token  FOPERLOG
188 %token  FOPERSPYLOG
189 %token  FUSERLOG
184   %token  GECOS
185   %token  GENERAL
186   %token  GLINE
187   %token  GLINES
188   %token  GLINE_EXEMPT
195 %token  GLINE_LOG
189   %token  GLINE_TIME
190   %token  GLINE_MIN_CIDR
191   %token  GLINE_MIN_CIDR6
# Line 225 | Line 218 | unhook_hub_leaf_confs(void)
218   %token  LINKS_DELAY
219   %token  LISTEN
220   %token  T_LOG
228 %token  LOGGING
229 %token  LOG_LEVEL
221   %token  MAX_ACCEPT
222   %token  MAX_BANS
223   %token  MAX_CHANS_PER_USER
# Line 260 | Line 251 | unhook_hub_leaf_confs(void)
251   %token  NUMBER_PER_IP_GLOBAL
252   %token  OPERATOR
253   %token  OPERS_BYPASS_CALLERID
263 %token  OPER_LOG
254   %token  OPER_ONLY_UMODES
255   %token  OPER_PASS_RESV
256   %token  OPER_SPY_T
# Line 330 | Line 320 | unhook_hub_leaf_confs(void)
320   %token  T_CLIENT_FLOOD
321   %token  T_DEAF
322   %token  T_DEBUG
323 + %token  T_DLINE
324   %token  T_DRONE
325   %token  T_EXTERNAL
326   %token  T_FULL
# Line 337 | Line 328 | unhook_hub_leaf_confs(void)
328   %token  T_IPV4
329   %token  T_IPV6
330   %token  T_LOCOPS
340 %token  T_LOGPATH
341 %token  T_L_CRIT
342 %token  T_L_DEBUG
343 %token  T_L_ERROR
344 %token  T_L_INFO
345 %token  T_L_NOTICE
346 %token  T_L_TRACE
347 %token  T_L_WARN
331   %token  T_MAX_CLIENTS
332   %token  T_NCHANGE
333   %token  T_OPERWALL
# Line 356 | Line 339 | unhook_hub_leaf_confs(void)
339   %token  T_SSL
340   %token  T_UMODES
341   %token  T_UNAUTH
342 + %token  T_UNLIMITED
343   %token  T_UNRESV
344   %token  T_UNXLINE
345   %token  T_GLOBOPS
# Line 363 | Line 347 | unhook_hub_leaf_confs(void)
347   %token  T_RESTART
348   %token  T_SERVICE
349   %token  T_SERVICES_NAME
350 + %token  T_TIMESTAMP
351   %token  THROTTLE_TIME
352   %token  TOPICBURST
353   %token  TRUE_NO_OPER_FLOOD
# Line 382 | Line 367 | unhook_hub_leaf_confs(void)
367   %token  XLINE
368   %token  WARN
369   %token  WARN_NO_NLINE
370 + %token  T_SIZE
371 + %token  T_FILE
372  
373   %type <string> QSTRING
374   %type <number> NUMBER
# Line 628 | Line 615 | serverinfo_name: NAME '=' QSTRING ';'
615        DupString(ServerInfo.name, yylval.string);
616      else
617      {
618 <      ilog(L_ERROR, "Ignoring serverinfo::name -- invalid name. Aborting.");
618 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
619        exit(0);
620      }
621    }
# Line 643 | Line 630 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
630        DupString(ServerInfo.sid, yylval.string);
631      else
632      {
633 <      ilog(L_ERROR, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
633 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
634        exit(0);
635      }
636    }
# Line 694 | Line 681 | serverinfo_vhost: VHOST '=' QSTRING ';'
681      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
682  
683      if (getaddrinfo(yylval.string, NULL, &hints, &res))
684 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
684 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
685      else
686      {
687        assert(res != NULL);
# Line 723 | Line 710 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
710      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
711  
712      if (getaddrinfo(yylval.string, NULL, &hints, &res))
713 <      ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
713 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
714      else
715      {
716        assert(res != NULL);
# Line 807 | Line 794 | admin_description: DESCRIPTION '=' QSTRI
794   /***************************************************************************
795   *  section logging
796   ***************************************************************************/
797 < /* XXX */
798 < logging_entry:          LOGGING  '{' logging_items '}' ';' ;
812 <
813 < logging_items:          logging_items logging_item |
814 <                        logging_item ;
797 > logging_entry:          T_LOG  '{' logging_items '}' ';' ;
798 > logging_items:          logging_items logging_item | logging_item ;
799  
800 < 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 |
800 > logging_item:           logging_use_logging | logging_timestamp | logging_file_entry |
801                          error ';' ;
802  
803 < logging_path:           T_LOGPATH '=' QSTRING ';'
826 <                        {
827 <                        };
828 <
829 < logging_oper_log:       OPER_LOG '=' QSTRING ';'
830 <                        {
831 <                        };
832 <
833 < logging_fuserlog: FUSERLOG '=' QSTRING ';'
803 > logging_use_logging: USE_LOGGING '=' TBOOL ';'
804   {
805    if (conf_parser_ctx.pass == 2)
806 <    strlcpy(ConfigLoggingEntry.userlog, yylval.string,
837 <            sizeof(ConfigLoggingEntry.userlog));
806 >    ConfigLoggingEntry.use_logging = yylval.number;
807   };
808  
809 < logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
809 > logging_timestamp: T_TIMESTAMP '=' TBOOL ';'
810   {
811    if (conf_parser_ctx.pass == 2)
812 <    strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
844 <            sizeof(ConfigLoggingEntry.failed_operlog));
812 >    ConfigLoggingEntry.timestamp = yylval.number;
813   };
814  
815 < logging_foperlog: FOPERLOG '=' QSTRING ';'
815 > logging_file_entry:
816   {
817 <  if (conf_parser_ctx.pass == 2)
818 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
819 <            sizeof(ConfigLoggingEntry.operlog));
820 < };
853 <
854 < logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
817 >  lfile[0] = '\0';
818 >  ltype = 0;
819 >  lsize = 0;
820 > } T_FILE  '{' logging_file_items '}' ';'
821   {
822 <  if (conf_parser_ctx.pass == 2)
823 <    strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
858 <            sizeof(ConfigLoggingEntry.operspylog));
822 >  if (conf_parser_ctx.pass == 2 && ltype > 0)
823 >    log_add_file(ltype, lsize, lfile);
824   };
825  
826 < logging_fglinelog: FGLINELOG '=' QSTRING ';'
827 < {
828 <  if (conf_parser_ctx.pass == 2)
829 <    strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
830 <            sizeof(ConfigLoggingEntry.glinelog));
866 < };
826 > logging_file_items: logging_file_items logging_file_item |
827 >                    logging_file_item ;
828 >
829 > logging_file_item:  logging_file_name | logging_file_type |
830 >                    logging_file_size | error ';' ;
831  
832 < logging_fklinelog: FKLINELOG '=' QSTRING ';'
832 > logging_file_name: NAME '=' QSTRING ';'
833   {
834 <  if (conf_parser_ctx.pass == 2)
835 <    strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
872 <            sizeof(ConfigLoggingEntry.klinelog));
873 < };
834 >  strlcpy(lfile, yylval.string, sizeof(lfile));
835 > }
836  
837 < logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
837 > logging_file_size: T_SIZE '=' sizespec ';'
838   {
839 <  if (conf_parser_ctx.pass == 2)
840 <    strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
841 <            sizeof(ConfigLoggingEntry.ioerrlog));
839 >  lsize = $3;
840 > } | T_SIZE '=' T_UNLIMITED ';'
841 > {
842 >  lsize = 0;
843   };
844  
845 < logging_killlog: FKILLLOG '=' QSTRING ';'
845 > logging_file_type: TYPE
846   {
847    if (conf_parser_ctx.pass == 2)
848 <    strlcpy(ConfigLoggingEntry.killlog, yylval.string,
849 <            sizeof(ConfigLoggingEntry.killlog));
887 < };
848 >    ltype = 0;
849 > } '='  logging_file_type_items ';' ;
850  
851 < logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
852 < {
891 <  if (conf_parser_ctx.pass == 2)
892 <    set_log_level(L_CRIT);
893 < } | LOG_LEVEL '=' T_L_ERROR ';'
851 > logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
852 > logging_file_type_item:  USER
853   {
854    if (conf_parser_ctx.pass == 2)
855 <    set_log_level(L_ERROR);
856 < } | LOG_LEVEL '=' T_L_WARN ';'
855 >    ltype = LOG_TYPE_USER;
856 > } | OPERATOR
857   {
858    if (conf_parser_ctx.pass == 2)
859 <    set_log_level(L_WARN);
860 < } | LOG_LEVEL '=' T_L_NOTICE ';'
859 >    ltype = LOG_TYPE_OPER;
860 > } | GLINE
861   {
862    if (conf_parser_ctx.pass == 2)
863 <    set_log_level(L_NOTICE);
864 < } | LOG_LEVEL '=' T_L_TRACE ';'
863 >    ltype = LOG_TYPE_GLINE;
864 > } | T_DLINE
865   {
866    if (conf_parser_ctx.pass == 2)
867 <    set_log_level(L_TRACE);
868 < } | LOG_LEVEL '=' T_L_INFO ';'
867 >    ltype = LOG_TYPE_DLINE;
868 > } | KLINE
869   {
870    if (conf_parser_ctx.pass == 2)
871 <    set_log_level(L_INFO);
872 < } | LOG_LEVEL '=' T_L_DEBUG ';'
871 >    ltype = LOG_TYPE_KLINE;
872 > } | KILL
873   {
874    if (conf_parser_ctx.pass == 2)
875 <    set_log_level(L_DEBUG);
876 < };
918 <
919 < logging_use_logging: USE_LOGGING '=' TBOOL ';'
875 >    ltype = LOG_TYPE_KILL;
876 > } | T_DEBUG
877   {
878    if (conf_parser_ctx.pass == 2)
879 <    ConfigLoggingEntry.use_logging = yylval.number;
879 >    ltype = LOG_TYPE_DEBUG;
880   };
881  
882 +
883   /***************************************************************************
884   * section oper
885   ***************************************************************************/
# Line 938 | Line 896 | oper_entry: OPERATOR
896      MyFree(class_name);
897      class_name = NULL;
898    }
899 < } oper_name_b '{' oper_items '}' ';'
899 > } '{' oper_items '}' ';'
900   {
901    if (conf_parser_ctx.pass == 2)
902    {
# Line 973 | Line 931 | oper_entry: OPERATOR
931          DupString(new_aconf->host, yy_tmp->host);
932        else
933          DupString(new_aconf->host, "*");
934 +
935 +      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->ipnum,
936 +                                     &new_aconf->bits);
937 +
938        conf_add_class_to_conf(new_conf, class_name);
939        if (yy_aconf->passwd != NULL)
940          DupString(new_aconf->passwd, yy_aconf->passwd);
# Line 1019 | Line 981 | oper_entry: OPERATOR
981    }
982   };
983  
1022 oper_name_b: | oper_name_t;
984   oper_items:     oper_items oper_item | oper_item;
985   oper_item:      oper_name | oper_user | oper_password |
986                  oper_umodes | oper_class | oper_encrypted |
# Line 1037 | Line 998 | oper_name: NAME '=' QSTRING ';'
998    }
999   };
1000  
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
1001   oper_user: USER '=' QSTRING ';'
1002   {
1003    if (conf_parser_ctx.pass == 2)
# Line 1070 | Line 1019 | oper_user: USER '=' QSTRING ';'
1019      {
1020        DupString(yy_aconf->user, userbuf);
1021        DupString(yy_aconf->host, hostbuf);
1022 +
1023 +      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->ipnum,
1024 +                                    &yy_aconf->bits);
1025      }
1026      else
1027      {
# Line 1334 | Line 1286 | class_entry: CLASS
1286      yy_conf = make_conf_item(CLASS_TYPE);
1287      yy_class = map_to_conf(yy_conf);
1288    }
1289 < } class_name_b '{' class_items '}' ';'
1289 > } '{' class_items '}' ';'
1290   {
1291    if (conf_parser_ctx.pass == 1)
1292    {
# Line 1345 | Line 1297 | class_entry: CLASS
1297        delete_conf_item(yy_conf);
1298      else
1299      {
1300 <      cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1300 >      cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1301  
1302        if (cconf != NULL)                /* The class existed already */
1303        {
# Line 1377 | Line 1329 | class_entry: CLASS
1329    }
1330   };
1331  
1380 class_name_b: | class_name_t;
1381
1332   class_items:    class_items class_item | class_item;
1333   class_item:     class_name |
1334                  class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
# Line 1403 | Line 1353 | class_name: NAME '=' QSTRING ';'
1353    }
1354   };
1355  
1406 class_name_t: QSTRING
1407 {
1408  if (conf_parser_ctx.pass == 1)
1409  {
1410    MyFree(yy_class_name);
1411    DupString(yy_class_name, yylval.string);
1412  }
1413 };
1414
1356   class_ping_time: PING_TIME '=' timespec ';'
1357   {
1358    if (conf_parser_ctx.pass == 1)
# Line 1788 | Line 1729 | auth_spoof: SPOOF '=' QSTRING ';'
1729      }
1730      else
1731      {
1732 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1732 >      ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1733        yy_conf->name = NULL;
1734      }
1735    }
# Line 2086 | Line 2027 | connect_entry: CONNECT
2027    if (conf_parser_ctx.pass == 2)
2028    {
2029      yy_conf = make_conf_item(SERVER_TYPE);
2030 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2031 <    yy_aconf->passwd = NULL;
2030 >    yy_aconf = map_to_conf(yy_conf);
2031 >
2032      /* defaults */
2033      yy_aconf->port = PORTNUM;
2093
2094    if (ConfigFileEntry.burst_away)
2095      yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2034    }
2035    else
2036    {
2037      MyFree(class_name);
2038      class_name = NULL;
2039    }
2040 < } connect_name_b '{' connect_items '}' ';'
2040 > } '{' connect_items '}' ';'
2041   {
2042    if (conf_parser_ctx.pass == 2)
2043    {
# Line 2227 | Line 2165 | connect_entry: CONNECT
2165    }
2166   };
2167  
2230 connect_name_b: | connect_name_t;
2168   connect_items:  connect_items connect_item | connect_item;
2169   connect_item:   connect_name | connect_host | connect_vhost |
2170                  connect_send_password | connect_accept_password |
# Line 2249 | Line 2186 | connect_name: NAME '=' QSTRING ';'
2186    }
2187   };
2188  
2252 connect_name_t: QSTRING
2253 {
2254  if (conf_parser_ctx.pass == 2)
2255  {
2256    if (yy_conf->name != NULL)
2257      yyerror("Multiple connect name entry");
2258
2259    MyFree(yy_conf->name);
2260    DupString(yy_conf->name, yylval.string);
2261  }
2262 };
2263
2189   connect_host: HOST '=' QSTRING ';'
2190   {
2191    if (conf_parser_ctx.pass == 2)
# Line 2283 | Line 2208 | connect_vhost: VHOST '=' QSTRING ';'
2208      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2209  
2210      if (getaddrinfo(yylval.string, NULL, &hints, &res))
2211 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2211 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2212      else
2213      {
2214        assert(res != NULL);
# Line 2528 | Line 2453 | kill_entry: KILL
2453          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2454              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2455          {
2456 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2456 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2457                 errptr);
2458            break;
2459          }
# Line 2545 | Line 2470 | kill_entry: KILL
2470          else
2471            DupString(yy_aconf->reason, "No reason");
2472   #else
2473 <        ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support");
2473 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2474          break;
2475   #endif
2476        }
# Line 2695 | Line 2620 | gecos_entry: GECOS
2620  
2621          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2622          {
2623 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
2623 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2624                 errptr);
2625            break;
2626          }
# Line 2703 | Line 2628 | gecos_entry: GECOS
2628          yy_conf = make_conf_item(RXLINE_TYPE);
2629          yy_conf->regexpname = exp_p;
2630   #else
2631 <        ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support");
2631 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2632          break;
2633   #endif
2634        }
# Line 2778 | Line 2703 | general_item:       general_hide_spoof_i
2703                      general_compression_level | general_client_flood |
2704                      general_throttle_time | general_havent_read_conf |
2705                      general_ping_cookie |
2706 <                    general_disable_auth | general_burst_away |
2706 >                    general_disable_auth |
2707                      general_tkline_expire_notices | general_gline_min_cidr |
2708                      general_gline_min_cidr6 | general_use_whois_actually |
2709                      general_reject_hold_time | general_stats_e_disabled |
# Line 2801 | Line 2726 | general_gline_min_cidr6: GLINE_MIN_CIDR6
2726    ConfigFileEntry.gline_min_cidr6 = $3;
2727   };
2728  
2804 general_burst_away: BURST_AWAY '=' TBOOL ';'
2805 {
2806  ConfigFileEntry.burst_away = yylval.number;
2807 };
2808
2729   general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2730   {
2731    ConfigFileEntry.use_whois_actually = yylval.number;
# Line 2886 | Line 2806 | general_havent_read_conf: HAVENT_READ_CO
2806   {
2807    if (($3 > 0) && conf_parser_ctx.pass == 1)
2808    {
2809 <    ilog(L_CRIT, "You haven't read your config file properly.");
2810 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
2811 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
2809 >    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2810 >    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2811 >    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2812      exit(0);
2813    }
2814   };
# Line 3305 | Line 3225 | gline_duration: DURATION '=' timespec ';
3225      ConfigFileEntry.gline_time = $3;
3226   };
3227  
3228 < gline_logging: LOGGING
3228 > gline_logging: T_LOG
3229   {
3230    if (conf_parser_ctx.pass == 2)
3231      ConfigFileEntry.gline_logging = 0;

Diff Legend

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