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 1246 by michael, Mon Sep 19 09:38:38 2011 UTC vs.
Revision 1247 by michael, Sat Oct 1 07:54:24 2011 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 363 | Line 346 | unhook_hub_leaf_confs(void)
346   %token  T_RESTART
347   %token  T_SERVICE
348   %token  T_SERVICES_NAME
349 + %token  T_TIMESTAMP
350   %token  THROTTLE_TIME
351   %token  TOPICBURST
352   %token  TRUE_NO_OPER_FLOOD
# Line 382 | Line 366 | unhook_hub_leaf_confs(void)
366   %token  XLINE
367   %token  WARN
368   %token  WARN_NO_NLINE
369 + %token  T_SIZE
370 + %token  T_FILE
371  
372   %type <string> QSTRING
373   %type <number> NUMBER
# Line 628 | Line 614 | serverinfo_name: NAME '=' QSTRING ';'
614        DupString(ServerInfo.name, yylval.string);
615      else
616      {
617 <      ilog(L_ERROR, "Ignoring serverinfo::name -- invalid name. Aborting.");
617 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
618        exit(0);
619      }
620    }
# Line 643 | Line 629 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
629        DupString(ServerInfo.sid, yylval.string);
630      else
631      {
632 <      ilog(L_ERROR, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
632 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
633        exit(0);
634      }
635    }
# Line 694 | Line 680 | serverinfo_vhost: VHOST '=' QSTRING ';'
680      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
681  
682      if (getaddrinfo(yylval.string, NULL, &hints, &res))
683 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
683 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
684      else
685      {
686        assert(res != NULL);
# Line 723 | Line 709 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
709      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
710  
711      if (getaddrinfo(yylval.string, NULL, &hints, &res))
712 <      ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
712 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
713      else
714      {
715        assert(res != NULL);
# Line 807 | Line 793 | admin_description: DESCRIPTION '=' QSTRI
793   /***************************************************************************
794   *  section logging
795   ***************************************************************************/
796 < /* XXX */
797 < logging_entry:          LOGGING  '{' logging_items '}' ';' ;
812 <
813 < logging_items:          logging_items logging_item |
814 <                        logging_item ;
796 > logging_entry:          T_LOG  '{' logging_items '}' ';' ;
797 > logging_items:          logging_items logging_item | logging_item ;
798  
799 < 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 |
799 > logging_item:           logging_use_logging | logging_timestamp | logging_file_entry |
800                          error ';' ;
801  
802 < logging_path:           T_LOGPATH '=' QSTRING ';'
826 <                        {
827 <                        };
828 <
829 < logging_oper_log:       OPER_LOG '=' QSTRING ';'
830 <                        {
831 <                        };
832 <
833 < logging_fuserlog: FUSERLOG '=' QSTRING ';'
802 > logging_use_logging: USE_LOGGING '=' TBOOL ';'
803   {
804    if (conf_parser_ctx.pass == 2)
805 <    strlcpy(ConfigLoggingEntry.userlog, yylval.string,
837 <            sizeof(ConfigLoggingEntry.userlog));
805 >    ConfigLoggingEntry.use_logging = yylval.number;
806   };
807  
808 < logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
808 > logging_timestamp: T_TIMESTAMP '=' TBOOL ';'
809   {
810    if (conf_parser_ctx.pass == 2)
811 <    strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
844 <            sizeof(ConfigLoggingEntry.failed_operlog));
811 >    ConfigLoggingEntry.timestamp = yylval.number;
812   };
813  
814 < logging_foperlog: FOPERLOG '=' QSTRING ';'
814 > logging_file_entry:
815   {
816 <  if (conf_parser_ctx.pass == 2)
817 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
818 <            sizeof(ConfigLoggingEntry.operlog));
819 < };
853 <
854 < logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
816 >  lfile[0] = '\0';
817 >  ltype = 0;
818 >  lsize = 0;
819 > } T_FILE  '{' logging_file_items '}' ';'
820   {
821    if (conf_parser_ctx.pass == 2)
822 <    strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
858 <            sizeof(ConfigLoggingEntry.operspylog));
822 >    log_add_file(ltype, lsize, lfile);
823   };
824  
825 < logging_fglinelog: FGLINELOG '=' QSTRING ';'
826 < {
827 <  if (conf_parser_ctx.pass == 2)
828 <    strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
829 <            sizeof(ConfigLoggingEntry.glinelog));
866 < };
825 > logging_file_items: logging_file_items logging_file_item |
826 >                    logging_file_item ;
827 >
828 > logging_file_item:  logging_file_name | logging_file_type |
829 >                    logging_file_size | error ';' ;
830  
831 < logging_fklinelog: FKLINELOG '=' QSTRING ';'
831 > logging_file_name: NAME '=' QSTRING ';'
832   {
833 <  if (conf_parser_ctx.pass == 2)
834 <    strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
872 <            sizeof(ConfigLoggingEntry.klinelog));
873 < };
833 >  strlcpy(lfile, yylval.string, sizeof(lfile));
834 > }
835  
836 < logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
836 > logging_file_size: T_SIZE '=' sizespec ';'
837   {
838 <  if (conf_parser_ctx.pass == 2)
878 <    strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
879 <            sizeof(ConfigLoggingEntry.ioerrlog));
838 >  lsize = $3;
839   };
840  
841 < logging_killlog: FKILLLOG '=' QSTRING ';'
841 > logging_file_type: TYPE
842   {
843    if (conf_parser_ctx.pass == 2)
844 <    strlcpy(ConfigLoggingEntry.killlog, yylval.string,
845 <            sizeof(ConfigLoggingEntry.killlog));
887 < };
844 >    ltype = 0;
845 > } '='  logging_file_type_items ';' ;
846  
847 < logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
848 < {
891 <  if (conf_parser_ctx.pass == 2)
892 <    set_log_level(L_CRIT);
893 < } | LOG_LEVEL '=' T_L_ERROR ';'
847 > logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
848 > logging_file_type_item:  USER
849   {
850    if (conf_parser_ctx.pass == 2)
851 <    set_log_level(L_ERROR);
852 < } | LOG_LEVEL '=' T_L_WARN ';'
851 >    ltype = LOG_TYPE_USER;
852 > } | OPERATOR
853   {
854    if (conf_parser_ctx.pass == 2)
855 <    set_log_level(L_WARN);
856 < } | LOG_LEVEL '=' T_L_NOTICE ';'
855 >    ltype = LOG_TYPE_OPER;
856 > } | GLINE
857   {
858    if (conf_parser_ctx.pass == 2)
859 <    set_log_level(L_NOTICE);
860 < } | LOG_LEVEL '=' T_L_TRACE ';'
859 >    ltype = LOG_TYPE_GLINE;
860 > } | T_DLINE
861   {
862    if (conf_parser_ctx.pass == 2)
863 <    set_log_level(L_TRACE);
864 < } | LOG_LEVEL '=' T_L_INFO ';'
863 >    ltype = LOG_TYPE_DLINE;
864 > } | KLINE
865   {
866    if (conf_parser_ctx.pass == 2)
867 <    set_log_level(L_INFO);
868 < } | LOG_LEVEL '=' T_L_DEBUG ';'
867 >    ltype = LOG_TYPE_KLINE;
868 > } | KILL
869   {
870    if (conf_parser_ctx.pass == 2)
871 <    set_log_level(L_DEBUG);
872 < };
918 <
919 < logging_use_logging: USE_LOGGING '=' TBOOL ';'
871 >    ltype = LOG_TYPE_KILL;
872 > } | T_DEBUG
873   {
874    if (conf_parser_ctx.pass == 2)
875 <    ConfigLoggingEntry.use_logging = yylval.number;
875 >    ltype = LOG_TYPE_DEBUG;
876   };
877  
878 +
879   /***************************************************************************
880   * section oper
881   ***************************************************************************/
# Line 1788 | Line 1742 | auth_spoof: SPOOF '=' QSTRING ';'
1742      }
1743      else
1744      {
1745 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1745 >      ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1746        yy_conf->name = NULL;
1747      }
1748    }
# Line 2283 | Line 2237 | connect_vhost: VHOST '=' QSTRING ';'
2237      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2238  
2239      if (getaddrinfo(yylval.string, NULL, &hints, &res))
2240 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2240 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2241      else
2242      {
2243        assert(res != NULL);
# Line 2528 | Line 2482 | kill_entry: KILL
2482          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2483              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2484          {
2485 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2485 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2486                 errptr);
2487            break;
2488          }
# Line 2545 | Line 2499 | kill_entry: KILL
2499          else
2500            DupString(yy_aconf->reason, "No reason");
2501   #else
2502 <        ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support");
2502 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2503          break;
2504   #endif
2505        }
# Line 2695 | Line 2649 | gecos_entry: GECOS
2649  
2650          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2651          {
2652 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
2652 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2653                 errptr);
2654            break;
2655          }
# Line 2703 | Line 2657 | gecos_entry: GECOS
2657          yy_conf = make_conf_item(RXLINE_TYPE);
2658          yy_conf->regexpname = exp_p;
2659   #else
2660 <        ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support");
2660 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2661          break;
2662   #endif
2663        }
# Line 2886 | Line 2840 | general_havent_read_conf: HAVENT_READ_CO
2840   {
2841    if (($3 > 0) && conf_parser_ctx.pass == 1)
2842    {
2843 <    ilog(L_CRIT, "You haven't read your config file properly.");
2844 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
2845 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
2843 >    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2844 >    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2845 >    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2846      exit(0);
2847    }
2848   };
# Line 3305 | Line 3259 | gline_duration: DURATION '=' timespec ';
3259      ConfigFileEntry.gline_time = $3;
3260   };
3261  
3262 < gline_logging: LOGGING
3262 > gline_logging: T_LOG
3263   {
3264    if (conf_parser_ctx.pass == 2)
3265      ConfigFileEntry.gline_logging = 0;

Diff Legend

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