File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sudo / plugins / sudoers / gram.c
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Oct 9 09:29:52 2012 UTC (11 years, 8 months ago) by misho
Branches: sudo, MAIN
CVS tags: HEAD
sudo

    1: #include <config.h>
    2: #include <stdlib.h>
    3: #include <string.h>
    4: #define YYBYACC 1
    5: #define YYMAJOR 1
    6: #define YYMINOR 9
    7: #define YYLEX yylex()
    8: #define YYEMPTY -1
    9: #define yyclearin (yychar=(YYEMPTY))
   10: #define yyerrok (yyerrflag=0)
   11: #define YYRECOVERING() (yyerrflag!=0)
   12: #define YYPREFIX "yy"
   13: #line 2 "gram.y"
   14: /*
   15:  * Copyright (c) 1996, 1998-2005, 2007-2012
   16:  *	Todd C. Miller <Todd.Miller@courtesan.com>
   17:  *
   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.
   21:  *
   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.
   31:  *
   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.
   35:  */
   36: 
   37: #include <config.h>
   38: 
   39: #include <sys/types.h>
   40: #include <sys/param.h>
   41: #include <stdio.h>
   42: #ifdef STDC_HEADERS
   43: # include <stdlib.h>
   44: # include <stddef.h>
   45: #else
   46: # ifdef HAVE_STDLIB_H
   47: #  include <stdlib.h>
   48: # endif
   49: #endif /* STDC_HEADERS */
   50: #ifdef HAVE_STRING_H
   51: # include <string.h>
   52: #endif /* HAVE_STRING_H */
   53: #ifdef HAVE_STRINGS_H
   54: # include <strings.h>
   55: #endif /* HAVE_STRINGS_H */
   56: #ifdef HAVE_UNISTD_H
   57: # include <unistd.h>
   58: #endif /* HAVE_UNISTD_H */
   59: #ifdef HAVE_INTTYPES_H
   60: # include <inttypes.h>
   61: #endif
   62: #if defined(YYBISON) && defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
   63: # include <alloca.h>
   64: #endif /* YYBISON && HAVE_ALLOCA_H && !__GNUC__ */
   65: #include <limits.h>
   66: 
   67: #include "sudoers.h" /* XXX */
   68: #include "parse.h"
   69: #include "toke.h"
   70: #include "gram.h"
   71: 
   72: /*
   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).
   76:  */
   77: #ifndef SIZE_MAX
   78: # ifdef SIZE_T_MAX
   79: #  define SIZE_MAX	SIZE_T_MAX
   80: # else
   81: #  define SIZE_MAX	INT_MAX
   82: # endif /* SIZE_T_MAX */
   83: #endif /* SIZE_MAX */
   84: 
   85: /*
   86:  * Globals
   87:  */
   88: extern int sudolineno;
   89: extern int last_token;
   90: extern char *sudoers;
   91: bool sudoers_warnings = true;
   92: bool parse_error = false;
   93: int errorlineno = -1;
   94: char *errorfile = NULL;
   95: 
   96: struct defaults_list defaults;
   97: struct userspec_list userspecs;
   98: 
   99: /*
  100:  * Local protoypes
  101:  */
  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 *);
  107: 
  108: void
  109: yyerror(const char *s)
  110: {
  111:     debug_decl(yyerror, SUDO_DEBUG_PARSER)
  112: 
  113:     /* If we last saw a newline the error is on the preceding line. */
  114:     if (last_token == COMMENT)
  115: 	sudolineno--;
  116: 
  117:     /* Save the line the first error occurred on. */
  118:     if (errorlineno == -1) {
  119: 	errorlineno = sudolineno;
  120: 	errorfile = estrdup(sudoers);
  121:     }
  122:     if (sudoers_warnings && s != NULL) {
  123: 	LEXTRACE("<*> ");
  124: #ifndef TRACELEXER
  125: 	if (trace_print == NULL || trace_print == sudoers_trace_print)
  126: 	    warningx(_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno);
  127: #endif
  128:     }
  129:     parse_error = true;
  130:     debug_return;
  131: }
  132: #line 122 "gram.y"
  133: #ifndef YYSTYPE_DEFINED
  134: #define YYSTYPE_DEFINED
  135: typedef union {
  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;
  142:     struct cmndtag tag;
  143:     struct selinux_info seinfo;
  144:     struct solaris_privs_info privinfo;
  145:     char *string;
  146:     int tok;
  147: } YYSTYPE;
  148: #endif /* YYSTYPE_DEFINED */
  149: #line 149 "gram.c"
  150: #define COMMAND 257
  151: #define ALIAS 258
  152: #define DEFVAR 259
  153: #define NTWKADDR 260
  154: #define NETGROUP 261
  155: #define USERGROUP 262
  156: #define WORD 263
  157: #define DEFAULTS 264
  158: #define DEFAULTS_HOST 265
  159: #define DEFAULTS_USER 266
  160: #define DEFAULTS_RUNAS 267
  161: #define DEFAULTS_CMND 268
  162: #define NOPASSWD 269
  163: #define PASSWD 270
  164: #define NOEXEC 271
  165: #define EXEC 272
  166: #define SETENV 273
  167: #define NOSETENV 274
  168: #define LOG_INPUT 275
  169: #define NOLOG_INPUT 276
  170: #define LOG_OUTPUT 277
  171: #define NOLOG_OUTPUT 278
  172: #define ALL 279
  173: #define COMMENT 280
  174: #define HOSTALIAS 281
  175: #define CMNDALIAS 282
  176: #define USERALIAS 283
  177: #define RUNASALIAS 284
  178: #define ERROR 285
  179: #define TYPE 286
  180: #define ROLE 287
  181: #define PRIVS 288
  182: #define LIMITPRIVS 289
  183: #define MYSELF 290
  184: #define YYERRCODE 256
  185: #if defined(__cplusplus) || defined(__STDC__)
  186: const short yylhs[] =
  187: #else
  188: short yylhs[] =
  189: #endif
  190: 	{                                        -1,
  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,
  201:    14,   14,   15,   15,   15,
  202: };
  203: #if defined(__cplusplus) || defined(__STDC__)
  204: const short yylen[] =
  205: #else
  206: short yylen[] =
  207: #endif
  208: 	{                                         2,
  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,
  219:     1,    2,    1,    1,    1,
  220: };
  221: #if defined(__cplusplus) || defined(__STDC__)
  222: const short yydefred[] =
  223: #else
  224: short yydefred[] =
  225: #endif
  226: 	{                                      0,
  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,
  243: };
  244: #if defined(__cplusplus) || defined(__STDC__)
  245: const short yydgoto[] =
  246: #else
  247: short yydgoto[] =
  248: #endif
  249: 	{                                      18,
  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,
  254: };
  255: #if defined(__cplusplus) || defined(__STDC__)
  256: const short yysindex[] =
  257: #else
  258: short yysindex[] =
  259: #endif
  260: 	{                                    541,
  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[] =
  279: #else
  280: short yyrindex[] =
  281: #endif
  282: 	{                                     96,
  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[] =
  301: #else
  302: short yygindex[] =
  303: #endif
  304: 	{                                      0,
  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,
  309: };
  310: #define YYTABLESIZE 932
  311: #if defined(__cplusplus) || defined(__STDC__)
  312: const short yytable[] =
  313: #else
  314: short yytable[] =
  315: #endif
  316: 	{                                      26,
  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,
  410:    50,   50,
  411: };
  412: #if defined(__cplusplus) || defined(__STDC__)
  413: const short yycheck[] =
  414: #else
  415: short yycheck[] =
  416: #endif
  417: 	{                                      33,
  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,
  511:   278,  279,
  512: };
  513: #define YYFINAL 18
  514: #ifndef YYDEBUG
  515: #define YYDEBUG 0
  516: #endif
  517: #define YYMAXTOKEN 290
  518: #if YYDEBUG
  519: #if defined(__cplusplus) || defined(__STDC__)
  520: const char * const yyname[] =
  521: #else
  522: char *yyname[] =
  523: #endif
  524: 	{
  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",
  537: };
  538: #if defined(__cplusplus) || defined(__STDC__)
  539: const char * const yyrule[] =
  540: #else
  541: char *yyrule[] =
  542: #endif
  543: 	{"$accept : file",
  544: "file :",
  545: "file : line",
  546: "line : entry",
  547: "line : line entry",
  548: "entry : COMMENT",
  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",
  570: "ophost : host",
  571: "ophost : '!' host",
  572: "host : ALIAS",
  573: "host : ALL",
  574: "host : NETGROUP",
  575: "host : NTWKADDR",
  576: "host : WORD",
  577: "cmndspeclist : cmndspec",
  578: "cmndspeclist : cmndspeclist ',' cmndspec",
  579: "cmndspec : runasspec selinux solarisprivs cmndtag opcmnd",
  580: "opcmnd : cmnd",
  581: "opcmnd : '!' cmnd",
  582: "rolespec : ROLE '=' WORD",
  583: "typespec : TYPE '=' WORD",
  584: "selinux :",
  585: "selinux : rolespec",
  586: "selinux : typespec",
  587: "selinux : rolespec typespec",
  588: "selinux : typespec rolespec",
  589: "privsspec : PRIVS '=' WORD",
  590: "limitprivsspec : LIMITPRIVS '=' WORD",
  591: "solarisprivs :",
  592: "solarisprivs : privsspec",
  593: "solarisprivs : limitprivsspec",
  594: "solarisprivs : privsspec limitprivsspec",
  595: "solarisprivs : limitprivsspec privsspec",
  596: "runasspec :",
  597: "runasspec : '(' runaslist ')'",
  598: "runaslist :",
  599: "runaslist : userlist",
  600: "runaslist : userlist ':' grouplist",
  601: "runaslist : ':' grouplist",
  602: "runaslist : ':'",
  603: "cmndtag :",
  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",
  614: "cmnd : ALL",
  615: "cmnd : ALIAS",
  616: "cmnd : COMMAND",
  617: "hostaliases : hostalias",
  618: "hostaliases : hostaliases ':' hostalias",
  619: "hostalias : ALIAS '=' hostlist",
  620: "hostlist : ophost",
  621: "hostlist : hostlist ',' ophost",
  622: "cmndaliases : cmndalias",
  623: "cmndaliases : cmndaliases ':' cmndalias",
  624: "cmndalias : ALIAS '=' cmndlist",
  625: "cmndlist : opcmnd",
  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",
  633: "userlist : opuser",
  634: "userlist : userlist ',' opuser",
  635: "opuser : user",
  636: "opuser : '!' user",
  637: "user : ALIAS",
  638: "user : ALL",
  639: "user : NETGROUP",
  640: "user : USERGROUP",
  641: "user : WORD",
  642: "grouplist : opgroup",
  643: "grouplist : grouplist ',' opgroup",
  644: "opgroup : group",
  645: "opgroup : '!' group",
  646: "group : ALIAS",
  647: "group : ALL",
  648: "group : WORD",
  649: };
  650: #endif
  651: #ifdef YYSTACKSIZE
  652: #undef YYMAXDEPTH
  653: #define YYMAXDEPTH YYSTACKSIZE
  654: #else
  655: #ifdef YYMAXDEPTH
  656: #define YYSTACKSIZE YYMAXDEPTH
  657: #else
  658: #define YYSTACKSIZE 10000
  659: #define YYMAXDEPTH 10000
  660: #endif
  661: #endif
  662: #define YYINITSTACKSIZE 200
  663: /* LINTUSED */
  664: int yydebug;
  665: int yynerrs;
  666: int yyerrflag;
  667: int yychar;
  668: short *yyssp;
  669: YYSTYPE *yyvsp;
  670: YYSTYPE yyval;
  671: YYSTYPE yylval;
  672: short *yyss;
  673: short *yysslim;
  674: YYSTYPE *yyvs;
  675: int yystacksize;
  676: #line 674 "gram.y"
  677: static struct defaults *
  678: new_default(char *var, char *val, int op)
  679: {
  680:     struct defaults *d;
  681:     debug_decl(new_default, SUDO_DEBUG_PARSER)
  682: 
  683:     d = ecalloc(1, sizeof(struct defaults));
  684:     d->var = var;
  685:     d->val = val;
  686:     tq_init(&d->binding);
  687:     /* d->type = 0; */
  688:     d->op = op;
  689:     d->prev = d;
  690:     /* d->next = NULL; */
  691: 
  692:     debug_return_ptr(d);
  693: }
  694: 
  695: static struct member *
  696: new_member(char *name, int type)
  697: {
  698:     struct member *m;
  699:     debug_decl(new_member, SUDO_DEBUG_PARSER)
  700: 
  701:     m = ecalloc(1, sizeof(struct member));
  702:     m->name = name;
  703:     m->type = type;
  704:     m->prev = m;
  705:     /* m->next = NULL; */
  706: 
  707:     debug_return_ptr(m);
  708: }
  709: 
  710: /*
  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).
  714:  */
  715: static void
  716: add_defaults(int type, struct member *bmem, struct defaults *defs)
  717: {
  718:     struct defaults *d;
  719:     struct member_list binding;
  720:     debug_decl(add_defaults, SUDO_DEBUG_PARSER)
  721: 
  722:     /*
  723:      * We can only call list2tq once on bmem as it will zero
  724:      * out the prev pointer when it consumes bmem.
  725:      */
  726:     list2tq(&binding, bmem);
  727: 
  728:     /*
  729:      * Set type and binding (who it applies to) for new entries.
  730:      */
  731:     for (d = defs; d != NULL; d = d->next) {
  732: 	d->type = type;
  733: 	d->binding = binding;
  734:     }
  735:     tq_append(&defaults, defs);
  736: 
  737:     debug_return;
  738: }
  739: 
  740: /*
  741:  * Allocate a new struct userspec, populate it, and insert it at the
  742:  * and of the userspecs list.
  743:  */
  744: static void
  745: add_userspec(struct member *members, struct privilege *privs)
  746: {
  747:     struct userspec *u;
  748:     debug_decl(add_userspec, SUDO_DEBUG_PARSER)
  749: 
  750:     u = ecalloc(1, sizeof(*u));
  751:     list2tq(&u->users, members);
  752:     list2tq(&u->privileges, privs);
  753:     u->prev = u;
  754:     /* u->next = NULL; */
  755:     tq_append(&userspecs, u);
  756: 
  757:     debug_return;
  758: }
  759: 
  760: /*
  761:  * Free up space used by data structures from a previous parser run and sets
  762:  * the current sudoers file to path.
  763:  */
  764: void
  765: init_parser(const char *path, bool quiet)
  766: {
  767:     struct defaults *d;
  768:     struct member *m, *binding;
  769:     struct userspec *us;
  770:     struct privilege *priv;
  771:     struct cmndspec *cs;
  772:     struct sudo_command *c;
  773:     debug_decl(init_parser, SUDO_DEBUG_PARSER)
  774: 
  775:     while ((us = tq_pop(&userspecs)) != NULL) {
  776: 	while ((m = tq_pop(&us->users)) != NULL) {
  777: 	    efree(m->name);
  778: 	    efree(m);
  779: 	}
  780: 	while ((priv = tq_pop(&us->privileges)) != NULL) {
  781: 	    struct member *runasuser = NULL, *runasgroup = NULL;
  782: #ifdef HAVE_SELINUX
  783: 	    char *role = NULL, *type = NULL;
  784: #endif /* HAVE_SELINUX */
  785: #ifdef HAVE_PRIV_SET
  786: 	    char *privs = NULL, *limitprivs = NULL;
  787: #endif /* HAVE_PRIV_SET */
  788: 
  789: 	    while ((m = tq_pop(&priv->hostlist)) != NULL) {
  790: 		efree(m->name);
  791: 		efree(m);
  792: 	    }
  793: 	    while ((cs = tq_pop(&priv->cmndlist)) != NULL) {
  794: #ifdef HAVE_SELINUX
  795: 		/* Only free the first instance of a role/type. */
  796: 		if (cs->role != role) {
  797: 		    role = cs->role;
  798: 		    efree(cs->role);
  799: 		}
  800: 		if (cs->type != type) {
  801: 		    type = cs->type;
  802: 		    efree(cs->type);
  803: 		}
  804: #endif /* HAVE_SELINUX */
  805: #ifdef HAVE_PRIV_SET
  806: 		/* Only free the first instance of privs/limitprivs. */
  807: 		if (cs->privs != privs) {
  808: 		    privs = cs->privs;
  809: 		    efree(cs->privs);
  810: 		}
  811: 		if (cs->limitprivs != limitprivs) {
  812: 		    limitprivs = cs->limitprivs;
  813: 		    efree(cs->limitprivs);
  814: 		}
  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) {
  819: 			efree(m->name);
  820: 			efree(m);
  821: 		    }
  822: 		}
  823: 		if (tq_last(&cs->runasgrouplist) != runasgroup) {
  824: 		    runasgroup = tq_last(&cs->runasgrouplist);
  825: 		    while ((m = tq_pop(&cs->runasgrouplist)) != NULL) {
  826: 			efree(m->name);
  827: 			efree(m);
  828: 		    }
  829: 		}
  830: 		if (cs->cmnd->type == COMMAND) {
  831: 			c = (struct sudo_command *) cs->cmnd->name;
  832: 			efree(c->cmnd);
  833: 			efree(c->args);
  834: 		}
  835: 		efree(cs->cmnd->name);
  836: 		efree(cs->cmnd);
  837: 		efree(cs);
  838: 	    }
  839: 	    efree(priv);
  840: 	}
  841: 	efree(us);
  842:     }
  843:     tq_init(&userspecs);
  844: 
  845:     binding = NULL;
  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;
  852: 			efree(c->cmnd);
  853: 			efree(c->args);
  854: 		}
  855: 		efree(m->name);
  856: 		efree(m);
  857: 	    }
  858: 	}
  859: 	efree(d->var);
  860: 	efree(d->val);
  861: 	efree(d);
  862:     }
  863:     tq_init(&defaults);
  864: 
  865:     init_aliases();
  866: 
  867:     init_lexer();
  868: 
  869:     efree(sudoers);
  870:     sudoers = path ? estrdup(path) : NULL;
  871: 
  872:     parse_error = false;
  873:     errorlineno = -1;
  874:     errorfile = sudoers;
  875:     sudoers_warnings = !quiet;
  876: 
  877:     debug_return;
  878: }
  879: #line 827 "gram.c"
  880: /* allocate initial stack or double stack size, up to YYMAXDEPTH */
  881: #if defined(__cplusplus) || defined(__STDC__)
  882: static int yygrowstack(void)
  883: #else
  884: static int yygrowstack()
  885: #endif
  886: {
  887:     int newsize, i;
  888:     short *newss;
  889:     YYSTYPE *newvs;
  890: 
  891:     newsize = yystacksize ? yystacksize : YYINITSTACKSIZE;
  892:     if (newsize >= YYMAXDEPTH)
  893:         return -1;
  894:     else if ((newsize *= 2) > YYMAXDEPTH)
  895:         newsize = YYMAXDEPTH;
  896: #ifdef SIZE_MAX
  897: #define YY_SIZE_MAX SIZE_MAX
  898: #else
  899: #define YY_SIZE_MAX 0x7fffffff
  900: #endif
  901:     if (YY_SIZE_MAX / newsize < sizeof *newss)
  902:         goto bail;
  903:     i = yyssp - yyss;
  904:     newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
  905:       (short *)malloc(newsize * sizeof *newss); /* overflow check above */
  906:     if (newss == NULL)
  907:         goto bail;
  908:     yyss = newss;
  909:     yyssp = newss + i;
  910:     newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
  911:       (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
  912:     if (newvs == NULL)
  913:         goto bail;
  914:     yyvs = newvs;
  915:     yyvsp = newvs + i;
  916:     yystacksize = newsize;
  917:     yysslim = yyss + newsize - 1;
  918:     return 0;
  919: bail:
  920:     if (yyss)
  921:             free(yyss);
  922:     if (yyvs)
  923:             free(yyvs);
  924:     yyss = yyssp = NULL;
  925:     yyvs = yyvsp = NULL;
  926:     yystacksize = 0;
  927:     return -1;
  928: }
  929: 
  930: #define YYABORT goto yyabort
  931: #define YYREJECT goto yyabort
  932: #define YYACCEPT goto yyaccept
  933: #define YYERROR goto yyerrlab
  934: int
  935: #if defined(__cplusplus) || defined(__STDC__)
  936: yyparse(void)
  937: #else
  938: yyparse()
  939: #endif
  940: {
  941:     int yym, yyn, yystate;
  942: #if YYDEBUG
  943: #if defined(__cplusplus) || defined(__STDC__)
  944:     const char *yys;
  945: #else /* !(defined(__cplusplus) || defined(__STDC__)) */
  946:     char *yys;
  947: #endif /* !(defined(__cplusplus) || defined(__STDC__)) */
  948: 
  949:     if ((yys = getenv("YYDEBUG")))
  950:     {
  951:         yyn = *yys;
  952:         if (yyn >= '0' && yyn <= '9')
  953:             yydebug = yyn - '0';
  954:     }
  955: #endif /* YYDEBUG */
  956: 
  957:     yynerrs = 0;
  958:     yyerrflag = 0;
  959:     yychar = (-1);
  960: 
  961:     if (yyss == NULL && yygrowstack()) goto yyoverflow;
  962:     yyssp = yyss;
  963:     yyvsp = yyvs;
  964:     *yyssp = yystate = 0;
  965: 
  966: yyloop:
  967:     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
  968:     if (yychar < 0)
  969:     {
  970:         if ((yychar = yylex()) < 0) yychar = 0;
  971: #if YYDEBUG
  972:         if (yydebug)
  973:         {
  974:             yys = 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);
  979:         }
  980: #endif
  981:     }
  982:     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
  983:             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
  984:     {
  985: #if YYDEBUG
  986:         if (yydebug)
  987:             printf("%sdebug: state %d, shifting to state %d\n",
  988:                     YYPREFIX, yystate, yytable[yyn]);
  989: #endif
  990:         if (yyssp >= yysslim && yygrowstack())
  991:         {
  992:             goto yyoverflow;
  993:         }
  994:         *++yyssp = yystate = yytable[yyn];
  995:         *++yyvsp = yylval;
  996:         yychar = (-1);
  997:         if (yyerrflag > 0)  --yyerrflag;
  998:         goto yyloop;
  999:     }
 1000:     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
 1001:             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
 1002:     {
 1003:         yyn = yytable[yyn];
 1004:         goto yyreduce;
 1005:     }
 1006:     if (yyerrflag) goto yyinrecovery;
 1007: #if defined(lint) || defined(__GNUC__)
 1008:     goto yynewerror;
 1009: #endif
 1010: yynewerror:
 1011:     yyerror("syntax error");
 1012: #if defined(lint) || defined(__GNUC__)
 1013:     goto yyerrlab;
 1014: #endif
 1015: yyerrlab:
 1016:     ++yynerrs;
 1017: yyinrecovery:
 1018:     if (yyerrflag < 3)
 1019:     {
 1020:         yyerrflag = 3;
 1021:         for (;;)
 1022:         {
 1023:             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
 1024:                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
 1025:             {
 1026: #if YYDEBUG
 1027:                 if (yydebug)
 1028:                     printf("%sdebug: state %d, error recovery shifting\
 1029:  to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
 1030: #endif
 1031:                 if (yyssp >= yysslim && yygrowstack())
 1032:                 {
 1033:                     goto yyoverflow;
 1034:                 }
 1035:                 *++yyssp = yystate = yytable[yyn];
 1036:                 *++yyvsp = yylval;
 1037:                 goto yyloop;
 1038:             }
 1039:             else
 1040:             {
 1041: #if YYDEBUG
 1042:                 if (yydebug)
 1043:                     printf("%sdebug: error recovery discarding state %d\n",
 1044:                             YYPREFIX, *yyssp);
 1045: #endif
 1046:                 if (yyssp <= yyss) goto yyabort;
 1047:                 --yyssp;
 1048:                 --yyvsp;
 1049:             }
 1050:         }
 1051:     }
 1052:     else
 1053:     {
 1054:         if (yychar == 0) goto yyabort;
 1055: #if YYDEBUG
 1056:         if (yydebug)
 1057:         {
 1058:             yys = 0;
 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);
 1063:         }
 1064: #endif
 1065:         yychar = (-1);
 1066:         goto yyloop;
 1067:     }
 1068: yyreduce:
 1069: #if YYDEBUG
 1070:     if (yydebug)
 1071:         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
 1072:                 YYPREFIX, yystate, yyn, yyrule[yyn]);
 1073: #endif
 1074:     yym = yylen[yyn];
 1075:     if (yym)
 1076:         yyval = yyvsp[1-yym];
 1077:     else
 1078:         memset(&yyval, 0, sizeof yyval);
 1079:     switch (yyn)
 1080:     {
 1081: case 1:
 1082: #line 204 "gram.y"
 1083: { ; }
 1084: break;
 1085: case 5:
 1086: #line 212 "gram.y"
 1087: {
 1088: 			    ;
 1089: 			}
 1090: break;
 1091: case 6:
 1092: #line 215 "gram.y"
 1093: {
 1094: 			    yyerrok;
 1095: 			}
 1096: break;
 1097: case 7:
 1098: #line 218 "gram.y"
 1099: {
 1100: 			    add_userspec(yyvsp[-1].member, yyvsp[0].privilege);
 1101: 			}
 1102: break;
 1103: case 8:
 1104: #line 221 "gram.y"
 1105: {
 1106: 			    ;
 1107: 			}
 1108: break;
 1109: case 9:
 1110: #line 224 "gram.y"
 1111: {
 1112: 			    ;
 1113: 			}
 1114: break;
 1115: case 10:
 1116: #line 227 "gram.y"
 1117: {
 1118: 			    ;
 1119: 			}
 1120: break;
 1121: case 11:
 1122: #line 230 "gram.y"
 1123: {
 1124: 			    ;
 1125: 			}
 1126: break;
 1127: case 12:
 1128: #line 233 "gram.y"
 1129: {
 1130: 			    add_defaults(DEFAULTS, NULL, yyvsp[0].defaults);
 1131: 			}
 1132: break;
 1133: case 13:
 1134: #line 236 "gram.y"
 1135: {
 1136: 			    add_defaults(DEFAULTS_USER, yyvsp[-1].member, yyvsp[0].defaults);
 1137: 			}
 1138: break;
 1139: case 14:
 1140: #line 239 "gram.y"
 1141: {
 1142: 			    add_defaults(DEFAULTS_RUNAS, yyvsp[-1].member, yyvsp[0].defaults);
 1143: 			}
 1144: break;
 1145: case 15:
 1146: #line 242 "gram.y"
 1147: {
 1148: 			    add_defaults(DEFAULTS_HOST, yyvsp[-1].member, yyvsp[0].defaults);
 1149: 			}
 1150: break;
 1151: case 16:
 1152: #line 245 "gram.y"
 1153: {
 1154: 			    add_defaults(DEFAULTS_CMND, yyvsp[-1].member, yyvsp[0].defaults);
 1155: 			}
 1156: break;
 1157: case 18:
 1158: #line 251 "gram.y"
 1159: {
 1160: 			    list_append(yyvsp[-2].defaults, yyvsp[0].defaults);
 1161: 			    yyval.defaults = yyvsp[-2].defaults;
 1162: 			}
 1163: break;
 1164: case 19:
 1165: #line 257 "gram.y"
 1166: {
 1167: 			    yyval.defaults = new_default(yyvsp[0].string, NULL, true);
 1168: 			}
 1169: break;
 1170: case 20:
 1171: #line 260 "gram.y"
 1172: {
 1173: 			    yyval.defaults = new_default(yyvsp[0].string, NULL, false);
 1174: 			}
 1175: break;
 1176: case 21:
 1177: #line 263 "gram.y"
 1178: {
 1179: 			    yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, true);
 1180: 			}
 1181: break;
 1182: case 22:
 1183: #line 266 "gram.y"
 1184: {
 1185: 			    yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '+');
 1186: 			}
 1187: break;
 1188: case 23:
 1189: #line 269 "gram.y"
 1190: {
 1191: 			    yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '-');
 1192: 			}
 1193: break;
 1194: case 25:
 1195: #line 275 "gram.y"
 1196: {
 1197: 			    list_append(yyvsp[-2].privilege, yyvsp[0].privilege);
 1198: 			    yyval.privilege = yyvsp[-2].privilege;
 1199: 			}
 1200: break;
 1201: case 26:
 1202: #line 281 "gram.y"
 1203: {
 1204: 			    struct privilege *p = ecalloc(1, sizeof(*p));
 1205: 			    list2tq(&p->hostlist, yyvsp[-2].member);
 1206: 			    list2tq(&p->cmndlist, yyvsp[0].cmndspec);
 1207: 			    p->prev = p;
 1208: 			    /* p->next = NULL; */
 1209: 			    yyval.privilege = p;
 1210: 			}
 1211: break;
 1212: case 27:
 1213: #line 291 "gram.y"
 1214: {
 1215: 			    yyval.member = yyvsp[0].member;
 1216: 			    yyval.member->negated = false;
 1217: 			}
 1218: break;
 1219: case 28:
 1220: #line 295 "gram.y"
 1221: {
 1222: 			    yyval.member = yyvsp[0].member;
 1223: 			    yyval.member->negated = true;
 1224: 			}
 1225: break;
 1226: case 29:
 1227: #line 301 "gram.y"
 1228: {
 1229: 			    yyval.member = new_member(yyvsp[0].string, ALIAS);
 1230: 			}
 1231: break;
 1232: case 30:
 1233: #line 304 "gram.y"
 1234: {
 1235: 			    yyval.member = new_member(NULL, ALL);
 1236: 			}
 1237: break;
 1238: case 31:
 1239: #line 307 "gram.y"
 1240: {
 1241: 			    yyval.member = new_member(yyvsp[0].string, NETGROUP);
 1242: 			}
 1243: break;
 1244: case 32:
 1245: #line 310 "gram.y"
 1246: {
 1247: 			    yyval.member = new_member(yyvsp[0].string, NTWKADDR);
 1248: 			}
 1249: break;
 1250: case 33:
 1251: #line 313 "gram.y"
 1252: {
 1253: 			    yyval.member = new_member(yyvsp[0].string, WORD);
 1254: 			}
 1255: break;
 1256: case 35:
 1257: #line 319 "gram.y"
 1258: {
 1259: 			    list_append(yyvsp[-2].cmndspec, yyvsp[0].cmndspec);
 1260: #ifdef HAVE_SELINUX
 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;
 1292: 			    }
 1293: 			    yyval.cmndspec = yyvsp[-2].cmndspec;
 1294: 			}
 1295: break;
 1296: case 36:
 1297: #line 358 "gram.y"
 1298: {
 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);
 1304: 			    } else {
 1305: 				tq_init(&cs->runasuserlist);
 1306: 				tq_init(&cs->runasgrouplist);
 1307: 			    }
 1308: #ifdef HAVE_SELINUX
 1309: 			    cs->role = yyvsp[-3].seinfo.role;
 1310: 			    cs->type = yyvsp[-3].seinfo.type;
 1311: #endif
 1312: #ifdef HAVE_PRIV_SET
 1313: 			    cs->privs = yyvsp[-2].privinfo.privs;
 1314: 			    cs->limitprivs = yyvsp[-2].privinfo.limitprivs;
 1315: #endif
 1316: 			    cs->tags = yyvsp[-1].tag;
 1317: 			    cs->cmnd = yyvsp[0].member;
 1318: 			    cs->prev = cs;
 1319: 			    cs->next = NULL;
 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;
 1325: 			}
 1326: break;
 1327: case 37:
 1328: #line 388 "gram.y"
 1329: {
 1330: 			    yyval.member = yyvsp[0].member;
 1331: 			    yyval.member->negated = false;
 1332: 			}
 1333: break;
 1334: case 38:
 1335: #line 392 "gram.y"
 1336: {
 1337: 			    yyval.member = yyvsp[0].member;
 1338: 			    yyval.member->negated = true;
 1339: 			}
 1340: break;
 1341: case 39:
 1342: #line 398 "gram.y"
 1343: {
 1344: 			    yyval.string = yyvsp[0].string;
 1345: 			}
 1346: break;
 1347: case 40:
 1348: #line 403 "gram.y"
 1349: {
 1350: 			    yyval.string = yyvsp[0].string;
 1351: 			}
 1352: break;
 1353: case 41:
 1354: #line 408 "gram.y"
 1355: {
 1356: 			    yyval.seinfo.role = NULL;
 1357: 			    yyval.seinfo.type = NULL;
 1358: 			}
 1359: break;
 1360: case 42:
 1361: #line 412 "gram.y"
 1362: {
 1363: 			    yyval.seinfo.role = yyvsp[0].string;
 1364: 			    yyval.seinfo.type = NULL;
 1365: 			}
 1366: break;
 1367: case 43:
 1368: #line 416 "gram.y"
 1369: {
 1370: 			    yyval.seinfo.type = yyvsp[0].string;
 1371: 			    yyval.seinfo.role = NULL;
 1372: 			}
 1373: break;
 1374: case 44:
 1375: #line 420 "gram.y"
 1376: {
 1377: 			    yyval.seinfo.role = yyvsp[-1].string;
 1378: 			    yyval.seinfo.type = yyvsp[0].string;
 1379: 			}
 1380: break;
 1381: case 45:
 1382: #line 424 "gram.y"
 1383: {
 1384: 			    yyval.seinfo.type = yyvsp[-1].string;
 1385: 			    yyval.seinfo.role = yyvsp[0].string;
 1386: 			}
 1387: break;
 1388: case 46:
 1389: #line 430 "gram.y"
 1390: {
 1391: 			    yyval.string = yyvsp[0].string;
 1392: 			}
 1393: break;
 1394: case 47:
 1395: #line 434 "gram.y"
 1396: {
 1397: 			    yyval.string = yyvsp[0].string;
 1398: 			}
 1399: break;
 1400: case 48:
 1401: #line 439 "gram.y"
 1402: {
 1403: 			    yyval.privinfo.privs = NULL;
 1404: 			    yyval.privinfo.limitprivs = NULL;
 1405: 			}
 1406: break;
 1407: case 49:
 1408: #line 443 "gram.y"
 1409: {
 1410: 			    yyval.privinfo.privs = yyvsp[0].string;
 1411: 			    yyval.privinfo.limitprivs = NULL;
 1412: 			}
 1413: break;
 1414: case 50:
 1415: #line 447 "gram.y"
 1416: {
 1417: 			    yyval.privinfo.privs = NULL;
 1418: 			    yyval.privinfo.limitprivs = yyvsp[0].string;
 1419: 			}
 1420: break;
 1421: case 51:
 1422: #line 451 "gram.y"
 1423: {
 1424: 			    yyval.privinfo.privs = yyvsp[-1].string;
 1425: 			    yyval.privinfo.limitprivs = yyvsp[0].string;
 1426: 			}
 1427: break;
 1428: case 52:
 1429: #line 455 "gram.y"
 1430: {
 1431: 			    yyval.privinfo.limitprivs = yyvsp[-1].string;
 1432: 			    yyval.privinfo.privs = yyvsp[0].string;
 1433: 			}
 1434: break;
 1435: case 53:
 1436: #line 460 "gram.y"
 1437: {
 1438: 			    yyval.runas = NULL;
 1439: 			}
 1440: break;
 1441: case 54:
 1442: #line 463 "gram.y"
 1443: {
 1444: 			    yyval.runas = yyvsp[-1].runas;
 1445: 			}
 1446: break;
 1447: case 55:
 1448: #line 468 "gram.y"
 1449: {
 1450: 			    yyval.runas = ecalloc(1, sizeof(struct runascontainer));
 1451: 			    yyval.runas->runasusers = new_member(NULL, MYSELF);
 1452: 			    /* $$->runasgroups = NULL; */
 1453: 			}
 1454: break;
 1455: case 56:
 1456: #line 473 "gram.y"
 1457: {
 1458: 			    yyval.runas = ecalloc(1, sizeof(struct runascontainer));
 1459: 			    yyval.runas->runasusers = yyvsp[0].member;
 1460: 			    /* $$->runasgroups = NULL; */
 1461: 			}
 1462: break;
 1463: case 57:
 1464: #line 478 "gram.y"
 1465: {
 1466: 			    yyval.runas = ecalloc(1, sizeof(struct runascontainer));
 1467: 			    yyval.runas->runasusers = yyvsp[-2].member;
 1468: 			    yyval.runas->runasgroups = yyvsp[0].member;
 1469: 			}
 1470: break;
 1471: case 58:
 1472: #line 483 "gram.y"
 1473: {
 1474: 			    yyval.runas = ecalloc(1, sizeof(struct runascontainer));
 1475: 			    /* $$->runasusers = NULL; */
 1476: 			    yyval.runas->runasgroups = yyvsp[0].member;
 1477: 			}
 1478: break;
 1479: case 59:
 1480: #line 488 "gram.y"
 1481: {
 1482: 			    yyval.runas = ecalloc(1, sizeof(struct runascontainer));
 1483: 			    yyval.runas->runasusers = new_member(NULL, MYSELF);
 1484: 			    /* $$->runasgroups = NULL; */
 1485: 			}
 1486: break;
 1487: case 60:
 1488: #line 495 "gram.y"
 1489: {
 1490: 			    yyval.tag.nopasswd = yyval.tag.noexec = yyval.tag.setenv =
 1491: 				yyval.tag.log_input = yyval.tag.log_output = UNSPEC;
 1492: 			}
 1493: break;
 1494: case 61:
 1495: #line 499 "gram.y"
 1496: {
 1497: 			    yyval.tag.nopasswd = true;
 1498: 			}
 1499: break;
 1500: case 62:
 1501: #line 502 "gram.y"
 1502: {
 1503: 			    yyval.tag.nopasswd = false;
 1504: 			}
 1505: break;
 1506: case 63:
 1507: #line 505 "gram.y"
 1508: {
 1509: 			    yyval.tag.noexec = true;
 1510: 			}
 1511: break;
 1512: case 64:
 1513: #line 508 "gram.y"
 1514: {
 1515: 			    yyval.tag.noexec = false;
 1516: 			}
 1517: break;
 1518: case 65:
 1519: #line 511 "gram.y"
 1520: {
 1521: 			    yyval.tag.setenv = true;
 1522: 			}
 1523: break;
 1524: case 66:
 1525: #line 514 "gram.y"
 1526: {
 1527: 			    yyval.tag.setenv = false;
 1528: 			}
 1529: break;
 1530: case 67:
 1531: #line 517 "gram.y"
 1532: {
 1533: 			    yyval.tag.log_input = true;
 1534: 			}
 1535: break;
 1536: case 68:
 1537: #line 520 "gram.y"
 1538: {
 1539: 			    yyval.tag.log_input = false;
 1540: 			}
 1541: break;
 1542: case 69:
 1543: #line 523 "gram.y"
 1544: {
 1545: 			    yyval.tag.log_output = true;
 1546: 			}
 1547: break;
 1548: case 70:
 1549: #line 526 "gram.y"
 1550: {
 1551: 			    yyval.tag.log_output = false;
 1552: 			}
 1553: break;
 1554: case 71:
 1555: #line 531 "gram.y"
 1556: {
 1557: 			    yyval.member = new_member(NULL, ALL);
 1558: 			}
 1559: break;
 1560: case 72:
 1561: #line 534 "gram.y"
 1562: {
 1563: 			    yyval.member = new_member(yyvsp[0].string, ALIAS);
 1564: 			}
 1565: break;
 1566: case 73:
 1567: #line 537 "gram.y"
 1568: {
 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);
 1573: 			}
 1574: break;
 1575: case 76:
 1576: #line 549 "gram.y"
 1577: {
 1578: 			    char *s;
 1579: 			    if ((s = alias_add(yyvsp[-2].string, HOSTALIAS, yyvsp[0].member)) != NULL) {
 1580: 				yyerror(s);
 1581: 				YYERROR;
 1582: 			    }
 1583: 			}
 1584: break;
 1585: case 78:
 1586: #line 559 "gram.y"
 1587: {
 1588: 			    list_append(yyvsp[-2].member, yyvsp[0].member);
 1589: 			    yyval.member = yyvsp[-2].member;
 1590: 			}
 1591: break;
 1592: case 81:
 1593: #line 569 "gram.y"
 1594: {
 1595: 			    char *s;
 1596: 			    if ((s = alias_add(yyvsp[-2].string, CMNDALIAS, yyvsp[0].member)) != NULL) {
 1597: 				yyerror(s);
 1598: 				YYERROR;
 1599: 			    }
 1600: 			}
 1601: break;
 1602: case 83:
 1603: #line 579 "gram.y"
 1604: {
 1605: 			    list_append(yyvsp[-2].member, yyvsp[0].member);
 1606: 			    yyval.member = yyvsp[-2].member;
 1607: 			}
 1608: break;
 1609: case 86:
 1610: #line 589 "gram.y"
 1611: {
 1612: 			    char *s;
 1613: 			    if ((s = alias_add(yyvsp[-2].string, RUNASALIAS, yyvsp[0].member)) != NULL) {
 1614: 				yyerror(s);
 1615: 				YYERROR;
 1616: 			    }
 1617: 			}
 1618: break;
 1619: case 89:
 1620: #line 602 "gram.y"
 1621: {
 1622: 			    char *s;
 1623: 			    if ((s = alias_add(yyvsp[-2].string, USERALIAS, yyvsp[0].member)) != NULL) {
 1624: 				yyerror(s);
 1625: 				YYERROR;
 1626: 			    }
 1627: 			}
 1628: break;
 1629: case 91:
 1630: #line 612 "gram.y"
 1631: {
 1632: 			    list_append(yyvsp[-2].member, yyvsp[0].member);
 1633: 			    yyval.member = yyvsp[-2].member;
 1634: 			}
 1635: break;
 1636: case 92:
 1637: #line 618 "gram.y"
 1638: {
 1639: 			    yyval.member = yyvsp[0].member;
 1640: 			    yyval.member->negated = false;
 1641: 			}
 1642: break;
 1643: case 93:
 1644: #line 622 "gram.y"
 1645: {
 1646: 			    yyval.member = yyvsp[0].member;
 1647: 			    yyval.member->negated = true;
 1648: 			}
 1649: break;
 1650: case 94:
 1651: #line 628 "gram.y"
 1652: {
 1653: 			    yyval.member = new_member(yyvsp[0].string, ALIAS);
 1654: 			}
 1655: break;
 1656: case 95:
 1657: #line 631 "gram.y"
 1658: {
 1659: 			    yyval.member = new_member(NULL, ALL);
 1660: 			}
 1661: break;
 1662: case 96:
 1663: #line 634 "gram.y"
 1664: {
 1665: 			    yyval.member = new_member(yyvsp[0].string, NETGROUP);
 1666: 			}
 1667: break;
 1668: case 97:
 1669: #line 637 "gram.y"
 1670: {
 1671: 			    yyval.member = new_member(yyvsp[0].string, USERGROUP);
 1672: 			}
 1673: break;
 1674: case 98:
 1675: #line 640 "gram.y"
 1676: {
 1677: 			    yyval.member = new_member(yyvsp[0].string, WORD);
 1678: 			}
 1679: break;
 1680: case 100:
 1681: #line 646 "gram.y"
 1682: {
 1683: 			    list_append(yyvsp[-2].member, yyvsp[0].member);
 1684: 			    yyval.member = yyvsp[-2].member;
 1685: 			}
 1686: break;
 1687: case 101:
 1688: #line 652 "gram.y"
 1689: {
 1690: 			    yyval.member = yyvsp[0].member;
 1691: 			    yyval.member->negated = false;
 1692: 			}
 1693: break;
 1694: case 102:
 1695: #line 656 "gram.y"
 1696: {
 1697: 			    yyval.member = yyvsp[0].member;
 1698: 			    yyval.member->negated = true;
 1699: 			}
 1700: break;
 1701: case 103:
 1702: #line 662 "gram.y"
 1703: {
 1704: 			    yyval.member = new_member(yyvsp[0].string, ALIAS);
 1705: 			}
 1706: break;
 1707: case 104:
 1708: #line 665 "gram.y"
 1709: {
 1710: 			    yyval.member = new_member(NULL, ALL);
 1711: 			}
 1712: break;
 1713: case 105:
 1714: #line 668 "gram.y"
 1715: {
 1716: 			    yyval.member = new_member(yyvsp[0].string, WORD);
 1717: 			}
 1718: break;
 1719: #line 1667 "gram.c"
 1720:     }
 1721:     yyssp -= yym;
 1722:     yystate = *yyssp;
 1723:     yyvsp -= yym;
 1724:     yym = yylhs[yyn];
 1725:     if (yystate == 0 && yym == 0)
 1726:     {
 1727: #if YYDEBUG
 1728:         if (yydebug)
 1729:             printf("%sdebug: after reduction, shifting from state 0 to\
 1730:  state %d\n", YYPREFIX, YYFINAL);
 1731: #endif
 1732:         yystate = YYFINAL;
 1733:         *++yyssp = YYFINAL;
 1734:         *++yyvsp = yyval;
 1735:         if (yychar < 0)
 1736:         {
 1737:             if ((yychar = yylex()) < 0) yychar = 0;
 1738: #if YYDEBUG
 1739:             if (yydebug)
 1740:             {
 1741:                 yys = 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);
 1746:             }
 1747: #endif
 1748:         }
 1749:         if (yychar == 0) goto yyaccept;
 1750:         goto yyloop;
 1751:     }
 1752:     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
 1753:             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
 1754:         yystate = yytable[yyn];
 1755:     else
 1756:         yystate = yydgoto[yym];
 1757: #if YYDEBUG
 1758:     if (yydebug)
 1759:         printf("%sdebug: after reduction, shifting from state %d \
 1760: to state %d\n", YYPREFIX, *yyssp, yystate);
 1761: #endif
 1762:     if (yyssp >= yysslim && yygrowstack())
 1763:     {
 1764:         goto yyoverflow;
 1765:     }
 1766:     *++yyssp = yystate;
 1767:     *++yyvsp = yyval;
 1768:     goto yyloop;
 1769: yyoverflow:
 1770:     yyerror("yacc stack overflow");
 1771: yyabort:
 1772:     if (yyss)
 1773:             free(yyss);
 1774:     if (yyvs)
 1775:             free(yyvs);
 1776:     yyss = yyssp = NULL;
 1777:     yyvs = yyvsp = NULL;
 1778:     yystacksize = 0;
 1779:     return (1);
 1780: yyaccept:
 1781:     if (yyss)
 1782:             free(yyss);
 1783:     if (yyvs)
 1784:             free(yyvs);
 1785:     yyss = yyssp = NULL;
 1786:     yyvs = yyvsp = NULL;
 1787:     yystacksize = 0;
 1788:     return (0);
 1789: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>