9 #define yyclearin (yychar=(YYEMPTY))
10 #define yyerrok (yyerrflag=0)
11 #define YYRECOVERING() (yyerrflag!=0)
15 * Copyright (c) 1996, 1998-2005, 2007-2012
16 * Todd C. Miller <Todd.Miller@courtesan.com>
18 * Permission to use, copy, modify, and distribute this software for any
19 * purpose with or without fee is hereby granted, provided that the above
20 * copyright notice and this permission notice appear in all copies.
22 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
23 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
25 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
26 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
27 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
28 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * Sponsored in part by the Defense Advanced Research Projects
33 * Agency (DARPA) and Air Force Research Laboratory, Air Force
34 * Materiel Command, USAF, under agreement number F39502-99-1-0512.
39 #include <sys/types.h>
40 #include <sys/param.h>
49 #endif /* STDC_HEADERS */
52 #endif /* HAVE_STRING_H */
55 #endif /* HAVE_STRINGS_H */
58 #endif /* HAVE_UNISTD_H */
59 #ifdef HAVE_INTTYPES_H
60 # include <inttypes.h>
62 #if defined(YYBISON) && defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
64 #endif /* YYBISON && HAVE_ALLOCA_H && !__GNUC__ */
67 #include "sudoers.h" /* XXX */
73 * We must define SIZE_MAX for yacc's skeleton.c.
74 * If there is no SIZE_MAX or SIZE_T_MAX we have to assume that size_t
75 * could be signed (as it is on SunOS 4.x).
79 # define SIZE_MAX SIZE_T_MAX
81 # define SIZE_MAX INT_MAX
82 # endif /* SIZE_T_MAX */
88 extern int sudolineno;
89 extern int last_token;
91 bool sudoers_warnings = true;
92 bool parse_error = false;
94 char *errorfile = NULL;
96 struct defaults_list defaults;
97 struct userspec_list userspecs;
102 static void add_defaults(int, struct member *, struct defaults *);
103 static void add_userspec(struct member *, struct privilege *);
104 static struct defaults *new_default(char *, char *, int);
105 static struct member *new_member(char *, int);
106 void yyerror(const char *);
109 yyerror(const char *s)
111 debug_decl(yyerror, SUDO_DEBUG_PARSER)
113 /* If we last saw a newline the error is on the preceding line. */
114 if (last_token == COMMENT)
117 /* Save the line the first error occurred on. */
118 if (errorlineno == -1) {
119 errorlineno = sudolineno;
120 errorfile = estrdup(sudoers);
122 if (sudoers_warnings && s != NULL) {
125 if (trace_print == NULL || trace_print == sudoers_trace_print)
126 warningx(_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno);
133 #ifndef YYSTYPE_DEFINED
134 #define YYSTYPE_DEFINED
136 struct cmndspec *cmndspec;
137 struct defaults *defaults;
138 struct member *member;
139 struct runascontainer *runas;
140 struct privilege *privilege;
141 struct sudo_command command;
143 struct selinux_info seinfo;
144 struct solaris_privs_info privinfo;
148 #endif /* YYSTYPE_DEFINED */
155 #define USERGROUP 262
158 #define DEFAULTS_HOST 265
159 #define DEFAULTS_USER 266
160 #define DEFAULTS_RUNAS 267
161 #define DEFAULTS_CMND 268
168 #define LOG_INPUT 275
169 #define NOLOG_INPUT 276
170 #define LOG_OUTPUT 277
171 #define NOLOG_OUTPUT 278
174 #define HOSTALIAS 281
175 #define CMNDALIAS 282
176 #define USERALIAS 283
177 #define RUNASALIAS 284
182 #define LIMITPRIVS 289
184 #define YYERRCODE 256
185 #if defined(__cplusplus) || defined(__STDC__)
186 const short yylhs[] =
191 0, 0, 28, 28, 29, 29, 29, 29, 29, 29,
192 29, 29, 29, 29, 29, 29, 4, 4, 3, 3,
193 3, 3, 3, 20, 20, 19, 10, 10, 8, 8,
194 8, 8, 8, 2, 2, 1, 6, 6, 23, 24,
195 22, 22, 22, 22, 22, 26, 27, 25, 25, 25,
196 25, 25, 17, 17, 18, 18, 18, 18, 18, 21,
197 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
198 5, 5, 5, 31, 31, 34, 9, 9, 32, 32,
199 35, 7, 7, 33, 33, 36, 30, 30, 37, 13,
200 13, 11, 11, 12, 12, 12, 12, 12, 16, 16,
203 #if defined(__cplusplus) || defined(__STDC__)
204 const short yylen[] =
209 0, 1, 1, 2, 1, 2, 2, 2, 2, 2,
210 2, 2, 3, 3, 3, 3, 1, 3, 1, 2,
211 3, 3, 3, 1, 3, 3, 1, 2, 1, 1,
212 1, 1, 1, 1, 3, 5, 1, 2, 3, 3,
213 0, 1, 1, 2, 2, 3, 3, 0, 1, 1,
214 2, 2, 0, 3, 0, 1, 3, 2, 1, 0,
215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
216 1, 1, 1, 1, 3, 3, 1, 3, 1, 3,
217 3, 1, 3, 1, 3, 3, 1, 3, 3, 1,
218 3, 1, 2, 1, 1, 1, 1, 1, 1, 3,
221 #if defined(__cplusplus) || defined(__STDC__)
222 const short yydefred[] =
227 0, 94, 96, 97, 98, 0, 0, 0, 0, 0,
228 95, 5, 0, 0, 0, 0, 0, 0, 90, 92,
229 0, 0, 3, 6, 0, 0, 17, 0, 29, 32,
230 31, 33, 30, 0, 27, 0, 77, 0, 0, 73,
231 72, 71, 0, 37, 82, 0, 0, 0, 74, 0,
232 0, 79, 0, 0, 87, 0, 0, 84, 93, 0,
233 0, 24, 0, 4, 0, 0, 0, 20, 0, 28,
234 0, 0, 0, 0, 38, 0, 0, 0, 0, 0,
235 0, 0, 0, 0, 0, 91, 0, 0, 21, 22,
236 23, 18, 78, 83, 0, 75, 0, 80, 0, 88,
237 0, 85, 0, 34, 0, 0, 25, 0, 0, 0,
238 0, 0, 0, 0, 0, 0, 103, 105, 104, 0,
239 99, 101, 0, 0, 54, 35, 0, 0, 0, 0,
240 60, 0, 0, 44, 45, 102, 0, 0, 40, 39,
241 0, 0, 0, 51, 52, 100, 46, 47, 61, 62,
242 63, 64, 65, 66, 67, 68, 69, 70, 36,
244 #if defined(__cplusplus) || defined(__STDC__)
245 const short yydgoto[] =
250 104, 105, 27, 28, 44, 45, 46, 35, 61, 37,
251 19, 20, 21, 121, 122, 123, 106, 110, 62, 63,
252 143, 114, 115, 116, 131, 132, 133, 22, 23, 54,
253 48, 51, 57, 49, 52, 58, 55,
255 #if defined(__cplusplus) || defined(__STDC__)
256 const short yysindex[] =
261 -270, 0, 0, 0, 0, -21, -5, 553, 553, 20,
262 0, 0, -242, -229, -216, -214, -240, 0, 0, 0,
263 -27, 541, 0, 0, -18, -227, 0, 2, 0, 0,
264 0, 0, 0, -223, 0, -33, 0, -31, -31, 0,
265 0, 0, -243, 0, 0, -24, -12, -6, 0, 3,
266 4, 0, 5, 7, 0, 6, 10, 0, 0, 553,
267 -20, 0, 11, 0, -206, -193, -191, 0, -21, 0,
268 -5, 2, 2, 2, 0, 20, 2, -5, -242, 20,
269 -229, 553, -216, 553, -214, 0, 33, -5, 0, 0,
270 0, 0, 0, 0, 31, 0, 32, 0, 34, 0,
271 34, 0, 513, 0, 35, -226, 0, 86, -25, 36,
272 33, 19, 21, -234, -202, -201, 0, 0, 0, -232,
273 0, 0, 41, 86, 0, 0, -176, -173, 37, 38,
274 0, -198, -195, 0, 0, 0, 86, 41, 0, 0,
275 -169, -168, 569, 0, 0, 0, 0, 0, 0, 0,
276 0, 0, 0, 0, 0, 0, 0, 0, 0,};
277 #if defined(__cplusplus) || defined(__STDC__)
278 const short yyrindex[] =
283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
285 0, 97, 0, 0, 1, 0, 0, 177, 0, 0,
286 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
287 0, 0, 0, 0, 0, 0, 0, 207, 0, 0,
288 237, 0, 0, 271, 0, 0, 300, 0, 0, 0,
289 0, 0, 329, 0, 0, 0, 0, 0, 0, 0,
290 0, 358, 387, 417, 0, 0, 446, 0, 0, 0,
291 0, 0, 0, 0, 0, 0, 463, 0, 0, 0,
292 0, 0, 0, 0, 30, 0, 59, 0, 89, 0,
293 118, 0, 60, 0, 148, -28, 0, 62, 63, 0,
294 463, 0, 0, 594, 489, 512, 0, 0, 0, 0,
295 0, 0, 64, 0, 0, 0, 0, 0, 0, 0,
296 0, 623, 653, 0, 0, 0, 0, 65, 0, 0,
297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
298 0, 0, 0, 0, 0, 0, 0, 0, 0,};
299 #if defined(__cplusplus) || defined(__STDC__)
300 const short yygindex[] =
305 -11, 0, 39, 12, 66, -72, 27, 76, -4, 40,
306 52, 98, -1, -23, -7, -8, 0, 0, 42, 0,
307 0, 0, 8, 13, 0, -13, -9, 0, 99, 0,
308 0, 0, 0, 46, 45, 44, 48,
310 #define YYTABLESIZE 932
311 #if defined(__cplusplus) || defined(__STDC__)
312 const short yytable[] =
317 19, 26, 36, 94, 41, 34, 38, 39, 26, 24,
318 71, 26, 60, 40, 41, 47, 60, 2, 60, 76,
319 3, 4, 5, 71, 66, 117, 67, 34, 50, 76,
320 118, 68, 124, 19, 29, 42, 30, 31, 11, 32,
321 87, 53, 65, 56, 19, 69, 119, 72, 78, 73,
322 74, 79, 43, 129, 130, 33, 89, 77, 81, 112,
323 113, 81, 76, 80, 83, 82, 84, 85, 88, 90,
324 159, 91, 103, 95, 71, 76, 125, 60, 111, 127,
325 99, 128, 101, 112, 137, 113, 139, 76, 89, 140,
326 130, 81, 129, 147, 148, 1, 2, 141, 142, 126,
327 55, 109, 59, 56, 58, 57, 97, 92, 75, 70,
328 93, 86, 136, 146, 59, 138, 81, 86, 120, 145,
329 64, 89, 144, 135, 96, 98, 0, 134, 102, 107,
330 100, 0, 0, 0, 0, 0, 0, 0, 0, 0,
331 0, 0, 0, 0, 0, 0, 89, 26, 0, 0,
332 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
333 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
334 0, 0, 0, 0, 0, 86, 12, 0, 0, 0,
335 26, 0, 0, 0, 0, 0, 0, 0, 0, 0,
336 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
337 0, 0, 0, 0, 0, 26, 9, 0, 0, 12,
338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
339 0, 0, 0, 0, 0, 25, 0, 25, 41, 41,
340 29, 0, 30, 31, 25, 32, 10, 25, 0, 9,
341 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
342 41, 33, 29, 0, 30, 31, 19, 32, 19, 41,
343 41, 19, 19, 19, 19, 19, 19, 19, 19, 10,
344 8, 0, 0, 33, 0, 0, 40, 41, 0, 19,
345 19, 19, 19, 19, 19, 76, 0, 76, 0, 0,
346 76, 76, 76, 76, 76, 76, 76, 76, 42, 11,
347 0, 0, 0, 8, 0, 0, 0, 0, 76, 76,
348 76, 76, 76, 76, 81, 0, 81, 0, 0, 81,
349 81, 81, 81, 81, 81, 81, 81, 0, 7, 0,
350 0, 0, 11, 0, 0, 0, 0, 81, 81, 81,
351 81, 81, 81, 117, 89, 0, 89, 0, 118, 89,
352 89, 89, 89, 89, 89, 89, 89, 15, 0, 0,
353 0, 7, 0, 0, 119, 0, 0, 89, 89, 89,
354 89, 89, 89, 86, 0, 86, 0, 0, 86, 86,
355 86, 86, 86, 86, 86, 86, 13, 0, 0, 0,
356 15, 0, 0, 0, 0, 0, 86, 86, 86, 86,
357 86, 86, 0, 26, 0, 26, 0, 0, 26, 26,
358 26, 26, 26, 26, 26, 26, 14, 0, 0, 13,
359 0, 0, 0, 0, 0, 0, 26, 26, 26, 26,
360 26, 26, 12, 0, 12, 0, 0, 12, 12, 12,
361 12, 12, 12, 12, 12, 16, 0, 0, 0, 14,
362 0, 0, 0, 0, 0, 12, 12, 12, 12, 12,
363 12, 0, 9, 0, 9, 0, 0, 9, 9, 9,
364 9, 9, 9, 9, 9, 0, 0, 0, 16, 0,
365 0, 0, 0, 0, 0, 9, 9, 9, 9, 9,
366 9, 0, 10, 0, 10, 53, 0, 10, 10, 10,
367 10, 10, 10, 10, 10, 0, 0, 0, 0, 0,
368 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
369 10, 42, 0, 0, 0, 0, 8, 0, 8, 0,
370 0, 8, 8, 8, 8, 8, 8, 8, 8, 0,
371 0, 0, 0, 0, 43, 17, 0, 0, 0, 8,
372 8, 8, 8, 8, 8, 11, 0, 11, 0, 0,
373 11, 11, 11, 11, 11, 11, 11, 11, 0, 0,
374 108, 0, 0, 17, 0, 0, 0, 0, 11, 11,
375 11, 11, 11, 11, 7, 17, 7, 0, 0, 7,
376 7, 7, 7, 7, 7, 7, 7, 0, 0, 0,
377 0, 43, 0, 0, 0, 0, 0, 7, 7, 7,
378 7, 7, 7, 15, 0, 15, 0, 0, 15, 15,
379 15, 15, 15, 15, 15, 15, 48, 0, 0, 0,
380 0, 0, 0, 0, 0, 0, 15, 15, 15, 15,
381 15, 15, 13, 0, 13, 0, 0, 13, 13, 13,
382 13, 13, 13, 13, 13, 49, 0, 0, 0, 0,
383 0, 0, 0, 0, 0, 13, 13, 13, 13, 13,
384 13, 0, 14, 0, 14, 0, 0, 14, 14, 14,
385 14, 14, 14, 14, 14, 50, 0, 0, 0, 0,
386 0, 0, 0, 0, 0, 14, 14, 14, 14, 14,
387 14, 16, 0, 16, 0, 0, 16, 16, 16, 16,
388 16, 16, 16, 16, 0, 0, 0, 0, 0, 53,
389 53, 0, 0, 0, 16, 16, 16, 16, 16, 16,
390 0, 53, 53, 53, 53, 53, 53, 53, 53, 53,
391 53, 53, 0, 0, 0, 42, 42, 0, 53, 53,
392 53, 53, 0, 0, 0, 0, 0, 42, 42, 42,
393 42, 42, 42, 42, 42, 42, 42, 42, 43, 43,
394 2, 0, 0, 3, 4, 5, 42, 42, 0, 0,
395 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
396 43, 11, 0, 0, 0, 0, 1, 0, 2, 43,
397 43, 3, 4, 5, 6, 7, 8, 9, 10, 0,
398 2, 0, 0, 3, 4, 5, 0, 0, 0, 11,
399 12, 13, 14, 15, 16, 40, 41, 0, 0, 0,
400 0, 11, 0, 0, 0, 0, 0, 149, 150, 151,
401 152, 153, 154, 155, 156, 157, 158, 42, 0, 0,
402 48, 48, 0, 0, 0, 0, 0, 0, 0, 0,
403 0, 0, 48, 48, 48, 48, 48, 48, 48, 48,
404 48, 48, 48, 0, 0, 0, 0, 0, 0, 49,
405 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,
406 0, 49, 49, 49, 49, 49, 49, 49, 49, 49,
407 49, 49, 0, 0, 0, 0, 0, 0, 0, 50,
408 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
409 0, 50, 50, 50, 50, 50, 50, 50, 50, 50,
412 #if defined(__cplusplus) || defined(__STDC__)
413 const short yycheck[] =
418 0, 33, 7, 76, 33, 33, 8, 9, 33, 280,
419 44, 33, 44, 257, 258, 258, 44, 258, 44, 44,
420 261, 262, 263, 44, 43, 258, 45, 33, 258, 0,
421 263, 259, 58, 33, 258, 279, 260, 261, 279, 263,
422 61, 258, 61, 258, 44, 44, 279, 36, 61, 38,
423 39, 58, 33, 288, 289, 279, 263, 46, 0, 286,
424 287, 58, 33, 61, 58, 61, 61, 58, 58, 263,
425 143, 263, 40, 78, 44, 44, 41, 44, 44, 61,
426 82, 61, 84, 286, 44, 287, 263, 58, 0, 263,
427 289, 33, 288, 263, 263, 0, 0, 61, 61, 111,
428 41, 103, 41, 41, 41, 41, 80, 69, 43, 34,
429 71, 60, 120, 137, 17, 124, 58, 0, 33, 133,
430 22, 33, 132, 116, 79, 81, -1, 115, 85, 88,
431 83, -1, -1, -1, -1, -1, -1, -1, -1, -1,
432 -1, -1, -1, -1, -1, -1, 58, 0, -1, -1,
433 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
434 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
435 -1, -1, -1, -1, -1, 58, 0, -1, -1, -1,
436 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
437 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
438 -1, -1, -1, -1, -1, 58, 0, -1, -1, 33,
439 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
440 -1, -1, -1, -1, -1, 259, -1, 259, 257, 258,
441 258, -1, 260, 261, 259, 263, 0, 259, -1, 33,
442 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
443 279, 279, 258, -1, 260, 261, 256, 263, 258, 288,
444 289, 261, 262, 263, 264, 265, 266, 267, 268, 33,
445 0, -1, -1, 279, -1, -1, 257, 258, -1, 279,
446 280, 281, 282, 283, 284, 256, -1, 258, -1, -1,
447 261, 262, 263, 264, 265, 266, 267, 268, 279, 0,
448 -1, -1, -1, 33, -1, -1, -1, -1, 279, 280,
449 281, 282, 283, 284, 256, -1, 258, -1, -1, 261,
450 262, 263, 264, 265, 266, 267, 268, -1, 0, -1,
451 -1, -1, 33, -1, -1, -1, -1, 279, 280, 281,
452 282, 283, 284, 258, 256, -1, 258, -1, 263, 261,
453 262, 263, 264, 265, 266, 267, 268, 0, -1, -1,
454 -1, 33, -1, -1, 279, -1, -1, 279, 280, 281,
455 282, 283, 284, 256, -1, 258, -1, -1, 261, 262,
456 263, 264, 265, 266, 267, 268, 0, -1, -1, -1,
457 33, -1, -1, -1, -1, -1, 279, 280, 281, 282,
458 283, 284, -1, 256, -1, 258, -1, -1, 261, 262,
459 263, 264, 265, 266, 267, 268, 0, -1, -1, 33,
460 -1, -1, -1, -1, -1, -1, 279, 280, 281, 282,
461 283, 284, 256, -1, 258, -1, -1, 261, 262, 263,
462 264, 265, 266, 267, 268, 0, -1, -1, -1, 33,
463 -1, -1, -1, -1, -1, 279, 280, 281, 282, 283,
464 284, -1, 256, -1, 258, -1, -1, 261, 262, 263,
465 264, 265, 266, 267, 268, -1, -1, -1, 33, -1,
466 -1, -1, -1, -1, -1, 279, 280, 281, 282, 283,
467 284, -1, 256, -1, 258, 33, -1, 261, 262, 263,
468 264, 265, 266, 267, 268, -1, -1, -1, -1, -1,
469 -1, -1, -1, -1, -1, 279, 280, 281, 282, 283,
470 284, 33, -1, -1, -1, -1, 256, -1, 258, -1,
471 -1, 261, 262, 263, 264, 265, 266, 267, 268, -1,
472 -1, -1, -1, -1, 33, 33, -1, -1, -1, 279,
473 280, 281, 282, 283, 284, 256, -1, 258, -1, -1,
474 261, 262, 263, 264, 265, 266, 267, 268, -1, -1,
475 58, -1, -1, 33, -1, -1, -1, -1, 279, 280,
476 281, 282, 283, 284, 256, 33, 258, -1, -1, 261,
477 262, 263, 264, 265, 266, 267, 268, -1, -1, -1,
478 -1, 33, -1, -1, -1, -1, -1, 279, 280, 281,
479 282, 283, 284, 256, -1, 258, -1, -1, 261, 262,
480 263, 264, 265, 266, 267, 268, 33, -1, -1, -1,
481 -1, -1, -1, -1, -1, -1, 279, 280, 281, 282,
482 283, 284, 256, -1, 258, -1, -1, 261, 262, 263,
483 264, 265, 266, 267, 268, 33, -1, -1, -1, -1,
484 -1, -1, -1, -1, -1, 279, 280, 281, 282, 283,
485 284, -1, 256, -1, 258, -1, -1, 261, 262, 263,
486 264, 265, 266, 267, 268, 33, -1, -1, -1, -1,
487 -1, -1, -1, -1, -1, 279, 280, 281, 282, 283,
488 284, 256, -1, 258, -1, -1, 261, 262, 263, 264,
489 265, 266, 267, 268, -1, -1, -1, -1, -1, 257,
490 258, -1, -1, -1, 279, 280, 281, 282, 283, 284,
491 -1, 269, 270, 271, 272, 273, 274, 275, 276, 277,
492 278, 279, -1, -1, -1, 257, 258, -1, 286, 287,
493 288, 289, -1, -1, -1, -1, -1, 269, 270, 271,
494 272, 273, 274, 275, 276, 277, 278, 279, 257, 258,
495 258, -1, -1, 261, 262, 263, 288, 289, -1, -1,
496 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
497 279, 279, -1, -1, -1, -1, 256, -1, 258, 288,
498 289, 261, 262, 263, 264, 265, 266, 267, 268, -1,
499 258, -1, -1, 261, 262, 263, -1, -1, -1, 279,
500 280, 281, 282, 283, 284, 257, 258, -1, -1, -1,
501 -1, 279, -1, -1, -1, -1, -1, 269, 270, 271,
502 272, 273, 274, 275, 276, 277, 278, 279, -1, -1,
503 257, 258, -1, -1, -1, -1, -1, -1, -1, -1,
504 -1, -1, 269, 270, 271, 272, 273, 274, 275, 276,
505 277, 278, 279, -1, -1, -1, -1, -1, -1, 257,
506 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
507 -1, 269, 270, 271, 272, 273, 274, 275, 276, 277,
508 278, 279, -1, -1, -1, -1, -1, -1, -1, 257,
509 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
510 -1, 269, 270, 271, 272, 273, 274, 275, 276, 277,
517 #define YYMAXTOKEN 290
519 #if defined(__cplusplus) || defined(__STDC__)
520 const char * const yyname[] =
525 "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,
526 "'!'",0,0,0,0,0,0,"'('","')'",0,"'+'","','","'-'",0,0,0,0,0,0,0,0,0,0,0,0,"':'",
527 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,
528 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,
529 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,
530 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,
531 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,
532 "COMMAND","ALIAS","DEFVAR","NTWKADDR","NETGROUP","USERGROUP","WORD","DEFAULTS",
533 "DEFAULTS_HOST","DEFAULTS_USER","DEFAULTS_RUNAS","DEFAULTS_CMND","NOPASSWD",
534 "PASSWD","NOEXEC","EXEC","SETENV","NOSETENV","LOG_INPUT","NOLOG_INPUT",
535 "LOG_OUTPUT","NOLOG_OUTPUT","ALL","COMMENT","HOSTALIAS","CMNDALIAS","USERALIAS",
536 "RUNASALIAS","ERROR","TYPE","ROLE","PRIVS","LIMITPRIVS","MYSELF",
538 #if defined(__cplusplus) || defined(__STDC__)
539 const char * const yyrule[] =
549 "entry : error COMMENT",
550 "entry : userlist privileges",
551 "entry : USERALIAS useraliases",
552 "entry : HOSTALIAS hostaliases",
553 "entry : CMNDALIAS cmndaliases",
554 "entry : RUNASALIAS runasaliases",
555 "entry : DEFAULTS defaults_list",
556 "entry : DEFAULTS_USER userlist defaults_list",
557 "entry : DEFAULTS_RUNAS userlist defaults_list",
558 "entry : DEFAULTS_HOST hostlist defaults_list",
559 "entry : DEFAULTS_CMND cmndlist defaults_list",
560 "defaults_list : defaults_entry",
561 "defaults_list : defaults_list ',' defaults_entry",
562 "defaults_entry : DEFVAR",
563 "defaults_entry : '!' DEFVAR",
564 "defaults_entry : DEFVAR '=' WORD",
565 "defaults_entry : DEFVAR '+' WORD",
566 "defaults_entry : DEFVAR '-' WORD",
567 "privileges : privilege",
568 "privileges : privileges ':' privilege",
569 "privilege : hostlist '=' cmndspeclist",
577 "cmndspeclist : cmndspec",
578 "cmndspeclist : cmndspeclist ',' cmndspec",
579 "cmndspec : runasspec selinux solarisprivs cmndtag opcmnd",
582 "rolespec : ROLE '=' WORD",
583 "typespec : TYPE '=' WORD",
585 "selinux : rolespec",
586 "selinux : typespec",
587 "selinux : rolespec typespec",
588 "selinux : typespec rolespec",
589 "privsspec : PRIVS '=' WORD",
590 "limitprivsspec : LIMITPRIVS '=' WORD",
592 "solarisprivs : privsspec",
593 "solarisprivs : limitprivsspec",
594 "solarisprivs : privsspec limitprivsspec",
595 "solarisprivs : limitprivsspec privsspec",
597 "runasspec : '(' runaslist ')'",
599 "runaslist : userlist",
600 "runaslist : userlist ':' grouplist",
601 "runaslist : ':' grouplist",
604 "cmndtag : cmndtag NOPASSWD",
605 "cmndtag : cmndtag PASSWD",
606 "cmndtag : cmndtag NOEXEC",
607 "cmndtag : cmndtag EXEC",
608 "cmndtag : cmndtag SETENV",
609 "cmndtag : cmndtag NOSETENV",
610 "cmndtag : cmndtag LOG_INPUT",
611 "cmndtag : cmndtag NOLOG_INPUT",
612 "cmndtag : cmndtag LOG_OUTPUT",
613 "cmndtag : cmndtag NOLOG_OUTPUT",
617 "hostaliases : hostalias",
618 "hostaliases : hostaliases ':' hostalias",
619 "hostalias : ALIAS '=' hostlist",
621 "hostlist : hostlist ',' ophost",
622 "cmndaliases : cmndalias",
623 "cmndaliases : cmndaliases ':' cmndalias",
624 "cmndalias : ALIAS '=' cmndlist",
626 "cmndlist : cmndlist ',' opcmnd",
627 "runasaliases : runasalias",
628 "runasaliases : runasaliases ':' runasalias",
629 "runasalias : ALIAS '=' userlist",
630 "useraliases : useralias",
631 "useraliases : useraliases ':' useralias",
632 "useralias : ALIAS '=' userlist",
634 "userlist : userlist ',' opuser",
642 "grouplist : opgroup",
643 "grouplist : grouplist ',' opgroup",
645 "opgroup : '!' group",
653 #define YYMAXDEPTH YYSTACKSIZE
656 #define YYSTACKSIZE YYMAXDEPTH
658 #define YYSTACKSIZE 10000
659 #define YYMAXDEPTH 10000
662 #define YYINITSTACKSIZE 200
677 static struct defaults *
678 new_default(char *var, char *val, int op)
681 debug_decl(new_default, SUDO_DEBUG_PARSER)
683 d = ecalloc(1, sizeof(struct defaults));
686 tq_init(&d->binding);
690 /* d->next = NULL; */
695 static struct member *
696 new_member(char *name, int type)
699 debug_decl(new_member, SUDO_DEBUG_PARSER)
701 m = ecalloc(1, sizeof(struct member));
705 /* m->next = NULL; */
711 * Add a list of defaults structures to the defaults list.
712 * The binding, if non-NULL, specifies a list of hosts, users, or
713 * runas users the entries apply to (specified by the type).
716 add_defaults(int type, struct member *bmem, struct defaults *defs)
719 struct member_list binding;
720 debug_decl(add_defaults, SUDO_DEBUG_PARSER)
723 * We can only call list2tq once on bmem as it will zero
724 * out the prev pointer when it consumes bmem.
726 list2tq(&binding, bmem);
729 * Set type and binding (who it applies to) for new entries.
731 for (d = defs; d != NULL; d = d->next) {
733 d->binding = binding;
735 tq_append(&defaults, defs);
741 * Allocate a new struct userspec, populate it, and insert it at the
742 * and of the userspecs list.
745 add_userspec(struct member *members, struct privilege *privs)
748 debug_decl(add_userspec, SUDO_DEBUG_PARSER)
750 u = ecalloc(1, sizeof(*u));
751 list2tq(&u->users, members);
752 list2tq(&u->privileges, privs);
754 /* u->next = NULL; */
755 tq_append(&userspecs, u);
761 * Free up space used by data structures from a previous parser run and sets
762 * the current sudoers file to path.
765 init_parser(const char *path, bool quiet)
768 struct member *m, *binding;
770 struct privilege *priv;
772 struct sudo_command *c;
773 debug_decl(init_parser, SUDO_DEBUG_PARSER)
775 while ((us = tq_pop(&userspecs)) != NULL) {
776 while ((m = tq_pop(&us->users)) != NULL) {
780 while ((priv = tq_pop(&us->privileges)) != NULL) {
781 struct member *runasuser = NULL, *runasgroup = NULL;
783 char *role = NULL, *type = NULL;
784 #endif /* HAVE_SELINUX */
786 char *privs = NULL, *limitprivs = NULL;
787 #endif /* HAVE_PRIV_SET */
789 while ((m = tq_pop(&priv->hostlist)) != NULL) {
793 while ((cs = tq_pop(&priv->cmndlist)) != NULL) {
795 /* Only free the first instance of a role/type. */
796 if (cs->role != role) {
800 if (cs->type != type) {
804 #endif /* HAVE_SELINUX */
806 /* Only free the first instance of privs/limitprivs. */
807 if (cs->privs != privs) {
811 if (cs->limitprivs != limitprivs) {
812 limitprivs = cs->limitprivs;
813 efree(cs->limitprivs);
815 #endif /* HAVE_PRIV_SET */
816 if (tq_last(&cs->runasuserlist) != runasuser) {
817 runasuser = tq_last(&cs->runasuserlist);
818 while ((m = tq_pop(&cs->runasuserlist)) != NULL) {
823 if (tq_last(&cs->runasgrouplist) != runasgroup) {
824 runasgroup = tq_last(&cs->runasgrouplist);
825 while ((m = tq_pop(&cs->runasgrouplist)) != NULL) {
830 if (cs->cmnd->type == COMMAND) {
831 c = (struct sudo_command *) cs->cmnd->name;
835 efree(cs->cmnd->name);
846 while ((d = tq_pop(&defaults)) != NULL) {
847 if (tq_last(&d->binding) != binding) {
848 binding = tq_last(&d->binding);
849 while ((m = tq_pop(&d->binding)) != NULL) {
850 if (m->type == COMMAND) {
851 c = (struct sudo_command *) m->name;
870 sudoers = path ? estrdup(path) : NULL;
875 sudoers_warnings = !quiet;
880 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
881 #if defined(__cplusplus) || defined(__STDC__)
882 static int yygrowstack(void)
884 static int yygrowstack()
891 newsize = yystacksize ? yystacksize : YYINITSTACKSIZE;
892 if (newsize >= YYMAXDEPTH)
894 else if ((newsize *= 2) > YYMAXDEPTH)
895 newsize = YYMAXDEPTH;
897 #define YY_SIZE_MAX SIZE_MAX
899 #define YY_SIZE_MAX 0x7fffffff
901 if (YY_SIZE_MAX / newsize < sizeof *newss)
904 newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
905 (short *)malloc(newsize * sizeof *newss); /* overflow check above */
910 newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
911 (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
916 yystacksize = newsize;
917 yysslim = yyss + newsize - 1;
930 #define YYABORT goto yyabort
931 #define YYREJECT goto yyabort
932 #define YYACCEPT goto yyaccept
933 #define YYERROR goto yyerrlab
935 #if defined(__cplusplus) || defined(__STDC__)
941 int yym, yyn, yystate;
943 #if defined(__cplusplus) || defined(__STDC__)
945 #else /* !(defined(__cplusplus) || defined(__STDC__)) */
947 #endif /* !(defined(__cplusplus) || defined(__STDC__)) */
949 if ((yys = getenv("YYDEBUG")))
952 if (yyn >= '0' && yyn <= '9')
961 if (yyss == NULL && yygrowstack()) goto yyoverflow;
964 *yyssp = yystate = 0;
967 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
970 if ((yychar = yylex()) < 0) yychar = 0;
975 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
976 if (!yys) yys = "illegal-symbol";
977 printf("%sdebug: state %d, reading %d (%s)\n",
978 YYPREFIX, yystate, yychar, yys);
982 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
983 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
987 printf("%sdebug: state %d, shifting to state %d\n",
988 YYPREFIX, yystate, yytable[yyn]);
990 if (yyssp >= yysslim && yygrowstack())
994 *++yyssp = yystate = yytable[yyn];
997 if (yyerrflag > 0) --yyerrflag;
1000 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
1001 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
1006 if (yyerrflag) goto yyinrecovery;
1007 #if defined(lint) || defined(__GNUC__)
1011 yyerror("syntax error");
1012 #if defined(lint) || defined(__GNUC__)
1023 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
1024 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
1028 printf("%sdebug: state %d, error recovery shifting\
1029 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
1031 if (yyssp >= yysslim && yygrowstack())
1035 *++yyssp = yystate = yytable[yyn];
1043 printf("%sdebug: error recovery discarding state %d\n",
1046 if (yyssp <= yyss) goto yyabort;
1054 if (yychar == 0) goto yyabort;
1059 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1060 if (!yys) yys = "illegal-symbol";
1061 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
1062 YYPREFIX, yystate, yychar, yys);
1071 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1072 YYPREFIX, yystate, yyn, yyrule[yyn]);
1076 yyval = yyvsp[1-yym];
1078 memset(&yyval, 0, sizeof yyval);
1100 add_userspec(yyvsp[-1].member, yyvsp[0].privilege);
1130 add_defaults(DEFAULTS, NULL, yyvsp[0].defaults);
1136 add_defaults(DEFAULTS_USER, yyvsp[-1].member, yyvsp[0].defaults);
1142 add_defaults(DEFAULTS_RUNAS, yyvsp[-1].member, yyvsp[0].defaults);
1148 add_defaults(DEFAULTS_HOST, yyvsp[-1].member, yyvsp[0].defaults);
1154 add_defaults(DEFAULTS_CMND, yyvsp[-1].member, yyvsp[0].defaults);
1160 list_append(yyvsp[-2].defaults, yyvsp[0].defaults);
1161 yyval.defaults = yyvsp[-2].defaults;
1167 yyval.defaults = new_default(yyvsp[0].string, NULL, true);
1173 yyval.defaults = new_default(yyvsp[0].string, NULL, false);
1179 yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, true);
1185 yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '+');
1191 yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '-');
1197 list_append(yyvsp[-2].privilege, yyvsp[0].privilege);
1198 yyval.privilege = yyvsp[-2].privilege;
1204 struct privilege *p = ecalloc(1, sizeof(*p));
1205 list2tq(&p->hostlist, yyvsp[-2].member);
1206 list2tq(&p->cmndlist, yyvsp[0].cmndspec);
1208 /* p->next = NULL; */
1209 yyval.privilege = p;
1215 yyval.member = yyvsp[0].member;
1216 yyval.member->negated = false;
1222 yyval.member = yyvsp[0].member;
1223 yyval.member->negated = true;
1229 yyval.member = new_member(yyvsp[0].string, ALIAS);
1235 yyval.member = new_member(NULL, ALL);
1241 yyval.member = new_member(yyvsp[0].string, NETGROUP);
1247 yyval.member = new_member(yyvsp[0].string, NTWKADDR);
1253 yyval.member = new_member(yyvsp[0].string, WORD);
1259 list_append(yyvsp[-2].cmndspec, yyvsp[0].cmndspec);
1261 /* propagate role and type */
1262 if (yyvsp[0].cmndspec->role == NULL)
1263 yyvsp[0].cmndspec->role = yyvsp[0].cmndspec->prev->role;
1264 if (yyvsp[0].cmndspec->type == NULL)
1265 yyvsp[0].cmndspec->type = yyvsp[0].cmndspec->prev->type;
1266 #endif /* HAVE_SELINUX */
1267 #ifdef HAVE_PRIV_SET
1268 /* propagate privs & limitprivs */
1269 if (yyvsp[0].cmndspec->privs == NULL)
1270 yyvsp[0].cmndspec->privs = yyvsp[0].cmndspec->prev->privs;
1271 if (yyvsp[0].cmndspec->limitprivs == NULL)
1272 yyvsp[0].cmndspec->limitprivs = yyvsp[0].cmndspec->prev->limitprivs;
1273 #endif /* HAVE_PRIV_SET */
1274 /* propagate tags and runas list */
1275 if (yyvsp[0].cmndspec->tags.nopasswd == UNSPEC)
1276 yyvsp[0].cmndspec->tags.nopasswd = yyvsp[0].cmndspec->prev->tags.nopasswd;
1277 if (yyvsp[0].cmndspec->tags.noexec == UNSPEC)
1278 yyvsp[0].cmndspec->tags.noexec = yyvsp[0].cmndspec->prev->tags.noexec;
1279 if (yyvsp[0].cmndspec->tags.setenv == UNSPEC &&
1280 yyvsp[0].cmndspec->prev->tags.setenv != IMPLIED)
1281 yyvsp[0].cmndspec->tags.setenv = yyvsp[0].cmndspec->prev->tags.setenv;
1282 if (yyvsp[0].cmndspec->tags.log_input == UNSPEC)
1283 yyvsp[0].cmndspec->tags.log_input = yyvsp[0].cmndspec->prev->tags.log_input;
1284 if (yyvsp[0].cmndspec->tags.log_output == UNSPEC)
1285 yyvsp[0].cmndspec->tags.log_output = yyvsp[0].cmndspec->prev->tags.log_output;
1286 if ((tq_empty(&yyvsp[0].cmndspec->runasuserlist) &&
1287 tq_empty(&yyvsp[0].cmndspec->runasgrouplist)) &&
1288 (!tq_empty(&yyvsp[0].cmndspec->prev->runasuserlist) ||
1289 !tq_empty(&yyvsp[0].cmndspec->prev->runasgrouplist))) {
1290 yyvsp[0].cmndspec->runasuserlist = yyvsp[0].cmndspec->prev->runasuserlist;
1291 yyvsp[0].cmndspec->runasgrouplist = yyvsp[0].cmndspec->prev->runasgrouplist;
1293 yyval.cmndspec = yyvsp[-2].cmndspec;
1299 struct cmndspec *cs = ecalloc(1, sizeof(*cs));
1300 if (yyvsp[-4].runas != NULL) {
1301 list2tq(&cs->runasuserlist, yyvsp[-4].runas->runasusers);
1302 list2tq(&cs->runasgrouplist, yyvsp[-4].runas->runasgroups);
1303 efree(yyvsp[-4].runas);
1305 tq_init(&cs->runasuserlist);
1306 tq_init(&cs->runasgrouplist);
1309 cs->role = yyvsp[-3].seinfo.role;
1310 cs->type = yyvsp[-3].seinfo.type;
1312 #ifdef HAVE_PRIV_SET
1313 cs->privs = yyvsp[-2].privinfo.privs;
1314 cs->limitprivs = yyvsp[-2].privinfo.limitprivs;
1316 cs->tags = yyvsp[-1].tag;
1317 cs->cmnd = yyvsp[0].member;
1320 /* sudo "ALL" implies the SETENV tag */
1321 if (cs->cmnd->type == ALL && !cs->cmnd->negated &&
1322 cs->tags.setenv == UNSPEC)
1323 cs->tags.setenv = IMPLIED;
1324 yyval.cmndspec = cs;
1330 yyval.member = yyvsp[0].member;
1331 yyval.member->negated = false;
1337 yyval.member = yyvsp[0].member;
1338 yyval.member->negated = true;
1344 yyval.string = yyvsp[0].string;
1350 yyval.string = yyvsp[0].string;
1356 yyval.seinfo.role = NULL;
1357 yyval.seinfo.type = NULL;
1363 yyval.seinfo.role = yyvsp[0].string;
1364 yyval.seinfo.type = NULL;
1370 yyval.seinfo.type = yyvsp[0].string;
1371 yyval.seinfo.role = NULL;
1377 yyval.seinfo.role = yyvsp[-1].string;
1378 yyval.seinfo.type = yyvsp[0].string;
1384 yyval.seinfo.type = yyvsp[-1].string;
1385 yyval.seinfo.role = yyvsp[0].string;
1391 yyval.string = yyvsp[0].string;
1397 yyval.string = yyvsp[0].string;
1403 yyval.privinfo.privs = NULL;
1404 yyval.privinfo.limitprivs = NULL;
1410 yyval.privinfo.privs = yyvsp[0].string;
1411 yyval.privinfo.limitprivs = NULL;
1417 yyval.privinfo.privs = NULL;
1418 yyval.privinfo.limitprivs = yyvsp[0].string;
1424 yyval.privinfo.privs = yyvsp[-1].string;
1425 yyval.privinfo.limitprivs = yyvsp[0].string;
1431 yyval.privinfo.limitprivs = yyvsp[-1].string;
1432 yyval.privinfo.privs = yyvsp[0].string;
1444 yyval.runas = yyvsp[-1].runas;
1450 yyval.runas = ecalloc(1, sizeof(struct runascontainer));
1451 yyval.runas->runasusers = new_member(NULL, MYSELF);
1452 /* $$->runasgroups = NULL; */
1458 yyval.runas = ecalloc(1, sizeof(struct runascontainer));
1459 yyval.runas->runasusers = yyvsp[0].member;
1460 /* $$->runasgroups = NULL; */
1466 yyval.runas = ecalloc(1, sizeof(struct runascontainer));
1467 yyval.runas->runasusers = yyvsp[-2].member;
1468 yyval.runas->runasgroups = yyvsp[0].member;
1474 yyval.runas = ecalloc(1, sizeof(struct runascontainer));
1475 /* $$->runasusers = NULL; */
1476 yyval.runas->runasgroups = yyvsp[0].member;
1482 yyval.runas = ecalloc(1, sizeof(struct runascontainer));
1483 yyval.runas->runasusers = new_member(NULL, MYSELF);
1484 /* $$->runasgroups = NULL; */
1490 yyval.tag.nopasswd = yyval.tag.noexec = yyval.tag.setenv =
1491 yyval.tag.log_input = yyval.tag.log_output = UNSPEC;
1497 yyval.tag.nopasswd = true;
1503 yyval.tag.nopasswd = false;
1509 yyval.tag.noexec = true;
1515 yyval.tag.noexec = false;
1521 yyval.tag.setenv = true;
1527 yyval.tag.setenv = false;
1533 yyval.tag.log_input = true;
1539 yyval.tag.log_input = false;
1545 yyval.tag.log_output = true;
1551 yyval.tag.log_output = false;
1557 yyval.member = new_member(NULL, ALL);
1563 yyval.member = new_member(yyvsp[0].string, ALIAS);
1569 struct sudo_command *c = ecalloc(1, sizeof(*c));
1570 c->cmnd = yyvsp[0].command.cmnd;
1571 c->args = yyvsp[0].command.args;
1572 yyval.member = new_member((char *)c, COMMAND);
1579 if ((s = alias_add(yyvsp[-2].string, HOSTALIAS, yyvsp[0].member)) != NULL) {
1588 list_append(yyvsp[-2].member, yyvsp[0].member);
1589 yyval.member = yyvsp[-2].member;
1596 if ((s = alias_add(yyvsp[-2].string, CMNDALIAS, yyvsp[0].member)) != NULL) {
1605 list_append(yyvsp[-2].member, yyvsp[0].member);
1606 yyval.member = yyvsp[-2].member;
1613 if ((s = alias_add(yyvsp[-2].string, RUNASALIAS, yyvsp[0].member)) != NULL) {
1623 if ((s = alias_add(yyvsp[-2].string, USERALIAS, yyvsp[0].member)) != NULL) {
1632 list_append(yyvsp[-2].member, yyvsp[0].member);
1633 yyval.member = yyvsp[-2].member;
1639 yyval.member = yyvsp[0].member;
1640 yyval.member->negated = false;
1646 yyval.member = yyvsp[0].member;
1647 yyval.member->negated = true;
1653 yyval.member = new_member(yyvsp[0].string, ALIAS);
1659 yyval.member = new_member(NULL, ALL);
1665 yyval.member = new_member(yyvsp[0].string, NETGROUP);
1671 yyval.member = new_member(yyvsp[0].string, USERGROUP);
1677 yyval.member = new_member(yyvsp[0].string, WORD);
1683 list_append(yyvsp[-2].member, yyvsp[0].member);
1684 yyval.member = yyvsp[-2].member;
1690 yyval.member = yyvsp[0].member;
1691 yyval.member->negated = false;
1697 yyval.member = yyvsp[0].member;
1698 yyval.member->negated = true;
1704 yyval.member = new_member(yyvsp[0].string, ALIAS);
1710 yyval.member = new_member(NULL, ALL);
1716 yyval.member = new_member(yyvsp[0].string, WORD);
1725 if (yystate == 0 && yym == 0)
1729 printf("%sdebug: after reduction, shifting from state 0 to\
1730 state %d\n", YYPREFIX, YYFINAL);
1737 if ((yychar = yylex()) < 0) yychar = 0;
1742 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1743 if (!yys) yys = "illegal-symbol";
1744 printf("%sdebug: state %d, reading %d (%s)\n",
1745 YYPREFIX, YYFINAL, yychar, yys);
1749 if (yychar == 0) goto yyaccept;
1752 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1753 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1754 yystate = yytable[yyn];
1756 yystate = yydgoto[yym];
1759 printf("%sdebug: after reduction, shifting from state %d \
1760 to state %d\n", YYPREFIX, *yyssp, yystate);
1762 if (yyssp >= yysslim && yygrowstack())
1770 yyerror("yacc stack overflow");
1776 yyss = yyssp = NULL;
1777 yyvs = yyvsp = NULL;
1785 yyss = yyssp = NULL;
1786 yyvs = yyvsp = NULL;