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

Comparing:
ircd-hybrid-7.3/src/ircd_lexer.l (file contents), Revision 1072 by michael, Wed Feb 17 22:58:23 2010 UTC vs.
ircd-hybrid/trunk/src/conf_lexer.l (file contents), Revision 1834 by michael, Fri Apr 19 19:50:27 2013 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  ircd_lexer.l: Scans the ircd configuration file for tokens.
3 > *  conf_lexer.l: Scans the ircd configuration file for tokens.
4   *
5   *  Copyright (C) 2002 by the past and present ircd coders, and others.
6   *
# Line 30 | Line 30
30   %{
31   #include "stdinc.h"
32   #include "irc_string.h"
33 < #include "common.h"
34 < #include "s_conf.h"
35 < #include "memory.h"
36 < #include "hostmask.h"
37 < #include "s_log.h"
38 <
39 < #include "ircd_parser.h"
33 > #include "conf.h"
34 > #include "conf_parser.h" /* autogenerated header file */
35 > #include "log.h"
36  
37   #undef YY_INPUT
38   #define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg)
39   #define YY_INPUT(buf,result,max_size) \
40 <  if (!(result = conf_fbgets(buf, max_size, conf_parser_ctx.conf_file))) \
40 >  if (!(result = conf_yy_input(buf, max_size))) \
41      YY_FATAL_ERROR("input in flex scanner failed");
42   #define MAX_INCLUDE_DEPTH 10
43  
# Line 53 | Line 49 | char conffilebuf[IRCD_BUFSIZE];
49   static int include_stack_ptr = 0;
50   static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
51   static unsigned int lineno_stack[MAX_INCLUDE_DEPTH];
52 < static FBFILE *inc_fbfile_in[MAX_INCLUDE_DEPTH];
52 > static FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH];
53   static char conffile_stack[MAX_INCLUDE_DEPTH][IRCD_BUFSIZE];
54   static void ccomment(void);
55   static void cinclude(void);
56   static int ieof(void);
57 +
58 + static int
59 + conf_yy_input(char *lbuf, unsigned int max_size)
60 + {
61 +  return !fgets(lbuf, max_size, conf_parser_ctx.conf_file) ? 0 : strlen(lbuf);
62 + }
63 +
64 + static int
65 + conf_yy_fatal_error(const char *msg)
66 + {
67 +  return 0;
68 + }
69 +
70   %}
71  
72   WS        [[:blank:]]*
# Line 70 | Line 79 | include   \.include{WS}(\<.*\>|\".*\")
79   {include}       { cinclude(); }
80   "/*"            { ccomment(); }
81  
82 < \n.*            { strcpy(linebuf, yytext+1); ++lineno; yyless(1); }
82 > \n.*            { strlcpy(linebuf, yytext+1, sizeof(linebuf)); ++lineno; yyless(1); }
83  
84   {WS}            ;
85   {COMMENT}       ;
# Line 86 | Line 95 | include   \.include{WS}(\<.*\>|\".*\")
95                      {
96                        yylval.string = yytext+1;
97                        if(yylval.string[yyleng-2] != '"')
98 <                        ilog(L_ERROR, "Unterminated character string");
98 >                        ilog(LOG_TYPE_IRCD, "Unterminated character string");
99                        else
100                          {
101                            int i,j;
# Line 109 | Line 118 | include   \.include{WS}(\<.*\>|\".*\")
118                                                                   * happen
119                                                                   */
120                                      {
121 <                                      ilog(L_ERROR,
121 >                                      ilog(LOG_TYPE_IRCD,
122                                             "Unterminated character string");
123                                        break;
124                                      }
# Line 122 | Line 131 | include   \.include{WS}(\<.*\>|\".*\")
131                      }
132                  }
133  
125 – ~               { return NOT; }
134   accept_password { return ACCEPT_PASSWORD; }
127 – action          { return ACTION; }
135   admin           { return ADMIN; }
136   administrator   { return ADMIN; }
137   aftype          { return AFTYPE; }
138   all             { return T_ALL; }
132 – allow           { return T_ALLOW; }
139   auth            { return IRCD_AUTH; }
140   autoconn        { return AUTOCONN; }
135 – block           { return T_BLOCK; }
136 – burst_away      { return BURST_AWAY; }
137 – burst_topicwho  { return BURST_TOPICWHO; }
141   can_flood       { return CAN_FLOOD; }
139 – can_idle        { return CAN_IDLE; }
142   caller_id_wait  { return CALLER_ID_WAIT; }
143   opers_bypass_callerid  { return OPERS_BYPASS_CALLERID; }
144   channel         { return CHANNEL; }
145   cidr_bitlen_ipv4        { return CIDR_BITLEN_IPV4; }
146   cidr_bitlen_ipv6        { return CIDR_BITLEN_IPV6; }
145 – cipher_preference { return CIPHER_PREFERENCE; }
147   class           { return CLASS; }
147 – client_flood    { return T_CLIENT_FLOOD; }
148   cluster         { return T_CLUSTER; }
149 – compressed      { return COMPRESSED; }
150 – compression_level { return COMPRESSION_LEVEL; }
149   connect         { return CONNECT; }
150   connectfreq     { return CONNECTFREQ; }
153 – cryptlink       { return CRYPTLINK; }
154 – default_cipher_preference { return DEFAULT_CIPHER_PREFERENCE; }
151   default_floodcount  { return DEFAULT_FLOODCOUNT; }
152   default_split_server_count { return DEFAULT_SPLIT_SERVER_COUNT; }
153   default_split_user_count   { return DEFAULT_SPLIT_USER_COUNT; }
# Line 160 | Line 156 | description    { return DESCRIPTION; }
156   die             { return DIE; }
157   disable_auth    { return DISABLE_AUTH; }
158   disable_fake_channels { return DISABLE_FAKE_CHANNELS; }
163 – disable_hidden  { return DISABLE_HIDDEN; }
164 – disable_local_channels { return DISABLE_LOCAL_CHANNELS; }
159   disable_remote_commands { return DISABLE_REMOTE_COMMANDS; }
160 + dline           { return T_DLINE; }
161   dots_in_ident   { return DOTS_IN_IDENT; }
167 – duration        { return DURATION; }
162   egdpool_path        { return EGDPOOL_PATH; }
163   email           { return EMAIL; }
170 – enable          { return ENABLE; }
164   encrypted       { return ENCRYPTED; }
165   exceed_limit    { return EXCEED_LIMIT; }
166   exempt          { return EXEMPT; }
167 < fakename        { return FAKENAME; }
167 > file            { return T_FILE; }
168   flags           { return IRCD_FLAGS; }
169   flatten_links   { return FLATTEN_LINKS; }
177 – fglinelog       { return FGLINELOG; }
178 – fname_glinelog  { return FGLINELOG; }
179 – fkilllog        { return FKILLLOG; }
180 – fioerrlog       { return FIOERRLOG; }
181 – fname_ioerrlog  { return FIOERRLOG; }
182 – fname_killlog   { return FKILLLOG; }
183 – fklinelog       { return FKLINELOG; }
184 – fname_klinelog  { return FKLINELOG; }
185 – ffailed_operlog { return FFAILED_OPERLOG; }
186 – fname_operlog   { return FOPERLOG; }
187 – foperlog        { return FOPERLOG; }
188 – fname_userlog   { return FUSERLOG; }
189 – fuserlog        { return FUSERLOG; }
170   gecos           { return GECOS; }
171   general         { return GENERAL; }
172   gline           { return GLINE; }
173 < glines          { return GLINES; }
173 > gline_enable    { return GLINE_ENABLE; }
174   gline_exempt    { return GLINE_EXEMPT; }
175 + gline_duration  { return GLINE_DURATION; }
176 + gline_request_duration { return GLINE_REQUEST_DURATION; }
177   gline_min_cidr  { return GLINE_MIN_CIDR; }
178   gline_min_cidr6 { return GLINE_MIN_CIDR6; }
179 + globops         { return T_GLOBOPS; }
180   global_kill     { return GLOBAL_KILL; }
181   have_ident      { return NEED_IDENT; }
182   need_ident      { return NEED_IDENT; }
183   havent_read_conf { return HAVENT_READ_CONF; }
184   hidden          { return HIDDEN; }
202 – hidden_admin    { return HIDDEN_ADMIN; }
185   hidden_name     { return HIDDEN_NAME; }
186 < hidden_oper     { return HIDDEN_OPER; }
186 > hide_idle_from_opers { return HIDE_IDLE_FROM_OPERS; }
187   hide_server_ips { return HIDE_SERVER_IPS; }
188   hide_servers    { return HIDE_SERVERS; }
189   hide_spoof_ips  { return HIDE_SPOOF_IPS; }
190   host            { return HOST; }
191   hub             { return HUB; }
192   hub_mask        { return HUB_MASK; }
211 – idletime        { return IDLETIME; }
193   ignore_bogus_ts { return IGNORE_BOGUS_TS; }
194   invisible_on_connect { return INVISIBLE_ON_CONNECT; }
195   ip              { return IP; }
# Line 220 | Line 201 | kill           { return KILL; }
201   kill_chase_time_limit { return KILL_CHASE_TIME_LIMIT; }
202   kline           { return KLINE; }
203   kline_exempt    { return KLINE_EXEMPT; }
223 – l_crit          { return T_L_CRIT; }
224 – l_debug         { return T_L_DEBUG; }
225 – l_error         { return T_L_ERROR; }
226 – l_info          { return T_L_INFO; }
227 – l_notice        { return T_L_NOTICE; }
228 – l_trace         { return T_L_TRACE; }
229 – l_warn          { return T_L_WARN; }
204   leaf_mask       { return LEAF_MASK; }
205   listen          { return LISTEN; }
206 < log_level       { return LOG_LEVEL; }
233 < log             { return LOGGING; }
234 < logging         { return LOGGING; }
235 < logpath         { return T_LOGPATH; }
206 > log             { return T_LOG; }
207   masked          { return TMASKED; }
208   max_clients     { return T_MAX_CLIENTS; }
209   max_ident       { return MAX_IDENT; }
210 + max_idle        { return MAX_IDLE; }
211 + min_idle        { return MIN_IDLE; }
212   max_local       { return MAX_LOCAL; }
213   max_global      { return MAX_GLOBAL; }
214   max_number      { return MAX_NUMBER; }
215 + max_nick_length { return MAX_NICK_LENGTH; }
216 + max_topic_length { return MAX_TOPIC_LENGTH; }
217   max_watch       { return MAX_WATCH; }
218   message_locale  { return MESSAGE_LOCALE; }
219   min_nonwildcard { return MIN_NONWILDCARD; }
# Line 249 | Line 224 | network_desc    { return NETWORK_DESC; }
224   network_name    { return NETWORK_NAME; }
225   nick            { return NICK; }
226   nick_changes    { return NICK_CHANGES; }
227 < no              { yylval.number = NO; return TBOOL; }
227 > no              { yylval.number = 0; return TBOOL; }
228   no_create_on_split { return NO_CREATE_ON_SPLIT; }
229   no_join_on_split   { return NO_JOIN_ON_SPLIT; }
230   no_oper_flood   { return NO_OPER_FLOOD; }
# Line 257 | Line 232 | no_tilde       { return NO_TILDE; }
232   number_per_cidr { return NUMBER_PER_CIDR; }
233   number_per_ip   { return NUMBER_PER_IP; }
234   oper            { return OPERATOR; }
260 – oper_log        { return OPER_LOG; }
235   oper_pass_resv  { return OPER_PASS_RESV; }
236   operator        { return OPERATOR; }
237   passwd          { return PASSWORD; }
238   password        { return PASSWORD; }
239   ping_cookie     { return PING_COOKIE; }
240   ping_time       { return PING_TIME; }
267 – ping_warning    { return PING_WARNING; }
241   port            { return PORT; }
242   quarantine      { return RESV; }
243   quiet_on_ban    { return QUIET_ON_BAN; }
244 + random_idle     { return RANDOM_IDLE; }
245   reason          { return REASON; }
246 + recvq           { return T_RECVQ; }
247   redirport       { return REDIRPORT; }
248   redirserv       { return REDIRSERV; }
249   regex           { return REGEX_T; }
250   rehash          { return REHASH; }
276 – reject          { return T_REJECT; }
277 – reject_hold_time { return TREJECT_HOLD_TIME; }
251   remote          { return REMOTE; }
252   remoteban       { return REMOTEBAN; }
253 + restart         { return T_RESTART; }
254   restrict_channels { return RESTRICT_CHANNELS; }
255   resv            { return RESV; }
256   resv_exempt     { return RESV_EXEMPT; }
# Line 284 | Line 258 | rsa_private_key_file           { return RSA_PRIVA
258   rsa_public_key_file             { return RSA_PUBLIC_KEY_FILE; }
259   ssl                             { return T_SSL; }
260   ssl_certificate_file        { return SSL_CERTIFICATE_FILE; }
261 < ssl_server_protocol       { return T_SSL_CONNECTION_METHOD; }
261 > ssl_client_method       { return T_SSL_CLIENT_METHOD; }
262 > ssl_server_method       { return T_SSL_SERVER_METHOD; }
263 > ssl_dh_param_file       { return SSL_DH_PARAM_FILE; }
264 > ssl_cipher_list         { return T_SSL_CIPHER_LIST; }
265   sslv3           { return T_SSLV3; }
266   tlsv1           { return T_TLSV1; }
267   send_password   { return SEND_PASSWORD; }
# Line 292 | Line 269 | sendq          { return SENDQ; }
269   server          { return T_SERVER; }
270   serverhide      { return SERVERHIDE; }
271   serverinfo      { return SERVERINFO; }
272 < servlink_path   { return SERVLINK_PATH; }
272 > service          { return T_SERVICE; }
273 > services_name    { return T_SERVICES_NAME; }
274 > set              { return T_SET; }
275   shared          { return T_SHARED; }
276   short_motd      { return SHORT_MOTD; }
277   sid             { return IRCD_SID; }
278 < silent          { return SILENT; }
278 > size            { return T_SIZE; }
279   spoof           { return SPOOF; }
280   spoof_notice    { return SPOOF_NOTICE; }
281   tkline_expire_notices { return TKLINE_EXPIRE_NOTICES; }
# Line 304 | Line 283 | type           { return TYPE; }
283   true_no_oper_flood { return TRUE_NO_OPER_FLOOD; }
284   umodes          { return T_UMODES; }
285   unkline         { return UNKLINE; }
286 + undline         { return T_UNDLINE; }
287 + unlimited       { return T_UNLIMITED; }
288   use_egd         { return USE_EGD; }
308 – use_except      { return USE_EXCEPT; }
309 – use_invex       { return USE_INVEX; }
310 – use_knock       { return USE_KNOCK; }
289   use_logging     { return USE_LOGGING; }
312 – use_whois_actually { return USE_WHOIS_ACTUALLY; }
290   throttle_time { return THROTTLE_TIME; }
291   user            { return USER; }
315 – tkline          { return TKLINE; }
316 – txline          { return TXLINE; }
317 – tresv           { return TRESV; }
292   vhost   { return VHOST; }
293   vhost6  { return VHOST6; }
294 < warn            { return WARN; }
294 > webirc           { return T_WEBIRC; }
295   xline           { return XLINE; }
296 < yes             { yylval.number = YES; return TBOOL; }
296 > yes             { yylval.number = 1; return TBOOL; }
297  
298   failed_oper_notice      { return FAILED_OPER_NOTICE; }
299   max_accept              { return MAX_ACCEPT; }
300   max_nick_changes        { return MAX_NICK_CHANGES; }
301 + max_chans_per_oper      { return MAX_CHANS_PER_OPER; }
302   max_chans_per_user      { return MAX_CHANS_PER_USER; }
303   max_nick_time           { return MAX_NICK_TIME; }
304   anti_nick_flood         { return ANTI_NICK_FLOOD; }
# Line 331 | Line 306 | anti_spam_exit_message_time { return ANT
306   ts_max_delta            { return TS_MAX_DELTA; }
307   ts_warn_delta           { return TS_WARN_DELTA; }
308   links_delay             { return LINKS_DELAY; }
334 – kline_reason            { return KLINE_REASON; }
335 – kline_with_reason       { return KLINE_WITH_REASON; }
309   warn_no_nline           { return WARN_NO_NLINE; }
310  
311   stats_e_disabled        { return STATS_E_DISABLED; }
# Line 373 | Line 346 | invisible               { return T_INVIS
346   wallop                  { return T_WALLOP; }
347   callerid                { return T_CALLERID; }
348   softcallerid            { return T_SOFTCALLERID; }
376 – drone                   { return T_DRONE; }
349   locops                  { return T_LOCOPS; }
378 – topicburst              { return TOPICBURST; }
350  
351 + years                   { return YEARS; }
352 + year                    { return YEARS; }
353 + months                  { return MONTHS; }
354 + month                   { return MONTHS; }
355   weeks                   { return WEEKS; }
356   week                    { return WEEKS; }
357   days                    { return DAYS; }
# Line 400 | Line 375 | megabyte               { return MBYTES; }
375   mbytes                  { return MBYTES; }
376   mbyte                   { return MBYTES; }
377   mb                      { return MBYTES; }
403 – gigabytes               { return GBYTES; }
404 – gigabyte                { return GBYTES; }
405 – gbytes                  { return GBYTES; }
406 – gbyte                   { return GBYTES; }
407 – gb                      { return GBYTES; }
408 – terabytes               { return TBYTES; }
409 – terabyte                { return TBYTES; }
410 – tbytes                  { return TBYTES; }
411 – tbyte                   { return TBYTES; }
412 – tb                      { return TBYTES; }
378   \.\.                    { return TWODOTS; }
379  
380   .                       { return yytext[0]; }
# Line 470 | Line 435 | cinclude(void)
435  
436    /* do stacking and co. */
437    if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
438 <    ilog(L_ERROR, "Includes nested too deep in %s", p);
438 >    ilog(LOG_TYPE_IRCD, "Includes nested too deep in %s", p);
439    else
440    {
441 <    FBFILE *tmp_fbfile_in = NULL;
441 >    FILE *tmp_fbfile_in = NULL;
442      char filenamebuf[IRCD_BUFSIZE];
443  
444      if (*p == '/')  /* if it is an absolute path */
# Line 481 | Line 446 | cinclude(void)
446      else
447        snprintf(filenamebuf, sizeof(filenamebuf), "%s/%s", ETCPATH, p);
448  
449 <    tmp_fbfile_in = fbopen(filenamebuf, "r");
449 >    tmp_fbfile_in = fopen(filenamebuf, "r");
450      
451      if (tmp_fbfile_in == NULL)
452      {
453 <      ilog(L_ERROR, "Unable to read configuration file '%s': %s",
453 >      ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
454             filenamebuf, strerror(errno));
455        return;
456      }
# Line 509 | Line 474 | ieof(void)
474   {
475    /* log(L_NOTICE, "return from include stack!"); */
476    if (include_stack_ptr)
477 <    fbclose(conf_parser_ctx.conf_file);
477 >    fclose(conf_parser_ctx.conf_file);
478    if (--include_stack_ptr < 0)
479    {
480      /* log(L_NOTICE, "terminating lexer"); */

Diff Legend

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