File: | y.tab.c |
Location: | line 461, column 5 |
Description: | Value stored to 'yystate' is never read |
1 | #ifndef lint |
2 | static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; |
3 | #endif |
4 | |
5 | #define YYBYACC1 1 |
6 | #define YYMAJOR1 1 |
7 | #define YYMINOR9 9 |
8 | |
9 | #define YYEMPTY(-1) (-1) |
10 | #define yyclearin(yychar = (-1)) (yychar = YYEMPTY(-1)) |
11 | #define yyerrok(yyerrflag = 0) (yyerrflag = 0) |
12 | #define YYRECOVERING()(yyerrflag != 0) (yyerrflag != 0) |
13 | |
14 | #define YYPREFIX"yy" "yy" |
15 | |
16 | #define YYPURE0 0 |
17 | |
18 | #line 2 "grammar.y" |
19 | /*- |
20 | * Copyright (c) 2007 Aaron L. Meihm |
21 | * Copyright (c) 2007 Christian S.J. Peron |
22 | * All rights reserved. |
23 | * |
24 | * $Id: grammar.y,v 1.19 2007/04/13 14:45:12 csjp Exp $ |
25 | * |
26 | * Redistribution and use in source and binary forms, with or without |
27 | * modification, are permitted provided that the following conditions |
28 | * are met: |
29 | * |
30 | * 1. Redistributions of source code must retain the above copyright |
31 | * notice, this list of conditions and the following disclaimer. |
32 | * 2. Redistributions in binary form must reproduce the above copyright |
33 | * notice, this list of conditions and the following disclaimer in the |
34 | * documentation and/or other materials provided with the distribution. |
35 | * |
36 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
37 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
39 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
40 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
41 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
42 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
44 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
45 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
46 | * SUCH DAMAGE. |
47 | */ |
48 | #include "includes.h" |
49 | |
50 | extern int yylex(void); |
51 | |
52 | static struct bsm_sequence *bs_state; /* BSM sequence state */ |
53 | static struct bsm_set *set_state; /* BSM set state */ |
54 | static struct bsm_state *bm_state; /* BSM state */ |
55 | static struct array array_state; /* Volatile array */ |
56 | static struct logchannel *log_state; |
57 | #line 42 "grammar.y" |
58 | #ifdef YYSTYPE |
59 | #undef YYSTYPE_IS_DECLARED1 |
60 | #define YYSTYPE_IS_DECLARED1 1 |
61 | #endif |
62 | #ifndef YYSTYPE_IS_DECLARED1 |
63 | #define YYSTYPE_IS_DECLARED1 1 |
64 | typedef union { |
65 | u_int32_t num; |
66 | char *str; |
67 | struct array *array; |
68 | struct bsm_set *bsm_set; |
69 | struct bsm_state *bsm_state; |
70 | } YYSTYPE; |
71 | #endif /* !YYSTYPE_IS_DECLARED */ |
72 | #line 72 "y.tab.c" |
73 | |
74 | /* compatibility with bison */ |
75 | #ifdef YYPARSE_PARAM |
76 | /* compatibility with FreeBSD */ |
77 | # ifdef YYPARSE_PARAM_TYPE |
78 | # define YYPARSE_DECL()yyparse(void) yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) |
79 | # else |
80 | # define YYPARSE_DECL()yyparse(void) yyparse(void *YYPARSE_PARAM) |
81 | # endif |
82 | #else |
83 | # define YYPARSE_DECL()yyparse(void) yyparse(void) |
84 | #endif |
85 | |
86 | /* Parameters sent to lex. */ |
87 | #ifdef YYLEX_PARAM |
88 | # define YYLEX_DECL()yylex(void) yylex(void *YYLEX_PARAM) |
89 | # define YYLEXyylex() yylex(YYLEX_PARAM) |
90 | #else |
91 | # define YYLEX_DECL()yylex(void) yylex(void) |
92 | # define YYLEXyylex() yylex() |
93 | #endif |
94 | |
95 | /* Parameters sent to yyerror. */ |
96 | #ifndef YYERROR_DECL |
97 | #define YYERROR_DECL()yyerror(const char *s) yyerror(const char *s) |
98 | #endif |
99 | #ifndef YYERROR_CALL |
100 | #define YYERROR_CALL(msg)yyerror(msg) yyerror(msg) |
101 | #endif |
102 | |
103 | extern int YYPARSE_DECL()yyparse(void); |
104 | |
105 | #define DEFINE257 257 |
106 | #define SET258 258 |
107 | #define OBJECT259 259 |
108 | #define SEQUENCE260 260 |
109 | #define STATE261 261 |
110 | #define EVENT262 262 |
111 | #define TRIGGER263 263 |
112 | #define STATUS264 264 |
113 | #define MULTIPLIER265 265 |
114 | #define OBRACE266 266 |
115 | #define EBRACE267 267 |
116 | #define SEMICOLON268 268 |
117 | #define COMMA269 269 |
118 | #define SUBJECT270 270 |
119 | #define STRING271 271 |
120 | #define ANY272 272 |
121 | #define SUCCESS273 273 |
122 | #define FAILURE274 274 |
123 | #define INTEGER275 275 |
124 | #define TIMEOUT276 276 |
125 | #define NOT277 277 |
126 | #define HOURS278 278 |
127 | #define MINUTES279 279 |
128 | #define DAYS280 280 |
129 | #define PRIORITY281 281 |
130 | #define WEEKS282 282 |
131 | #define SECONDS283 283 |
132 | #define NONE284 284 |
133 | #define QUOTE285 285 |
134 | #define OPBRACKET286 286 |
135 | #define EPBRACKET287 287 |
136 | #define LOGCHAN288 288 |
137 | #define DIRECTORY289 289 |
138 | #define LOG290 290 |
139 | #define SCOPE291 291 |
140 | #define SERIAL292 292 |
141 | #define TIMEOUTWND293 293 |
142 | #define TIMEOUTPROB294 294 |
143 | #define YYERRCODE256 256 |
144 | static const short yylhs[] = { -1, |
145 | 0, 0, 15, 15, 15, 19, 16, 20, 17, 22, |
146 | 23, 21, 21, 21, 5, 5, 24, 13, 25, 25, |
147 | 25, 9, 8, 10, 10, 10, 10, 10, 10, 3, |
148 | 26, 18, 6, 28, 28, 7, 4, 27, 27, 27, |
149 | 27, 27, 27, 27, 27, 27, 27, 29, 29, 29, |
150 | 30, 30, 1, 1, 1, 2, 31, 32, 32, 32, |
151 | 32, 32, 32, 33, 14, 11, 11, 12, 12, 12, |
152 | }; |
153 | static const short yylen[] = { 2, |
154 | 0, 2, 1, 1, 1, 0, 12, 0, 10, 3, |
155 | 3, 0, 2, 2, 0, 1, 0, 8, 3, 4, |
156 | 4, 3, 3, 2, 2, 2, 2, 2, 1, 3, |
157 | 0, 7, 3, 3, 3, 3, 3, 0, 2, 2, |
158 | 2, 2, 2, 2, 2, 2, 2, 4, 4, 3, |
159 | 4, 4, 3, 3, 3, 3, 3, 0, 2, 2, |
160 | 2, 2, 2, 0, 6, 1, 3, 1, 1, 3, |
161 | }; |
162 | static const short yydefred[] = { 1, |
163 | 0, 0, 31, 0, 2, 3, 4, 5, 0, 0, |
164 | 0, 0, 0, 0, 0, 38, 0, 0, 0, 8, |
165 | 6, 64, 0, 0, 0, 0, 0, 0, 0, 0, |
166 | 0, 40, 45, 42, 44, 46, 47, 41, 39, 43, |
167 | 0, 0, 0, 32, 0, 16, 0, 0, 29, 0, |
168 | 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, |
169 | 58, 19, 0, 0, 25, 26, 27, 28, 24, 30, |
170 | 33, 34, 0, 35, 36, 37, 23, 22, 0, 68, |
171 | 69, 0, 0, 66, 0, 20, 21, 0, 0, 0, |
172 | 0, 13, 14, 0, 0, 0, 0, 0, 0, 0, |
173 | 0, 0, 60, 61, 59, 62, 63, 17, 9, 0, |
174 | 0, 70, 0, 67, 0, 0, 0, 0, 0, 0, |
175 | 0, 0, 65, 0, 10, 11, 7, 0, 0, 50, |
176 | 0, 0, 57, 55, 53, 54, 56, 0, 51, 52, |
177 | 48, 49, 0, 18, |
178 | }; |
179 | static const short yydgoto[] = { 1, |
180 | 103, 104, 32, 33, 47, 34, 35, 36, 37, 50, |
181 | 83, 84, 54, 38, 5, 6, 7, 8, 42, 41, |
182 | 79, 92, 93, 124, 39, 10, 19, 40, 105, 106, |
183 | 107, 85, 43, |
184 | }; |
185 | static const short yysindex[] = { 0, |
186 | -252, -243, 0, -265, 0, 0, 0, 0, -245, -209, |
187 | -258, -247, -216, -208, -207, 0, -222, -220, -260, 0, |
188 | 0, 0, -202, -254, -273, -206, -267, -200, -203, -273, |
189 | -201, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
190 | -193, -191, -190, 0, -189, 0, -259, -231, 0, -188, |
191 | -187, -186, -194, -185, -184, -183, -182, -181, 0, -262, |
192 | 0, 0, -180, -179, 0, 0, 0, 0, 0, 0, |
193 | 0, 0, -197, 0, 0, 0, 0, 0, -264, 0, |
194 | 0, -178, -212, 0, -221, 0, 0, -175, -176, -177, |
195 | -174, 0, 0, -192, -171, -262, -199, -232, -173, -219, |
196 | -172, -169, 0, 0, 0, 0, 0, 0, 0, -168, |
197 | -167, 0, -166, 0, -257, -164, -251, -163, -162, -161, |
198 | -160, -159, 0, -262, 0, 0, 0, -158, -157, 0, |
199 | -156, -155, 0, 0, 0, 0, 0, -210, 0, 0, |
200 | 0, 0, -153, 0, |
201 | }; |
202 | static const short yyrindex[] = { 0, |
203 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
204 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
205 | 0, 0, 0, -249, 0, 0, 0, 0, 0, 0, |
206 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
207 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
208 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
209 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
210 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
211 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
212 | 0, 0, 0, 0, 0, 0, -249, -249, 0, 0, |
213 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
214 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
215 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
216 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
217 | 0, 0, 0, 0, |
218 | }; |
219 | static const short yygindex[] = { 0, |
220 | 0, 0, 0, 0, -37, 0, 0, 0, 0, 85, |
221 | -8, 21, -47, 0, 0, 0, 0, 0, 0, 0, |
222 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
223 | 0, 0, 0, |
224 | }; |
225 | #define YYTABLESIZE117 117 |
226 | static const short yytable[] = { 64, |
227 | 22, 48, 89, 52, 2, 11, 23, 3, 80, 24, |
228 | 49, 63, 81, 128, 9, 25, 90, 45, 53, 131, |
229 | 26, 15, 46, 82, 91, 12, 53, 14, 53, 27, |
230 | 28, 29, 30, 31, 53, 4, 15, 97, 15, 116, |
231 | 98, 99, 100, 101, 46, 102, 65, 66, 67, 16, |
232 | 68, 69, 119, 120, 121, 95, 96, 143, 96, 115, |
233 | 117, 13, 17, 18, 20, 44, 21, 129, 51, 132, |
234 | 55, 56, 59, 58, 60, 61, 73, 46, 62, 70, |
235 | 71, 72, 74, 75, 76, 77, 78, 86, 87, 88, |
236 | 108, 109, 94, 110, 112, 113, 111, 118, 123, 125, |
237 | 126, 127, 122, 130, 133, 134, 135, 136, 137, 139, |
238 | 140, 141, 142, 144, 57, 138, 114, |
239 | }; |
240 | static const short yycheck[] = { 47, |
241 | 261, 275, 267, 271, 257, 271, 267, 260, 271, 270, |
242 | 284, 271, 275, 271, 258, 276, 281, 272, 286, 271, |
243 | 281, 271, 277, 286, 289, 271, 286, 286, 286, 290, |
244 | 291, 292, 293, 294, 286, 288, 286, 259, 286, 272, |
245 | 262, 263, 264, 265, 277, 267, 278, 279, 280, 266, |
246 | 282, 283, 272, 273, 274, 268, 269, 268, 269, 97, |
247 | 98, 271, 271, 271, 287, 268, 287, 115, 275, 117, |
248 | 271, 275, 266, 275, 266, 266, 271, 277, 268, 268, |
249 | 268, 268, 268, 268, 268, 268, 268, 268, 268, 287, |
250 | 266, 268, 271, 271, 287, 267, 271, 271, 268, 268, |
251 | 268, 268, 275, 268, 268, 268, 268, 268, 268, 268, |
252 | 268, 268, 268, 267, 30, 124, 96, |
253 | }; |
254 | #define YYFINAL1 1 |
255 | #ifndef YYDEBUG0 |
256 | #define YYDEBUG0 0 |
257 | #endif |
258 | #define YYMAXTOKEN294 294 |
259 | #if YYDEBUG0 |
260 | static const char *yyname[] = { |
261 | |
262 | "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
263 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
264 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
265 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
266 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
267 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
268 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"DEFINE","SET","OBJECT", |
269 | "SEQUENCE","STATE","EVENT","TRIGGER","STATUS","MULTIPLIER","OBRACE","EBRACE", |
270 | "SEMICOLON","COMMA","SUBJECT","STRING","ANY","SUCCESS","FAILURE","INTEGER", |
271 | "TIMEOUT","NOT","HOURS","MINUTES","DAYS","PRIORITY","WEEKS","SECONDS","NONE", |
272 | "QUOTE","OPBRACKET","EPBRACKET","LOGCHAN","DIRECTORY","LOG","SCOPE","SERIAL", |
273 | "TIMEOUTWND","TIMEOUTPROB", |
274 | }; |
275 | static const char *yyrule[] = { |
276 | "$accept : root", |
277 | "root :", |
278 | "root : root cmd", |
279 | "cmd : define_def", |
280 | "cmd : log_channel", |
281 | "cmd : sequence_def", |
282 | "$$1 :", |
283 | "define_def : DEFINE SET STRING OPBRACKET STRING EPBRACKET $$1 OBRACE set_list SEMICOLON EBRACE SEMICOLON", |
284 | "$$2 :", |
285 | "log_channel : LOGCHAN STRING OPBRACKET STRING EPBRACKET $$2 OBRACE log_channel_options EBRACE SEMICOLON", |
286 | "syslog_pri_spec : PRIORITY STRING SEMICOLON", |
287 | "directory_spec : DIRECTORY STRING SEMICOLON", |
288 | "log_channel_options :", |
289 | "log_channel_options : log_channel_options syslog_pri_spec", |
290 | "log_channel_options : log_channel_options directory_spec", |
291 | "negate_spec :", |
292 | "negate_spec : NOT", |
293 | "$$3 :", |
294 | "anon_set : OPBRACKET STRING EPBRACKET OBRACE $$3 set_list SEMICOLON EBRACE", |
295 | "subject_spec : SUBJECT ANY SEMICOLON", |
296 | "subject_spec : SUBJECT negate_spec STRING SEMICOLON", |
297 | "subject_spec : SUBJECT negate_spec anon_set SEMICOLON", |
298 | "timeout_prob_spec : TIMEOUTPROB INTEGER SEMICOLON", |
299 | "timeout_wnd_spec : TIMEOUTWND time_spec SEMICOLON", |
300 | "time_spec : INTEGER SECONDS", |
301 | "time_spec : INTEGER HOURS", |
302 | "time_spec : INTEGER MINUTES", |
303 | "time_spec : INTEGER DAYS", |
304 | "time_spec : INTEGER WEEKS", |
305 | "time_spec : NONE", |
306 | "timeout_spec : TIMEOUT time_spec SEMICOLON", |
307 | "$$4 :", |
308 | "sequence_def : SEQUENCE $$4 STRING OBRACE sequence_options EBRACE SEMICOLON", |
309 | "priority_spec : PRIORITY INTEGER SEMICOLON", |
310 | "log_spec : LOG STRING SEMICOLON", |
311 | "log_spec : LOG anon_set SEMICOLON", |
312 | "scope_spec : SCOPE STRING SEMICOLON", |
313 | "serial_spec : SERIAL INTEGER SEMICOLON", |
314 | "sequence_options :", |
315 | "sequence_options : sequence_options subject_spec", |
316 | "sequence_options : sequence_options timeout_spec", |
317 | "sequence_options : sequence_options state", |
318 | "sequence_options : sequence_options priority_spec", |
319 | "sequence_options : sequence_options log_spec", |
320 | "sequence_options : sequence_options scope_spec", |
321 | "sequence_options : sequence_options serial_spec", |
322 | "sequence_options : sequence_options timeout_wnd_spec", |
323 | "sequence_options : sequence_options timeout_prob_spec", |
324 | "type_spec : EVENT negate_spec STRING SEMICOLON", |
325 | "type_spec : EVENT negate_spec anon_set SEMICOLON", |
326 | "type_spec : EVENT ANY SEMICOLON", |
327 | "object_spec : OBJECT negate_spec STRING SEMICOLON", |
328 | "object_spec : OBJECT negate_spec anon_set SEMICOLON", |
329 | "status_spec : STATUS SUCCESS SEMICOLON", |
330 | "status_spec : STATUS FAILURE SEMICOLON", |
331 | "status_spec : STATUS ANY SEMICOLON", |
332 | "multiplier_spec : MULTIPLIER INTEGER SEMICOLON", |
333 | "trigger_spec : TRIGGER STRING SEMICOLON", |
334 | "state_options :", |
335 | "state_options : state_options type_spec", |
336 | "state_options : state_options status_spec", |
337 | "state_options : state_options multiplier_spec", |
338 | "state_options : state_options object_spec", |
339 | "state_options : state_options trigger_spec", |
340 | "$$5 :", |
341 | "state : STATE $$5 OBRACE state_options EBRACE SEMICOLON", |
342 | "set_list : set_list_ent", |
343 | "set_list : set_list COMMA set_list_ent", |
344 | "set_list_ent : STRING", |
345 | "set_list_ent : INTEGER", |
346 | "set_list_ent : OPBRACKET STRING EPBRACKET", |
347 | |
348 | }; |
349 | #endif |
350 | |
351 | int yydebug; |
352 | int yynerrs; |
353 | |
354 | int yyerrflag; |
355 | int yychar; |
356 | YYSTYPE yyval; |
357 | YYSTYPE yylval; |
358 | |
359 | /* define the initial stack-sizes */ |
360 | #ifdef YYSTACKSIZE500 |
361 | #undef YYMAXDEPTH500 |
362 | #define YYMAXDEPTH500 YYSTACKSIZE500 |
363 | #else |
364 | #ifdef YYMAXDEPTH500 |
365 | #define YYSTACKSIZE500 YYMAXDEPTH500 |
366 | #else |
367 | #define YYSTACKSIZE500 500 |
368 | #define YYMAXDEPTH500 500 |
369 | #endif |
370 | #endif |
371 | |
372 | #define YYINITSTACKSIZE500 500 |
373 | |
374 | typedef struct { |
375 | unsigned stacksize; |
376 | short *s_base; |
377 | short *s_mark; |
378 | short *s_last; |
379 | YYSTYPE *l_base; |
380 | YYSTYPE *l_mark; |
381 | } YYSTACKDATA; |
382 | /* variables for the parser stack */ |
383 | static YYSTACKDATA yystack; |
384 | |
385 | #if YYDEBUG0 |
386 | #include <stdio.h> /* needed for printf */ |
387 | #endif |
388 | |
389 | #include <stdlib.h> /* needed for malloc, etc */ |
390 | #include <string.h> /* needed for memset */ |
391 | |
392 | /* allocate initial stack or double stack size, up to YYMAXDEPTH */ |
393 | static int yygrowstack(YYSTACKDATA *data) |
394 | { |
395 | int i; |
396 | unsigned newsize; |
397 | short *newss; |
398 | YYSTYPE *newvs; |
399 | |
400 | if ((newsize = data->stacksize) == 0) |
401 | newsize = YYINITSTACKSIZE500; |
402 | else if (newsize >= YYMAXDEPTH500) |
403 | return -1; |
404 | else if ((newsize *= 2) > YYMAXDEPTH500) |
405 | newsize = YYMAXDEPTH500; |
406 | |
407 | i = (int) (data->s_mark - data->s_base); |
408 | newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); |
409 | if (newss == 0) |
410 | return -1; |
411 | |
412 | data->s_base = newss; |
413 | data->s_mark = newss + i; |
414 | |
415 | newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); |
416 | if (newvs == 0) |
417 | return -1; |
418 | |
419 | data->l_base = newvs; |
420 | data->l_mark = newvs + i; |
421 | |
422 | data->stacksize = newsize; |
423 | data->s_last = data->s_base + newsize - 1; |
424 | return 0; |
425 | } |
426 | |
427 | #if YYPURE0 || defined(YY_NO_LEAKS) |
428 | static void yyfreestack(YYSTACKDATA *data) |
429 | { |
430 | free(data->s_base); |
431 | free(data->l_base); |
432 | memset(data, 0, sizeof(*data)); |
433 | } |
434 | #else |
435 | #define yyfreestack(data) /* nothing */ |
436 | #endif |
437 | |
438 | #define YYABORTgoto yyabort goto yyabort |
439 | #define YYREJECTgoto yyabort goto yyabort |
440 | #define YYACCEPTgoto yyaccept goto yyaccept |
441 | #define YYERRORgoto yyerrlab goto yyerrlab |
442 | |
443 | int |
444 | YYPARSE_DECL()yyparse(void) |
445 | { |
446 | int yym, yyn, yystate; |
447 | #if YYDEBUG0 |
448 | const char *yys; |
449 | |
450 | if ((yys = getenv("YYDEBUG")) != 0) |
451 | { |
452 | yyn = *yys; |
453 | if (yyn >= '0' && yyn <= '9') |
454 | yydebug = yyn - '0'; |
455 | } |
456 | #endif |
457 | |
458 | yynerrs = 0; |
459 | yyerrflag = 0; |
460 | yychar = YYEMPTY(-1); |
461 | yystate = 0; |
Value stored to 'yystate' is never read | |
462 | |
463 | #if YYPURE0 |
464 | memset(&yystack, 0, sizeof(yystack)); |
465 | #endif |
466 | |
467 | if (yystack.s_base == NULL((void *)0) && yygrowstack(&yystack)) goto yyoverflow; |
468 | yystack.s_mark = yystack.s_base; |
469 | yystack.l_mark = yystack.l_base; |
470 | yystate = 0; |
471 | *yystack.s_mark = 0; |
472 | |
473 | yyloop: |
474 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; |
475 | if (yychar < 0) |
476 | { |
477 | if ((yychar = YYLEXyylex()) < 0) yychar = 0; |
478 | #if YYDEBUG0 |
479 | if (yydebug) |
480 | { |
481 | yys = 0; |
482 | if (yychar <= YYMAXTOKEN294) yys = yyname[yychar]; |
483 | if (!yys) yys = "illegal-symbol"; |
484 | printf("%sdebug: state %d, reading %d (%s)\n", |
485 | YYPREFIX"yy", yystate, yychar, yys); |
486 | } |
487 | #endif |
488 | } |
489 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && |
490 | yyn <= YYTABLESIZE117 && yycheck[yyn] == yychar) |
491 | { |
492 | #if YYDEBUG0 |
493 | if (yydebug) |
494 | printf("%sdebug: state %d, shifting to state %d\n", |
495 | YYPREFIX"yy", yystate, yytable[yyn]); |
496 | #endif |
497 | if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) |
498 | { |
499 | goto yyoverflow; |
500 | } |
501 | yystate = yytable[yyn]; |
502 | *++yystack.s_mark = yytable[yyn]; |
503 | *++yystack.l_mark = yylval; |
504 | yychar = YYEMPTY(-1); |
505 | if (yyerrflag > 0) --yyerrflag; |
506 | goto yyloop; |
507 | } |
508 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && |
509 | yyn <= YYTABLESIZE117 && yycheck[yyn] == yychar) |
510 | { |
511 | yyn = yytable[yyn]; |
512 | goto yyreduce; |
513 | } |
514 | if (yyerrflag) goto yyinrecovery; |
515 | |
516 | yyerror("syntax error"); |
517 | |
518 | goto yyerrlab; |
519 | |
520 | yyerrlab: |
521 | ++yynerrs; |
522 | |
523 | yyinrecovery: |
524 | if (yyerrflag < 3) |
525 | { |
526 | yyerrflag = 3; |
527 | for (;;) |
528 | { |
529 | if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE256) >= 0 && |
530 | yyn <= YYTABLESIZE117 && yycheck[yyn] == YYERRCODE256) |
531 | { |
532 | #if YYDEBUG0 |
533 | if (yydebug) |
534 | printf("%sdebug: state %d, error recovery shifting\ |
535 | to state %d\n", YYPREFIX"yy", *yystack.s_mark, yytable[yyn]); |
536 | #endif |
537 | if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) |
538 | { |
539 | goto yyoverflow; |
540 | } |
541 | yystate = yytable[yyn]; |
542 | *++yystack.s_mark = yytable[yyn]; |
543 | *++yystack.l_mark = yylval; |
544 | goto yyloop; |
545 | } |
546 | else |
547 | { |
548 | #if YYDEBUG0 |
549 | if (yydebug) |
550 | printf("%sdebug: error recovery discarding state %d\n", |
551 | YYPREFIX"yy", *yystack.s_mark); |
552 | #endif |
553 | if (yystack.s_mark <= yystack.s_base) goto yyabort; |
554 | --yystack.s_mark; |
555 | --yystack.l_mark; |
556 | } |
557 | } |
558 | } |
559 | else |
560 | { |
561 | if (yychar == 0) goto yyabort; |
562 | #if YYDEBUG0 |
563 | if (yydebug) |
564 | { |
565 | yys = 0; |
566 | if (yychar <= YYMAXTOKEN294) yys = yyname[yychar]; |
567 | if (!yys) yys = "illegal-symbol"; |
568 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", |
569 | YYPREFIX"yy", yystate, yychar, yys); |
570 | } |
571 | #endif |
572 | yychar = YYEMPTY(-1); |
573 | goto yyloop; |
574 | } |
575 | |
576 | yyreduce: |
577 | #if YYDEBUG0 |
578 | if (yydebug) |
579 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", |
580 | YYPREFIX"yy", yystate, yyn, yyrule[yyn]); |
581 | #endif |
582 | yym = yylen[yyn]; |
583 | if (yym) |
584 | yyval = yystack.l_mark[1-yym]; |
585 | else |
586 | memset(&yyval, 0, sizeof yyval); |
587 | switch (yyn) |
588 | { |
589 | case 6: |
590 | #line 77 "grammar.y" |
591 | { |
592 | assert(set_state == NULL)((set_state == ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 78, "set_state == NULL")); |
593 | if ((set_state = calloc(1, sizeof(*set_state))) == NULL((void *)0)) |
594 | bsmtrace_error(1, "%s: calloc failed", __func__); |
595 | if ((set_state->bss_type = conf_set_type(yystack.l_mark[-1].str)) == -1) |
596 | conf_detail(0, "%s: invalid set type", yystack.l_mark[-1].str); |
597 | /* free() this later. */ |
598 | set_state->bss_name = yystack.l_mark[-3].str; |
599 | } |
600 | break; |
601 | case 7: |
602 | #line 87 "grammar.y" |
603 | { |
604 | struct array *src, *dst; |
605 | |
606 | src = yystack.l_mark[-3].array; |
607 | dst = &set_state->bss_data; |
608 | *dst = *src; |
609 | bzero(&array_state, sizeof(struct array)); |
610 | TAILQ_INSERT_TAIL(&bsm_set_head, set_state, bss_glue)do {; (((set_state))->bss_glue.tqe_next) = ((void *)0); (set_state )->bss_glue.tqe_prev = (&bsm_set_head)->tqh_last; * (&bsm_set_head)->tqh_last = (set_state); (&bsm_set_head )->tqh_last = &(((set_state))->bss_glue.tqe_next);; ; } while (0); |
611 | set_state = NULL((void *)0); |
612 | } |
613 | break; |
614 | case 8: |
615 | #line 101 "grammar.y" |
616 | { |
617 | assert(log_state == NULL)((log_state == ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 102, "log_state == NULL")); |
618 | log_state = calloc(1, sizeof(*log_state)); |
619 | if (log_state == NULL((void *)0)) |
620 | bsmtrace_error(1, "%s: calloc failed", __func__); |
621 | log_state->log_type = log_chan_type(yystack.l_mark[-1].str); |
622 | if (log_state->log_type < 0) |
623 | conf_detail(0, "%s: invalid log channel type", yystack.l_mark[-1].str); |
624 | log_state->log_name = strdup(yystack.l_mark[-3].str); |
625 | log_state->log_handler = log_chan_handler(yystack.l_mark[-1].str); |
626 | } |
627 | break; |
628 | case 9: |
629 | #line 113 "grammar.y" |
630 | { |
631 | TAILQ_INSERT_HEAD(&log_head, log_state, log_glue)do {; if (((((log_state))->log_glue.tqe_next) = (((&log_head ))->tqh_first)) != ((void *)0)) (((&log_head))->tqh_first )->log_glue.tqe_prev = &(((log_state))->log_glue.tqe_next ); else (&log_head)->tqh_last = &(((log_state))-> log_glue.tqe_next); (((&log_head))->tqh_first) = (log_state ); (log_state)->log_glue.tqe_prev = &(((&log_head) )->tqh_first);;; } while (0); |
632 | log_state = NULL((void *)0); |
633 | } |
634 | break; |
635 | case 10: |
636 | #line 121 "grammar.y" |
637 | { |
638 | assert(log_state != NULL)((log_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 122, "log_state != NULL")); |
639 | if (log_state->log_type != LOG_CHANNEL_SYSLOG) |
640 | conf_detail(0, "priority may only be used for " |
641 | "syslog log channels"); |
642 | log_state->log_data.syslog_pri = log_syslog_encode(yystack.l_mark[-1].str); |
643 | if (log_state->log_data.syslog_pri < 0) |
644 | conf_detail(0, "%s: invalid syslog priority", yystack.l_mark[-1].str); |
645 | } |
646 | break; |
647 | case 11: |
648 | #line 134 "grammar.y" |
649 | { |
650 | struct stat sb; |
651 | |
652 | assert(log_state != NULL)((log_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 137, "log_state != NULL")); |
653 | if (stat(yystack.l_mark[-1].str, &sb) < 0) |
654 | conf_detail(0, "%s: %s", yystack.l_mark[-1].str, strerror(errno(* __error()))); |
655 | if ((sb.st_mode & S_IFDIR0040000) == 0) |
656 | conf_detail(0, "%s: not a directory", yystack.l_mark[-1].str); |
657 | if ((sb.st_mode & S_IROTH0000004) != 0) |
658 | bsmtrace_error(0, "%s: world readable", yystack.l_mark[-1].str); |
659 | log_state->log_data.bsm_log_dir = strdup(yystack.l_mark[-1].str); |
660 | if (log_state->log_data.bsm_log_dir == NULL((void *)0)) |
661 | bsmtrace_error(1, "%s: strdup failed", __func__); |
662 | } |
663 | break; |
664 | case 15: |
665 | #line 156 "grammar.y" |
666 | { |
667 | yyval.num = 0; |
668 | } |
669 | break; |
670 | case 16: |
671 | #line 160 "grammar.y" |
672 | { |
673 | yyval.num = 1; |
674 | } |
675 | break; |
676 | case 17: |
677 | #line 167 "grammar.y" |
678 | { |
679 | struct bsm_set *new; |
680 | |
681 | if ((new = calloc(1, sizeof(*new))) == NULL((void *)0)) |
682 | bsmtrace_error(1, "%s: calloc failed", __func__); |
683 | if ((new->bss_type = conf_set_type(yystack.l_mark[-2].str)) == -1) |
684 | conf_detail(0, "%s: invalid set type", yystack.l_mark[-2].str); |
685 | set_state = new; |
686 | } |
687 | break; |
688 | case 18: |
689 | #line 177 "grammar.y" |
690 | { |
691 | struct array *src, *dst; |
692 | |
693 | assert(set_state->bss_type != 0)((set_state->bss_type != 0) ? (void)0 : __assert(__func__, "grammar.y", 180, "set_state->bss_type != 0")); |
694 | src = yystack.l_mark[-2].array; |
695 | dst = &set_state->bss_data; |
696 | *dst = *src; |
697 | bzero(&array_state, sizeof(struct array)); |
698 | yyval.bsm_set = set_state; |
699 | set_state = NULL((void *)0); |
700 | } |
701 | break; |
702 | case 19: |
703 | #line 192 "grammar.y" |
704 | { |
705 | bs_state->bs_seq_flags |= BSM_SEQUENCE_SUBJ_ANY0x00000008U; |
706 | bs_state->bs_subj_type = SET_TYPE_AUID; |
707 | } |
708 | break; |
709 | case 20: |
710 | #line 197 "grammar.y" |
711 | { |
712 | struct bsm_set *sptr; |
713 | |
714 | if ((sptr = conf_get_bsm_set(yystack.l_mark[-1].str)) == NULL((void *)0)) |
715 | conf_detail(0, "%s: invalid set", yystack.l_mark[-1].str); |
716 | conf_sequence_set_subj(bs_state, sptr, yystack.l_mark[-2].num); |
717 | } |
718 | break; |
719 | case 21: |
720 | #line 205 "grammar.y" |
721 | { |
722 | assert(yystack.l_mark[-1].bsm_set->bss_type != 0)((yystack.l_mark[-1].bsm_set->bss_type != 0) ? (void)0 : __assert (__func__, "grammar.y", 206, "yystack.l_mark[-1].bsm_set->bss_type != 0" )); |
723 | conf_sequence_set_subj(bs_state, yystack.l_mark[-1].bsm_set, yystack.l_mark[-2].num); |
724 | } |
725 | break; |
726 | case 22: |
727 | #line 213 "grammar.y" |
728 | { |
729 | yyval.num = yystack.l_mark[-1].num; |
730 | } |
731 | break; |
732 | case 23: |
733 | #line 220 "grammar.y" |
734 | { |
735 | yyval.num = yystack.l_mark[-1].num; |
736 | } |
737 | break; |
738 | case 24: |
739 | #line 227 "grammar.y" |
740 | { |
741 | yyval.num = yystack.l_mark[-1].num; |
742 | } |
743 | break; |
744 | case 25: |
745 | #line 231 "grammar.y" |
746 | { |
747 | yyval.num = yystack.l_mark[-1].num * 3600; |
748 | } |
749 | break; |
750 | case 26: |
751 | #line 235 "grammar.y" |
752 | { |
753 | yyval.num = yystack.l_mark[-1].num * 60; |
754 | } |
755 | break; |
756 | case 27: |
757 | #line 239 "grammar.y" |
758 | { |
759 | yyval.num = yystack.l_mark[-1].num * 3600 * 24; |
760 | } |
761 | break; |
762 | case 28: |
763 | #line 243 "grammar.y" |
764 | { |
765 | yyval.num = yystack.l_mark[-1].num * 3600 * 24 * 7; |
766 | } |
767 | break; |
768 | case 29: |
769 | #line 247 "grammar.y" |
770 | { |
771 | yyval.num = 0; |
772 | } |
773 | break; |
774 | case 30: |
775 | #line 254 "grammar.y" |
776 | { |
777 | yyval.num = yystack.l_mark[-1].num; |
778 | } |
779 | break; |
780 | case 31: |
781 | #line 261 "grammar.y" |
782 | { |
783 | assert(bs_state == NULL)((bs_state == ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 262, "bs_state == NULL")); |
784 | if ((bs_state = calloc(1, sizeof(*bs_state))) == NULL((void *)0)) |
785 | bsmtrace_error(1, "%s: calloc failed", __func__); |
786 | /* This will be a parent sequence. */ |
787 | bs_state->bs_seq_flags |= BSM_SEQUENCE_PARENT0x00000001U; |
788 | bs_state->bs_seq_scope = BSM_SCOPE_GLOBAL; |
789 | bs_state->bs_subj_type = SET_TYPE_NOOP; |
790 | TAILQ_INIT(&bs_state->bs_mhead)do { (((&bs_state->bs_mhead))->tqh_first) = ((void * )0); (&bs_state->bs_mhead)->tqh_last = &(((& bs_state->bs_mhead))->tqh_first);; } while (0); |
791 | } |
792 | break; |
793 | case 32: |
794 | #line 272 "grammar.y" |
795 | { |
796 | /* Check for valid subject specified in sequence options. */ |
797 | if (bs_state->bs_subj_type == SET_TYPE_NOOP) |
798 | conf_detail(0, "%s: must specify a subject", yystack.l_mark[-4].str); |
799 | if (conf_get_parent_sequence(yystack.l_mark[-4].str) != NULL((void *)0)) |
800 | conf_detail(0, "%s: sequence exists", yystack.l_mark[-4].str); |
801 | if ((bs_state->bs_label = strdup(yystack.l_mark[-4].str)) == NULL((void *)0)) |
802 | bsmtrace_error(1, "%s: strdup failed", __func__); |
803 | TAILQ_INSERT_HEAD(&s_parent, bs_state, bs_glue)do {; if (((((bs_state))->bs_glue.tqe_next) = (((&s_parent ))->tqh_first)) != ((void *)0)) (((&s_parent))->tqh_first )->bs_glue.tqe_prev = &(((bs_state))->bs_glue.tqe_next ); else (&s_parent)->tqh_last = &(((bs_state))-> bs_glue.tqe_next); (((&s_parent))->tqh_first) = (bs_state ); (bs_state)->bs_glue.tqe_prev = &(((&s_parent))-> tqh_first);;; } while (0); |
804 | bs_state = NULL((void *)0); |
805 | } |
806 | break; |
807 | case 33: |
808 | #line 287 "grammar.y" |
809 | { |
810 | yyval.num = yystack.l_mark[-1].num; |
811 | } |
812 | break; |
813 | case 34: |
814 | #line 294 "grammar.y" |
815 | { |
816 | struct bsm_set *sptr; |
817 | |
818 | if ((sptr = conf_get_bsm_set(yystack.l_mark[-1].str)) == NULL((void *)0)) |
819 | conf_detail(0, "%s: invalid set", yystack.l_mark[-1].str); |
820 | if (sptr->bss_type != SET_TYPE_LOGCHANNEL) |
821 | conf_detail(0, "%s: supplied set is not of type " |
822 | "logchannel", yystack.l_mark[-1].str); |
823 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 302, "bs_state != NULL")); |
824 | conf_set_log_channel(sptr, bs_state); |
825 | } |
826 | break; |
827 | case 35: |
828 | #line 306 "grammar.y" |
829 | { |
830 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 307, "bs_state != NULL")); |
831 | if (yystack.l_mark[-1].bsm_set->bss_type != SET_TYPE_LOGCHANNEL) |
832 | conf_detail(0, "supplied set is not of type " |
833 | "logchannel"); |
834 | conf_set_log_channel(yystack.l_mark[-1].bsm_set, bs_state); |
835 | } |
836 | break; |
837 | case 36: |
838 | #line 317 "grammar.y" |
839 | { |
840 | int scope; |
841 | |
842 | scope = conf_return_scope(yystack.l_mark[-1].str); |
843 | if (scope < 0) |
844 | conf_detail(0, "%s: invalid scope", yystack.l_mark[-1].str); |
845 | bs_state->bs_seq_scope = scope; |
846 | } |
847 | break; |
848 | case 37: |
849 | #line 329 "grammar.y" |
850 | { |
851 | yyval.num = yystack.l_mark[-1].num; |
852 | } |
853 | break; |
854 | case 39: |
855 | #line 336 "grammar.y" |
856 | { |
857 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 337, "bs_state != NULL")); |
858 | } |
859 | break; |
860 | case 40: |
861 | #line 340 "grammar.y" |
862 | { |
863 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 341, "bs_state != NULL")); |
864 | bs_state->bs_timeout = yystack.l_mark[0].num; |
865 | } |
866 | break; |
867 | case 41: |
868 | #line 345 "grammar.y" |
869 | { |
870 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 346, "bs_state != NULL")); |
871 | conf_handle_multiplier(bs_state, yystack.l_mark[0].bsm_state); |
872 | } |
873 | break; |
874 | case 42: |
875 | #line 350 "grammar.y" |
876 | { |
877 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 351, "bs_state != NULL")); |
878 | bs_state->bs_priority = yystack.l_mark[0].num; |
879 | } |
880 | break; |
881 | case 44: |
882 | #line 356 "grammar.y" |
883 | { |
884 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 357, "bs_state != NULL")); |
885 | bs_state->bs_seq_flags |= yystack.l_mark[0].num; |
886 | } |
887 | break; |
888 | case 45: |
889 | #line 361 "grammar.y" |
890 | { |
891 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 362, "bs_state != NULL")); |
892 | bs_state->bs_seq_serial = yystack.l_mark[0].num; |
893 | } |
894 | break; |
895 | case 46: |
896 | #line 366 "grammar.y" |
897 | { |
898 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 367, "bs_state != NULL")); |
899 | bs_state->bs_seq_time_wnd = yystack.l_mark[0].num; |
900 | } |
901 | break; |
902 | case 47: |
903 | #line 371 "grammar.y" |
904 | { |
905 | assert(bs_state != NULL)((bs_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 372, "bs_state != NULL")); |
906 | bs_state->bs_seq_time_wnd_prob = yystack.l_mark[0].num; |
907 | } |
908 | break; |
909 | case 48: |
910 | #line 379 "grammar.y" |
911 | { |
912 | struct array *src, *dst; |
913 | struct bsm_set *ptr; |
914 | |
915 | if ((ptr = conf_get_bsm_set(yystack.l_mark[-1].str)) == NULL((void *)0)) |
916 | conf_detail(0, "%s: invalid set", yystack.l_mark[-1].str); |
917 | if (ptr->bss_type != SET_TYPE_AUCLASS && |
918 | ptr->bss_type != SET_TYPE_AUEVENT) |
919 | conf_detail(0, "supplied set contains no audit " |
920 | "events or classes"); |
921 | bm_state->bm_event_type = ptr->bss_type; |
922 | src = &ptr->bss_data; |
923 | dst = &bm_state->bm_auditevent; |
924 | *dst = *src; |
925 | bzero(&array_state, sizeof(struct array)); |
926 | dst->a_negated = yystack.l_mark[-2].num; |
927 | } |
928 | break; |
929 | case 49: |
930 | #line 397 "grammar.y" |
931 | { |
932 | struct array *src, *dst; |
933 | |
934 | if (yystack.l_mark[-1].bsm_set->bss_type != SET_TYPE_AUCLASS && |
935 | yystack.l_mark[-1].bsm_set->bss_type != SET_TYPE_AUEVENT) |
936 | conf_detail(0, "supplied set contains no audit " |
937 | "events or classes"); |
938 | bm_state->bm_event_type = yystack.l_mark[-1].bsm_set->bss_type; |
939 | src = &yystack.l_mark[-1].bsm_set->bss_data; |
940 | dst = &bm_state->bm_auditevent; |
941 | *dst = *src; |
942 | bzero(&array_state, sizeof(struct array)); |
943 | dst->a_negated = yystack.l_mark[-2].num; |
944 | } |
945 | break; |
946 | case 50: |
947 | #line 412 "grammar.y" |
948 | { |
949 | bm_state->bm_event_type = SET_TYPE_AUEVENT; |
950 | bm_state->bm_event_flags |= BSM_STATE_EVENT_ANY0x00000001U; |
951 | bzero(&array_state, sizeof(struct array)); |
952 | } |
953 | break; |
954 | case 51: |
955 | #line 421 "grammar.y" |
956 | { |
957 | struct array *src, *dst; |
958 | struct bsm_set *ptr; |
959 | |
960 | if ((ptr = conf_get_bsm_set(yystack.l_mark[-1].str)) == NULL((void *)0)) |
961 | conf_detail(0, "%s: invalid set", yystack.l_mark[-1].str); |
962 | #ifdef PCRE |
963 | if (ptr->bss_type != SET_TYPE_PATH && |
964 | ptr->bss_type != SET_TYPE_PCRE) |
965 | conf_detail(0, "objects must be of type path or pcre"); |
966 | #else |
967 | if (ptr->bss_type != SET_TYPE_PATH) |
968 | conf_detail(0, "objects must be of type path"); |
969 | #endif |
970 | src = &ptr->bss_data; |
971 | dst = &bm_state->bm_objects; |
972 | *dst = *src; |
973 | bzero(&array_state, sizeof(struct array)); |
974 | dst->a_negated = yystack.l_mark[-2].num; |
975 | } |
976 | break; |
977 | case 52: |
978 | #line 442 "grammar.y" |
979 | { |
980 | struct array *src, *dst; |
981 | |
982 | src = &yystack.l_mark[-1].bsm_set->bss_data; |
983 | #ifdef PCRE |
984 | if (yystack.l_mark[-1].bsm_set->bss_type != SET_TYPE_PATH && |
985 | yystack.l_mark[-1].bsm_set->bss_type != SET_TYPE_PCRE) |
986 | conf_detail(0, "objects must be of type path or pcre"); |
987 | #else |
988 | if (yystack.l_mark[-1].bsm_set->bss_type != SET_TYPE_PATH) |
989 | conf_detail(0, "objects must be of type path"); |
990 | #endif |
991 | dst = &bm_state->bm_objects; |
992 | *dst = *src; |
993 | bzero(&array_state, sizeof(struct array)); |
994 | dst->a_negated = yystack.l_mark[-2].num; |
995 | } |
996 | break; |
997 | case 53: |
998 | #line 463 "grammar.y" |
999 | { |
1000 | yyval.num = EVENT_SUCCESS; |
1001 | } |
1002 | break; |
1003 | case 54: |
1004 | #line 467 "grammar.y" |
1005 | { |
1006 | yyval.num = EVENT_FAILURE; |
1007 | } |
1008 | break; |
1009 | case 55: |
1010 | #line 471 "grammar.y" |
1011 | { |
1012 | yyval.num = EVENT_SUCCESS_OR_FAILURE; |
1013 | } |
1014 | break; |
1015 | case 56: |
1016 | #line 478 "grammar.y" |
1017 | { |
1018 | yyval.num = yystack.l_mark[-1].num; |
1019 | } |
1020 | break; |
1021 | case 57: |
1022 | #line 485 "grammar.y" |
1023 | { |
1024 | strlcpy(bm_state->bm_trig, yystack.l_mark[-1].str, sizeof(bm_state->bm_trig)); |
1025 | } |
1026 | break; |
1027 | case 60: |
1028 | #line 493 "grammar.y" |
1029 | { |
1030 | assert(bm_state != NULL)((bm_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 494, "bm_state != NULL")); |
1031 | bm_state->bm_status = yystack.l_mark[0].num; |
1032 | } |
1033 | break; |
1034 | case 61: |
1035 | #line 498 "grammar.y" |
1036 | { |
1037 | assert(bm_state != NULL)((bm_state != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 499, "bm_state != NULL")); |
1038 | bm_state->bm_multiplier = yystack.l_mark[0].num; |
1039 | } |
1040 | break; |
1041 | case 64: |
1042 | #line 508 "grammar.y" |
1043 | { |
1044 | assert(bm_state == NULL)((bm_state == ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y" , 509, "bm_state == NULL")); |
1045 | if ((bm_state = calloc(1, sizeof(*bm_state))) == NULL((void *)0)) |
1046 | bsmtrace_error(1, "%s: calloc failed", __func__); |
1047 | } |
1048 | break; |
1049 | case 65: |
1050 | #line 514 "grammar.y" |
1051 | { |
1052 | yyval.bsm_state = bm_state; |
1053 | bm_state = NULL((void *)0); |
1054 | } |
1055 | break; |
1056 | case 66: |
1057 | #line 522 "grammar.y" |
1058 | { |
1059 | yyval.array = &array_state; |
1060 | } |
1061 | break; |
1062 | case 67: |
1063 | #line 526 "grammar.y" |
1064 | { |
1065 | assert(yystack.l_mark[-2].array != NULL && yystack.l_mark[0].array != NULL)((yystack.l_mark[-2].array != ((void *)0) && yystack. l_mark[0].array != ((void *)0)) ? (void)0 : __assert(__func__ , "grammar.y", 527, "yystack.l_mark[-2].array != NULL && yystack.l_mark[0].array != NULL" )); |
1066 | yyval.array = &array_state; |
1067 | } |
1068 | break; |
1069 | case 68: |
1070 | #line 534 "grammar.y" |
1071 | { |
1072 | assert(set_state != NULL && yystack.l_mark[0].str != NULL)((set_state != ((void *)0) && yystack.l_mark[0].str != ((void *)0)) ? (void)0 : __assert(__func__, "grammar.y", 535 , "set_state != NULL && yystack.l_mark[0].str != NULL" )); |
1073 | conf_array_add(yystack.l_mark[0].str, &array_state, set_state->bss_type); |
1074 | free(yystack.l_mark[0].str); |
1075 | yyval.array = &array_state; |
1076 | } |
1077 | break; |
1078 | case 69: |
1079 | #line 541 "grammar.y" |
1080 | { |
1081 | int val, len; |
1082 | char *str; |
1083 | |
1084 | len = 1; |
1085 | val = yystack.l_mark[0].num; |
1086 | while (val > 9) { |
1087 | ++len; |
1088 | val /= 10; |
1089 | } |
1090 | str = calloc(1, len + 1); |
1091 | if (str == NULL((void *)0)) |
1092 | bsmtrace_error(1, "%s: calloc failed", __func__); |
1093 | str += len; |
1094 | do { |
1095 | *--str = '0' + (yystack.l_mark[0].num % 10); |
1096 | yystack.l_mark[0].num /= 10; |
1097 | } while (yystack.l_mark[0].num); |
1098 | conf_array_add(str, &array_state, set_state->bss_type); |
1099 | yyval.array = &array_state; |
1100 | } |
1101 | break; |
1102 | case 70: |
1103 | #line 563 "grammar.y" |
1104 | { |
1105 | assert(yystack.l_mark[-1].str != NULL)((yystack.l_mark[-1].str != ((void *)0)) ? (void)0 : __assert (__func__, "grammar.y", 564, "yystack.l_mark[-1].str != NULL" )); |
1106 | conf_array_add(yystack.l_mark[-1].str, &array_state, set_state->bss_type); |
1107 | yyval.array = &array_state; |
1108 | } |
1109 | break; |
1110 | #line 1110 "y.tab.c" |
1111 | } |
1112 | yystack.s_mark -= yym; |
1113 | yystate = *yystack.s_mark; |
1114 | yystack.l_mark -= yym; |
1115 | yym = yylhs[yyn]; |
1116 | if (yystate == 0 && yym == 0) |
1117 | { |
1118 | #if YYDEBUG0 |
1119 | if (yydebug) |
1120 | printf("%sdebug: after reduction, shifting from state 0 to\ |
1121 | state %d\n", YYPREFIX"yy", YYFINAL1); |
1122 | #endif |
1123 | yystate = YYFINAL1; |
1124 | *++yystack.s_mark = YYFINAL1; |
1125 | *++yystack.l_mark = yyval; |
1126 | if (yychar < 0) |
1127 | { |
1128 | if ((yychar = YYLEXyylex()) < 0) yychar = 0; |
1129 | #if YYDEBUG0 |
1130 | if (yydebug) |
1131 | { |
1132 | yys = 0; |
1133 | if (yychar <= YYMAXTOKEN294) yys = yyname[yychar]; |
1134 | if (!yys) yys = "illegal-symbol"; |
1135 | printf("%sdebug: state %d, reading %d (%s)\n", |
1136 | YYPREFIX"yy", YYFINAL1, yychar, yys); |
1137 | } |
1138 | #endif |
1139 | } |
1140 | if (yychar == 0) goto yyaccept; |
1141 | goto yyloop; |
1142 | } |
1143 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && |
1144 | yyn <= YYTABLESIZE117 && yycheck[yyn] == yystate) |
1145 | yystate = yytable[yyn]; |
1146 | else |
1147 | yystate = yydgoto[yym]; |
1148 | #if YYDEBUG0 |
1149 | if (yydebug) |
1150 | printf("%sdebug: after reduction, shifting from state %d \ |
1151 | to state %d\n", YYPREFIX"yy", *yystack.s_mark, yystate); |
1152 | #endif |
1153 | if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) |
1154 | { |
1155 | goto yyoverflow; |
1156 | } |
1157 | *++yystack.s_mark = (short) yystate; |
1158 | *++yystack.l_mark = yyval; |
1159 | goto yyloop; |
1160 | |
1161 | yyoverflow: |
1162 | yyerror("yacc stack overflow"); |
1163 | |
1164 | yyabort: |
1165 | yyfreestack(&yystack); |
1166 | return (1); |
1167 | |
1168 | yyaccept: |
1169 | yyfreestack(&yystack); |
1170 | return (0); |
1171 | } |