~ubuntu-branches/ubuntu/hardy/sudo/hardy-proposed

« back to all changes in this revision

Viewing changes to sudo.tab.c

  • Committer: Bazaar Package Importer
  • Author(s): Thom May
  • Date: 2005-03-02 20:34:20 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050302203420-p2zur6rttkhc3joi
Tags: 1.6.8p5-1ubuntu2
Add !fqdn to the Defaults so we don't die horribly when localhost doesn't
resolve (Ubuntu: 2772)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef lint
2
2
/*static char yysccsid[] = "from: @(#)yaccpar   1.9 (Berkeley) 02/21/93";*/
3
3
static char yyrcsid[]
4
 
#if __GNUC__ == 2
 
4
#if __GNUC__ >= 2
5
5
  __attribute__ ((unused))
6
 
#endif /* __GNUC__ == 2 */
7
 
  = "$OpenBSD: skeleton.c,v 1.19 2002/12/03 21:34:21 mickey Exp $";
 
6
#endif /* __GNUC__ >= 2 */
 
7
  = "$OpenBSD: skeleton.c,v 1.23 2004/03/12 13:39:50 henning Exp $";
8
8
#endif
9
9
#include <stdlib.h>
10
10
#define YYBYACC 1
18
18
#define YYPREFIX "yy"
19
19
#line 2 "parse.yacc"
20
20
/*
21
 
 * Copyright (c) 1996, 1998-2001 Todd C. Miller <Todd.Miller@courtesan.com>
22
 
 * All rights reserved.
23
 
 *
24
 
 * This code is derived from software contributed by Chris Jepeway.
25
 
 *
26
 
 * Redistribution and use in source and binary forms, with or without
27
 
 * modification, are permitted provided that the following conditions
28
 
 * are met:
29
 
 *
30
 
 * 1. Redistributions of source code must retain the above copyright
31
 
 *    notice, this list of conditions and the following disclaimer.
32
 
 *
33
 
 * 2. Redistributions in binary form must reproduce the above copyright
34
 
 *    notice, this list of conditions and the following disclaimer in the
35
 
 *    documentation and/or other materials provided with the distribution.
36
 
 *
37
 
 * 3. The name of the author may not be used to endorse or promote products
38
 
 *    derived from this software without specific prior written permission.
39
 
 *
40
 
 * 4. Products derived from this software may not be called "Sudo" nor
41
 
 *    may "Sudo" appear in their names without specific prior written
42
 
 *    permission from the author.
43
 
 *
44
 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
45
 
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
46
 
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
47
 
 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
48
 
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
49
 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
50
 
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
51
 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 
21
 * Copyright (c) 1996, 1998-2004 Todd C. Miller <Todd.Miller@courtesan.com>
 
22
 *
 
23
 * Permission to use, copy, modify, and distribute this software for any
 
24
 * purpose with or without fee is hereby granted, provided that the above
 
25
 * copyright notice and this permission notice appear in all copies.
 
26
 *
 
27
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 
28
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 
29
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 
30
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
31
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 
32
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 
33
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
52
34
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
35
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
36
 *
 
37
 * Sponsored in part by the Defense Advanced Research Projects
 
38
 * Agency (DARPA) and Air Force Research Laboratory, Air Force
 
39
 * Materiel Command, USAF, under agreement number F39502-99-1-0512.
54
40
 */
55
41
 
56
42
/*
103
89
#endif /* HAVE_LSEARCH */
104
90
 
105
91
#ifndef lint
106
 
static const char rcsid[] = "$Sudo: sudo.tab.c,v 1.61 2003/03/13 20:02:20 millert Exp $";
 
92
static const char rcsid[] = "$Sudo: sudo.tab.c,v 1.76 2004/08/11 18:29:36 millert Exp $";
107
93
#endif /* lint */
108
94
 
109
95
/*
116
102
int pedantic = FALSE;
117
103
int keepall = FALSE;
118
104
int quiet = FALSE;
 
105
int used_runas = FALSE;
119
106
 
120
107
/*
121
108
 * Alias types
125
112
#define USER_ALIAS               3
126
113
#define RUNAS_ALIAS              4
127
114
 
 
115
#define SETMATCH(_var, _val)    do { \
 
116
        if ((_var) == UNSPEC || (_val) != NOMATCH) \
 
117
            (_var) = (_val); \
 
118
} while (0)
 
119
 
 
120
#define SETNMATCH(_var, _val)   do { \
 
121
        if ((_val) != NOMATCH) \
 
122
            (_var) = ! (_val); \
 
123
        else if ((_var) == UNSPEC) \
 
124
            (_var) = NOMATCH; \
 
125
} while (0)
 
126
 
128
127
/*
129
128
 * The matching stack, initial space allocated in init_parser().
130
129
 */
137
136
            while ((stacksize += STACKINCREMENT) < top); \
138
137
            match = (struct matchstack *) erealloc3(match, stacksize, sizeof(struct matchstack)); \
139
138
        } \
140
 
        match[top].user   = -1; \
141
 
        match[top].cmnd   = -1; \
142
 
        match[top].host   = -1; \
143
 
        match[top].runas  = -1; \
144
 
        match[top].nopass = def_flag(I_AUTHENTICATE) ? -1 : TRUE; \
 
139
        match[top].user   = UNSPEC; \
 
140
        match[top].cmnd   = UNSPEC; \
 
141
        match[top].host   = UNSPEC; \
 
142
        match[top].runas  = UNSPEC; \
 
143
        match[top].nopass = def_authenticate ? UNSPEC : TRUE; \
 
144
        match[top].noexec = def_noexec ? TRUE : UNSPEC; \
145
145
        top++; \
146
146
    } while (0)
147
147
 
156
156
        match[top].host   = match[top-1].host; \
157
157
        match[top].runas  = match[top-1].runas; \
158
158
        match[top].nopass = match[top-1].nopass; \
 
159
        match[top].noexec = match[top-1].noexec; \
159
160
        top++; \
160
161
    } while (0)
161
162
 
162
163
#define pop \
163
 
    { \
 
164
    do { \
164
165
        if (top == 0) \
165
166
            yyerror("matching stack underflow"); \
166
167
        else \
167
168
            top--; \
168
 
    }
 
169
    } while (0)
 
170
 
 
171
 
 
172
/*
 
173
 * For testing if foo_matches variable was set to TRUE or FALSE
 
174
 */
 
175
#define MATCHED(_v)     ((_v) >= 0)
169
176
 
170
177
/*
171
178
 * Shortcuts for append()
196
203
/*
197
204
 * Does this Defaults list pertain to this user?
198
205
 */
199
 
static int defaults_matches = 0;
 
206
static int defaults_matches = FALSE;
200
207
 
201
208
/*
202
209
 * Local protoypes
227
234
    }
228
235
    parse_error = TRUE;
229
236
}
230
 
#line 214 "parse.yacc"
 
237
#line 221 "parse.yacc"
 
238
#ifndef YYSTYPE_DEFINED
 
239
#define YYSTYPE_DEFINED
231
240
typedef union {
232
241
    char *string;
233
242
    int BOOLEAN;
234
243
    struct sudo_command command;
235
244
    int tok;
236
245
} YYSTYPE;
237
 
#line 238 "sudo.tab.c"
 
246
#endif /* YYSTYPE_DEFINED */
 
247
#line 248 "sudo.tab.c"
238
248
#define COMMAND 257
239
249
#define ALIAS 258
240
250
#define DEFVAR 259
249
259
#define RUNAS 268
250
260
#define NOPASSWD 269
251
261
#define PASSWD 270
252
 
#define ALL 271
253
 
#define COMMENT 272
254
 
#define HOSTALIAS 273
255
 
#define CMNDALIAS 274
256
 
#define USERALIAS 275
257
 
#define RUNASALIAS 276
258
 
#define ERROR 277
 
262
#define NOEXEC 271
 
263
#define EXEC 272
 
264
#define ALL 273
 
265
#define COMMENT 274
 
266
#define HOSTALIAS 275
 
267
#define CMNDALIAS 276
 
268
#define USERALIAS 277
 
269
#define RUNASALIAS 278
 
270
#define ERROR 279
259
271
#define YYERRCODE 256
260
272
#if defined(__cplusplus) || defined(__STDC__)
261
273
const short yylhs[] =
268
280
   17,   22,   22,   22,   22,   22,   10,   10,   23,   25,
269
281
   25,    2,    2,    2,    2,    2,   24,   24,   26,   29,
270
282
   30,   29,   27,   27,    5,    5,    4,   31,    4,    3,
271
 
    3,    3,    3,    3,   28,   28,   28,    1,    1,    1,
272
 
   12,   12,   33,   32,   20,   20,   13,   13,   35,   34,
273
 
   36,   36,   14,   14,   38,   37,   11,   11,   40,   39,
274
 
    8,    8,   41,   41,    6,    6,    6,    6,    6,
 
283
    3,    3,    3,    3,   28,   28,   28,   28,   28,    1,
 
284
    1,    1,   12,   12,   33,   32,   20,   20,   13,   13,
 
285
   35,   34,   36,   36,   14,   14,   38,   37,   11,   11,
 
286
   40,   39,    8,    8,   41,   41,    6,    6,    6,    6,
 
287
    6,
275
288
};
276
289
#if defined(__cplusplus) || defined(__STDC__)
277
290
const short yylen[] =
284
297
    3,    1,    2,    3,    3,    3,    1,    3,    3,    1,
285
298
    2,    1,    1,    1,    1,    1,    1,    3,    3,    1,
286
299
    0,    3,    0,    2,    1,    3,    1,    0,    3,    1,
287
 
    1,    1,    1,    1,    0,    1,    1,    1,    1,    1,
288
 
    1,    3,    0,    4,    1,    3,    1,    3,    0,    4,
289
 
    1,    3,    1,    3,    0,    4,    1,    3,    0,    4,
290
 
    1,    3,    1,    2,    1,    1,    1,    1,    1,
 
300
    1,    1,    1,    1,    0,    2,    2,    2,    2,    1,
 
301
    1,    1,    1,    3,    0,    4,    1,    3,    1,    3,
 
302
    0,    4,    1,    3,    1,    3,    0,    4,    1,    3,
 
303
    0,    4,    1,    3,    1,    2,    1,    1,    1,    1,
 
304
    1,
291
305
};
292
306
#if defined(__cplusplus) || defined(__STDC__)
293
307
const short yydefred[] =
296
310
#endif
297
311
        {                                      0,
298
312
    0,   13,   18,   14,   16,    3,    0,    0,    0,    0,
299
 
    0,    1,    0,   11,    0,    4,    0,    0,    0,   63,
300
 
    0,   61,   69,    0,   67,   79,    0,   77,   75,    0,
301
 
   73,    2,   88,   87,   86,   85,   89,    0,   83,    0,
302
 
   81,    0,    0,   12,    0,   36,   33,   34,   35,   32,
303
 
    0,   30,    0,   65,    0,   53,   52,   51,   50,   54,
 
313
    0,    1,    0,   11,    0,    4,    0,    0,    0,   65,
 
314
    0,   63,   71,    0,   69,   81,    0,   79,   77,    0,
 
315
   75,    2,   90,   89,   88,   87,   91,    0,   85,    0,
 
316
   83,    0,    0,   12,    0,   36,   33,   34,   35,   32,
 
317
    0,   30,    0,   67,    0,   53,   52,   51,   50,   54,
304
318
   48,   47,   45,    0,    0,    0,    0,    0,    0,    0,
305
 
    0,    0,   84,    0,    0,    0,   27,    0,    0,    0,
306
 
   23,    0,   31,    0,    0,    0,    0,   62,    0,   68,
307
 
    0,   78,    0,   74,   82,    0,    0,   24,   25,   26,
308
 
   21,   66,   49,   46,    0,   60,   59,   58,   41,   40,
309
 
   71,    0,    0,    0,   28,    0,    0,   37,    0,    0,
310
 
    0,    0,    0,   56,   57,    0,   42,   72,   38,   39,
 
319
    0,    0,   86,    0,    0,    0,   27,    0,    0,    0,
 
320
   23,    0,   31,    0,    0,    0,    0,   64,    0,   70,
 
321
    0,   80,    0,   76,   84,    0,    0,   24,   25,   26,
 
322
   21,   68,   49,   46,    0,   62,   61,   60,   41,   40,
 
323
   73,    0,    0,    0,   28,    0,    0,   37,   55,    0,
 
324
    0,    0,    0,    0,   42,   74,   38,   56,   57,   58,
 
325
   59,   39,
311
326
};
312
327
#if defined(__cplusplus) || defined(__STDC__)
313
328
const short yydgoto[] =
317
332
        {                                      11,
318
333
  110,   52,   62,   63,   64,   39,   12,   40,   13,   75,
319
334
   27,   21,   24,   30,   14,   15,   44,   18,   19,   76,
320
 
   17,   45,   77,  117,   54,  118,  119,  126,  111,  120,
 
335
   17,   45,   77,  117,   54,  118,  119,  124,  111,  120,
321
336
   85,   22,   65,   25,   67,  112,   31,   71,   28,   69,
322
337
   41,
323
338
};
326
341
#else
327
342
short yysindex[] =
328
343
#endif
329
 
        {                                   -226,
330
 
 -256,    0,    0,    0,    0,    0, -233, -230, -227, -225,
331
 
 -226,    0,  -29,    0,  -28,    0,  -15,  -29,  257,    0,
332
 
  -26,    0,    0,  -23,    0,    0,  -22,    0,    0,  -21,
333
 
    0,    0,    0,    0,    0,    0,    0, -205,    0,  -33,
334
 
    0,  -35, -217,    0,    7,    0,    0,    0,    0,    0,
335
 
 -193,    0,    8,    0,   10,    0,    0,    0,    0,    0,
336
 
    0,    0,    0,   15,  -17, -233,   -1, -230,    2, -227,
337
 
   11, -225,    0,  -29,    3,  -37,    0, -201, -194, -192,
338
 
    0,  -28,    0,  -15, -179,  257,  -15,    0,  222,    0,
339
 
  -29,    0,  257,    0,    0,  -15, -191,    0,    0,    0,
340
 
    0,    0,    0,    0,    8,    0,    0,    0,    0,    0,
341
 
    0,   30,   10,   15,    0,  257,   37,    0, -250, -244,
342
 
  222,   15, -191,    0,    0,  222,    0,    0,    0,    0,};
 
344
        {                                   -239,
 
345
 -264,    0,    0,    0,    0,    0, -247, -240, -236, -235,
 
346
 -239,    0,  307,    0,  -31,    0,  328,  307,  320,    0,
 
347
   -9,    0,    0,   -8,    0,    0,   -4,    0,    0,    2,
 
348
    0,    0,    0,    0,    0,    0,    0, -242,    0,  294,
 
349
    0,   -3, -226,    0,   11,    0,    0,    0,    0,    0,
 
350
 -217,    0,   17,    0,   20,    0,    0,    0,    0,    0,
 
351
    0,    0,    0,   21,    5, -247,    6, -240,    7, -236,
 
352
    8, -235,    0,  307,   13,  -32,    0, -191, -190, -189,
 
353
    0,  -31,    0,  328, -210,  320,  328,    0,  -33,    0,
 
354
  307,    0,  320,    0,    0,  328, -192,    0,    0,    0,
 
355
    0,    0,    0,    0,   17,    0,    0,    0,    0,    0,
 
356
    0,   34,   20,   21,    0,  320,   35,    0,    0, -243,
 
357
  -33,   21, -192,  -27,    0,    0,    0,    0,    0,    0,
 
358
    0,    0,};
343
359
#if defined(__cplusplus) || defined(__STDC__)
344
360
const short yyrindex[] =
345
361
#else
346
362
short yyrindex[] =
347
363
#endif
348
 
        {                                    269,
349
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
350
 
  269,    0,    0,    0,    0,    0,    0,    0,    0,    0,
351
 
  127,    0,    0,  148,    0,    0,  169,    0,    0,  190,
352
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
353
 
    0,    1,    0,    0,  211,    0,    0,    0,    0,    0,
354
 
    0,    0,  -24,    0,  -12,    0,    0,    0,    0,    0,
355
 
    0,    0,    0,  -10,    0,    0,    0,    0,    0,    0,
356
 
    0,    0,    0,    0,  236,    0,    0,    0,    0,    0,
357
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
358
 
    0,    0,    0,    0,    0,    0,  -18,    0,    0,    0,
359
 
    0,    0,    0,    0,   22,    0,    0,    0,    0,    0,
360
 
    0,   43,   64,   85,    0,    0,  106,    0,  288,    0,
361
 
    0,  267,  -18,    0,    0,    0,    0,    0,    0,    0,};
 
364
        {                                    342,
 
365
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
366
  342,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
367
  139,    0,    0,  162,    0,    0,  185,    0,    0,  208,
 
368
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
369
    0,    1,    0,    0,  236,    0,    0,    0,    0,    0,
 
370
    0,    0,  -30,    0,  -26,    0,    0,    0,    0,    0,
 
371
    0,    0,    0,  -25,    0,    0,    0,    0,    0,    0,
 
372
    0,    0,    0,    0,  260,    0,    0,    0,    0,    0,
 
373
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
374
    0,    0,    0,    0,    0,    0,  -20,    0,    0,    0,
 
375
    0,    0,    0,    0,   24,    0,    0,    0,    0,    0,
 
376
    0,   47,   70,   93,    0,    0,  116,    0,    0,    0,
 
377
    0,  271,  -20,    0,    0,    0,    0,    0,    0,    0,
 
378
    0,    0,};
362
379
#if defined(__cplusplus) || defined(__STDC__)
363
380
const short yygindex[] =
364
381
#else
365
382
short yygindex[] =
366
383
#endif
367
384
        {                                      0,
368
 
  -34,   36,    4,    5,  -87,   50,   79,  -16,    0,    0,
369
 
    0,    0,    0,    0,    0,    0,   12,    0,    0,  -14,
370
 
    0,    0,   -3,    0,   14,  -27,    0,    0, -109,    0,
371
 
    0,   29,    0,   31,    0,    0,   28,    0,   32,    0,
372
 
   33,
 
385
  -39,   32,   -1,    3,  -84,   48,   74,  -14,    0,    0,
 
386
    0,    0,    0,    0,    0,    0,    9,    0,    0,  -12,
 
387
    0,    0,   -6,    0,    4,  -36,    0,    0,  -62,    0,
 
388
    0,   26,    0,   27,    0,    0,   22,    0,   28,    0,
 
389
   23,
373
390
};
374
 
#define YYTABLESIZE 559
 
391
#define YYTABLESIZE 615
375
392
#if defined(__cplusplus) || defined(__STDC__)
376
393
const short yytable[] =
377
394
#else
378
395
short yytable[] =
379
396
#endif
380
 
        {                                      51,
381
 
   22,   55,   53,   38,   43,  114,   84,   79,   19,   80,
382
 
   74,  128,  106,  107,   43,   16,  130,   51,  124,  125,
383
 
   15,   64,   17,   97,   20,   78,  108,   23,  122,    1,
384
 
   26,   66,   29,   22,   68,   70,   72,    2,    3,    4,
385
 
    5,   81,   70,   87,   22,    6,    7,    8,    9,   10,
386
 
   82,   84,   33,   74,   64,   34,   35,   36,   86,   89,
387
 
   96,   98,   91,   80,   46,   37,   47,   48,   99,   49,
388
 
  100,   93,  105,  121,  113,   70,  116,   50,   56,   64,
389
 
  123,   57,   58,   59,   76,  127,   83,   73,  103,   32,
390
 
  104,   60,  115,  101,   88,  129,   80,  102,   90,   94,
391
 
   70,   92,    0,    0,    0,   29,   95,    0,    0,    0,
392
 
    0,    0,    0,    0,    0,    0,    0,   76,    0,    0,
393
 
    0,   80,    0,    0,    0,    0,    8,    0,    0,    0,
 
397
        {                                     109,
 
398
   22,   43,   19,   55,   53,  109,   15,   17,  114,   16,
 
399
   20,   84,   43,  106,  107,   33,    1,   23,   34,   35,
 
400
   36,   26,   29,   66,    2,    3,    4,    5,   97,  108,
 
401
   37,  122,   81,   22,    6,    7,    8,    9,   10,   79,
 
402
   46,   80,   47,   48,   22,   49,   72,   56,   66,   68,
 
403
   57,   58,   59,   70,   82,   50,   66,   78,  126,   72,
 
404
   84,  132,   60,   74,   86,   87,   89,   91,   93,   82,
 
405
   96,   98,   99,  100,  105,  116,  113,  121,  123,   72,
 
406
  125,   66,   83,  103,   32,   73,  127,  102,  104,  115,
 
407
  101,   88,   78,   94,   90,    0,   95,   92,    0,    0,
 
408
    0,    0,   82,    0,   72,    0,    0,    0,    0,    0,
 
409
    0,    0,    0,    0,    0,   29,    0,    0,    0,    0,
 
410
    0,    0,    0,    0,    0,   78,    0,   82,    0,    0,
 
411
    0,    0,    0,    0,    0,    0,    0,    0,    8,    0,
394
412
    0,    0,    0,    0,    0,    0,    0,    0,   29,    0,
395
 
    0,    0,   76,    0,    0,    0,    0,    9,    0,    0,
396
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    8,
397
 
    0,    0,    0,   29,    0,    0,    0,    0,    7,    0,
398
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
399
 
    9,    0,    0,    0,    0,    0,    0,    0,    0,   10,
400
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
401
 
    0,    7,    0,    0,    0,    0,    0,    0,    0,    0,
402
 
   20,    0,    0,    0,    0,    0,    0,    0,    0,    0,
403
 
    0,    0,   10,    0,   46,    0,   47,   48,   33,   49,
404
 
   42,   34,   35,   36,   19,    6,    0,   50,   43,   43,
405
 
    0,   37,   46,   20,   47,   48,   15,   49,   17,    0,
406
 
   43,   43,   43,    0,  109,   50,   22,    0,   22,    0,
407
 
    0,   22,   22,   22,   22,   22,   22,   22,    6,    0,
408
 
    0,   22,   22,   22,   22,   22,   22,   64,    0,   64,
409
 
    0,    0,   64,   64,   64,   64,   64,   64,   64,   61,
410
 
    0,    0,   64,   64,   64,   64,   64,   64,   70,   44,
411
 
   70,    5,    0,   70,   70,   70,   70,   70,   70,   70,
412
 
    0,    0,    0,   70,   70,   70,   70,   70,   70,   80,
413
 
   55,   80,    0,    0,   80,   80,   80,   80,   80,   80,
414
 
   80,    0,    0,    0,   80,   80,   80,   80,   80,   80,
415
 
   76,    0,   76,    0,    0,   76,   76,   76,   76,   76,
416
 
   76,   76,    0,    0,    0,   76,   76,   76,   76,   76,
417
 
   76,   29,    0,   29,    0,    0,   29,   29,   29,   29,
418
 
   29,   29,   29,    0,    0,    0,   29,   29,   29,   29,
419
 
   29,   29,    8,    0,    8,    0,    0,    8,    8,    8,
420
 
    8,    8,    8,    8,    0,    0,    0,    8,    8,    8,
421
 
    8,    8,    8,    9,    0,    9,    0,    0,    9,    9,
422
 
    9,    9,    9,    9,    9,    0,    0,    0,    9,    9,
423
 
    9,    9,    9,    9,    7,    0,    7,    0,    0,    7,
424
 
    7,    7,    7,    7,    7,    7,    0,    0,    0,    7,
425
 
    7,    7,    7,    7,    7,   10,    0,   10,    0,    0,
426
 
   10,   10,   10,   10,   10,   10,   10,    0,    0,    0,
427
 
   10,   10,   10,   10,   10,   10,   20,    0,   20,    0,
428
 
    0,   20,   20,   20,   20,   20,   20,   20,  106,  107,
429
 
    0,   20,   20,   20,   20,   20,   20,    0,    0,    0,
430
 
    0,    6,  108,    6,    0,    0,    6,    6,    6,    6,
431
 
    6,    6,    6,    0,    0,    0,    6,    6,    6,    6,
432
 
    6,    6,    0,    0,   56,    0,    0,   57,   58,   59,
433
 
    0,    0,    0,   44,   44,    0,    5,   60,    0,    5,
434
 
    5,    5,    0,    0,    0,   44,   44,   44,    0,    5,
435
 
    0,    0,    0,    0,   55,   55,    0,    0,    0,    0,
436
 
    0,    0,    0,    0,    0,    0,    0,    0,   55,
 
413
   78,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
414
    0,    9,    0,    0,    0,    0,    0,    0,    0,    0,
 
415
    0,    8,    0,   29,    0,    0,    0,    0,    0,    0,
 
416
    0,    0,    0,    0,    7,    0,    0,    0,    0,    0,
 
417
    0,    0,    0,    0,    9,    0,    0,    0,    0,    0,
 
418
    0,    0,    0,    0,    0,    0,    0,   10,    0,    0,
 
419
    0,    0,    0,    0,    0,    0,    0,    7,    0,    0,
 
420
    0,    0,    0,  106,  107,    0,    0,   42,   19,  106,
 
421
  107,    0,   15,   17,    0,   20,   43,   43,    0,  108,
 
422
   10,  128,  129,  130,  131,  108,    0,    0,   43,   43,
 
423
   43,   43,   43,    0,    0,    0,   22,    0,   22,    6,
 
424
    0,   22,   22,   22,   22,   22,   22,   22,   20,    0,
 
425
    0,    0,    0,   22,   22,   22,   22,   22,   22,   66,
 
426
    0,   66,    0,    0,   66,   66,   66,   66,   66,   66,
 
427
   66,    0,    6,    0,    0,    0,   66,   66,   66,   66,
 
428
   66,   66,   72,   44,   72,    0,    0,   72,   72,   72,
 
429
   72,   72,   72,   72,    0,    0,    0,    0,    0,   72,
 
430
   72,   72,   72,   72,   72,   82,   51,   82,    0,    0,
 
431
   82,   82,   82,   82,   82,   82,   82,   74,    0,   38,
 
432
    0,    0,   82,   82,   82,   82,   82,   82,   78,    0,
 
433
   78,    0,   61,   78,   78,   78,   78,   78,   78,   78,
 
434
   51,    0,    0,    0,    0,   78,   78,   78,   78,   78,
 
435
   78,   29,    0,   29,    5,    0,   29,   29,   29,   29,
 
436
   29,   29,   29,    0,    0,    0,    0,    0,   29,   29,
 
437
   29,   29,   29,   29,    8,    0,    8,    0,    0,    8,
 
438
    8,    8,    8,    8,    8,    8,    0,    0,    0,    0,
 
439
    0,    8,    8,    8,    8,    8,    8,    9,    0,    9,
 
440
    0,    0,    9,    9,    9,    9,    9,    9,    9,    0,
 
441
    0,    0,    0,    0,    9,    9,    9,    9,    9,    9,
 
442
    7,    0,    7,    0,    0,    7,    7,    7,    7,    7,
 
443
    7,    7,    0,    0,    0,    0,    0,    7,    7,    7,
 
444
    7,    7,    7,   10,    0,   10,    0,    0,   10,   10,
 
445
   10,   10,   10,   10,   10,    0,    0,    0,    0,    0,
 
446
   10,   10,   10,   10,   10,   10,    0,    0,    0,    0,
 
447
    0,   20,    0,   20,    0,    0,   20,   20,   20,   20,
 
448
   20,   20,   20,    0,    0,    0,    0,    0,   20,   20,
 
449
   20,   20,   20,   20,    0,    6,    0,    6,    0,    0,
 
450
    6,    6,    6,    6,    6,    6,    6,   44,   44,    0,
 
451
    0,    0,    6,    6,    6,    6,    6,    6,    0,   44,
 
452
   44,   44,   44,   44,    0,    0,    0,    0,    0,    0,
 
453
    0,   46,    0,   47,   48,    0,   49,    0,    0,    0,
 
454
    0,    0,    0,    0,   33,    0,   50,   34,   35,   36,
 
455
    0,    0,    0,    0,    0,    0,    0,   56,    0,   37,
 
456
   57,   58,   59,    0,    0,   46,    0,   47,   48,    0,
 
457
   49,    0,   60,    0,    0,    0,    0,    0,    0,    5,
 
458
   50,    0,    5,    5,    5,    0,    0,    0,    0,    0,
 
459
    0,    0,    0,    0,    5,
437
460
};
438
461
#if defined(__cplusplus) || defined(__STDC__)
439
462
const short yycheck[] =
441
464
short yycheck[] =
442
465
#endif
443
466
        {                                      33,
444
 
    0,   18,   17,   33,   33,   93,   44,   43,   33,   45,
445
 
   44,  121,  257,  258,   33,  272,  126,   33,  269,  270,
446
 
   33,    0,   33,   61,  258,   61,  271,  258,  116,  256,
447
 
  258,   58,  258,   33,   58,   58,   58,  264,  265,  266,
448
 
  267,  259,    0,   61,   44,  272,  273,  274,  275,  276,
449
 
   44,   44,  258,   44,   33,  261,  262,  263,   44,   61,
450
 
   58,  263,   61,    0,  258,  271,  260,  261,  263,  263,
451
 
  263,   61,   87,   44,   91,   33,  268,  271,  258,   58,
452
 
   44,  261,  262,  263,    0,  120,   51,   38,   85,   11,
453
 
   86,  271,   96,   82,   66,  123,   33,   84,   68,   72,
454
 
   58,   70,   -1,   -1,   -1,    0,   74,   -1,   -1,   -1,
 
467
    0,   33,   33,   18,   17,   33,   33,   33,   93,  274,
 
468
  258,   44,   33,  257,  258,  258,  256,  258,  261,  262,
 
469
  263,  258,  258,    0,  264,  265,  266,  267,   61,  273,
 
470
  273,  116,  259,   33,  274,  275,  276,  277,  278,   43,
 
471
  258,   45,  260,  261,   44,  263,    0,  258,   58,   58,
 
472
  261,  262,  263,   58,   44,  273,   33,   61,  121,   58,
 
473
   44,  124,  273,   44,   44,   61,   61,   61,   61,    0,
 
474
   58,  263,  263,  263,   87,  268,   91,   44,   44,   33,
 
475
  120,   58,   51,   85,   11,   38,  123,   84,   86,   96,
 
476
   82,   66,    0,   72,   68,   -1,   74,   70,   -1,   -1,
 
477
   -1,   -1,   33,   -1,   58,   -1,   -1,   -1,   -1,   -1,
 
478
   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,
 
479
   -1,   -1,   -1,   -1,   -1,   33,   -1,   58,   -1,   -1,
 
480
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,
 
481
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   33,   -1,
 
482
   58,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
 
483
   -1,    0,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
 
484
   -1,   33,   -1,   58,   -1,   -1,   -1,   -1,   -1,   -1,
 
485
   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,   -1,
 
486
   -1,   -1,   -1,   -1,   33,   -1,   -1,   -1,   -1,   -1,
 
487
   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,
455
488
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   33,   -1,   -1,
456
 
   -1,   58,   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,
457
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   33,   -1,
458
 
   -1,   -1,   58,   -1,   -1,   -1,   -1,    0,   -1,   -1,
459
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   33,
460
 
   -1,   -1,   -1,   58,   -1,   -1,   -1,   -1,    0,   -1,
461
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
462
 
   33,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,
463
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
464
 
   -1,   33,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
465
 
    0,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
466
 
   -1,   -1,   33,   -1,  258,   -1,  260,  261,  258,  263,
467
 
  259,  261,  262,  263,  259,    0,   -1,  271,  257,  258,
468
 
   -1,  271,  258,   33,  260,  261,  259,  263,  259,   -1,
469
 
  269,  270,  271,   -1,   33,  271,  256,   -1,  258,   -1,
 
489
   -1,   -1,   -1,  257,  258,   -1,   -1,  259,  259,  257,
 
490
  258,   -1,  259,  259,   -1,    0,  257,  258,   -1,  273,
 
491
   33,  269,  270,  271,  272,  273,   -1,   -1,  269,  270,
 
492
  271,  272,  273,   -1,   -1,   -1,  256,   -1,  258,    0,
470
493
   -1,  261,  262,  263,  264,  265,  266,  267,   33,   -1,
471
 
   -1,  271,  272,  273,  274,  275,  276,  256,   -1,  258,
472
 
   -1,   -1,  261,  262,  263,  264,  265,  266,  267,   33,
473
 
   -1,   -1,  271,  272,  273,  274,  275,  276,  256,   33,
474
 
  258,   33,   -1,  261,  262,  263,  264,  265,  266,  267,
475
 
   -1,   -1,   -1,  271,  272,  273,  274,  275,  276,  256,
476
 
   33,  258,   -1,   -1,  261,  262,  263,  264,  265,  266,
477
 
  267,   -1,   -1,   -1,  271,  272,  273,  274,  275,  276,
 
494
   -1,   -1,   -1,  273,  274,  275,  276,  277,  278,  256,
 
495
   -1,  258,   -1,   -1,  261,  262,  263,  264,  265,  266,
 
496
  267,   -1,   33,   -1,   -1,   -1,  273,  274,  275,  276,
 
497
  277,  278,  256,   33,  258,   -1,   -1,  261,  262,  263,
 
498
  264,  265,  266,  267,   -1,   -1,   -1,   -1,   -1,  273,
 
499
  274,  275,  276,  277,  278,  256,   33,  258,   -1,   -1,
 
500
  261,  262,  263,  264,  265,  266,  267,   44,   -1,   33,
 
501
   -1,   -1,  273,  274,  275,  276,  277,  278,  256,   -1,
 
502
  258,   -1,   33,  261,  262,  263,  264,  265,  266,  267,
 
503
   33,   -1,   -1,   -1,   -1,  273,  274,  275,  276,  277,
 
504
  278,  256,   -1,  258,   33,   -1,  261,  262,  263,  264,
 
505
  265,  266,  267,   -1,   -1,   -1,   -1,   -1,  273,  274,
 
506
  275,  276,  277,  278,  256,   -1,  258,   -1,   -1,  261,
 
507
  262,  263,  264,  265,  266,  267,   -1,   -1,   -1,   -1,
 
508
   -1,  273,  274,  275,  276,  277,  278,  256,   -1,  258,
 
509
   -1,   -1,  261,  262,  263,  264,  265,  266,  267,   -1,
 
510
   -1,   -1,   -1,   -1,  273,  274,  275,  276,  277,  278,
478
511
  256,   -1,  258,   -1,   -1,  261,  262,  263,  264,  265,
479
 
  266,  267,   -1,   -1,   -1,  271,  272,  273,  274,  275,
480
 
  276,  256,   -1,  258,   -1,   -1,  261,  262,  263,  264,
481
 
  265,  266,  267,   -1,   -1,   -1,  271,  272,  273,  274,
482
 
  275,  276,  256,   -1,  258,   -1,   -1,  261,  262,  263,
483
 
  264,  265,  266,  267,   -1,   -1,   -1,  271,  272,  273,
484
 
  274,  275,  276,  256,   -1,  258,   -1,   -1,  261,  262,
485
 
  263,  264,  265,  266,  267,   -1,   -1,   -1,  271,  272,
486
 
  273,  274,  275,  276,  256,   -1,  258,   -1,   -1,  261,
487
 
  262,  263,  264,  265,  266,  267,   -1,   -1,   -1,  271,
488
 
  272,  273,  274,  275,  276,  256,   -1,  258,   -1,   -1,
489
 
  261,  262,  263,  264,  265,  266,  267,   -1,   -1,   -1,
490
 
  271,  272,  273,  274,  275,  276,  256,   -1,  258,   -1,
491
 
   -1,  261,  262,  263,  264,  265,  266,  267,  257,  258,
492
 
   -1,  271,  272,  273,  274,  275,  276,   -1,   -1,   -1,
493
 
   -1,  256,  271,  258,   -1,   -1,  261,  262,  263,  264,
494
 
  265,  266,  267,   -1,   -1,   -1,  271,  272,  273,  274,
495
 
  275,  276,   -1,   -1,  258,   -1,   -1,  261,  262,  263,
496
 
   -1,   -1,   -1,  257,  258,   -1,  258,  271,   -1,  261,
497
 
  262,  263,   -1,   -1,   -1,  269,  270,  271,   -1,  271,
498
 
   -1,   -1,   -1,   -1,  257,  258,   -1,   -1,   -1,   -1,
499
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  271,
 
512
  266,  267,   -1,   -1,   -1,   -1,   -1,  273,  274,  275,
 
513
  276,  277,  278,  256,   -1,  258,   -1,   -1,  261,  262,
 
514
  263,  264,  265,  266,  267,   -1,   -1,   -1,   -1,   -1,
 
515
  273,  274,  275,  276,  277,  278,   -1,   -1,   -1,   -1,
 
516
   -1,  256,   -1,  258,   -1,   -1,  261,  262,  263,  264,
 
517
  265,  266,  267,   -1,   -1,   -1,   -1,   -1,  273,  274,
 
518
  275,  276,  277,  278,   -1,  256,   -1,  258,   -1,   -1,
 
519
  261,  262,  263,  264,  265,  266,  267,  257,  258,   -1,
 
520
   -1,   -1,  273,  274,  275,  276,  277,  278,   -1,  269,
 
521
  270,  271,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,
 
522
   -1,  258,   -1,  260,  261,   -1,  263,   -1,   -1,   -1,
 
523
   -1,   -1,   -1,   -1,  258,   -1,  273,  261,  262,  263,
 
524
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  258,   -1,  273,
 
525
  261,  262,  263,   -1,   -1,  258,   -1,  260,  261,   -1,
 
526
  263,   -1,  273,   -1,   -1,   -1,   -1,   -1,   -1,  258,
 
527
  273,   -1,  261,  262,  263,   -1,   -1,   -1,   -1,   -1,
 
528
   -1,   -1,   -1,   -1,  273,
500
529
};
501
530
#define YYFINAL 11
502
531
#ifndef YYDEBUG
503
532
#define YYDEBUG 0
504
533
#endif
505
 
#define YYMAXTOKEN 277
 
534
#define YYMAXTOKEN 279
506
535
#if YYDEBUG
507
536
#if defined(__cplusplus) || defined(__STDC__)
508
537
const char * const yyname[] =
519
548
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
520
549
"COMMAND","ALIAS","DEFVAR","NTWKADDR","NETGROUP","USERGROUP","WORD","DEFAULTS",
521
550
"DEFAULTS_HOST","DEFAULTS_USER","DEFAULTS_RUNAS","RUNAS","NOPASSWD","PASSWD",
522
 
"ALL","COMMENT","HOSTALIAS","CMNDALIAS","USERALIAS","RUNASALIAS","ERROR",
 
551
"NOEXEC","EXEC","ALL","COMMENT","HOSTALIAS","CMNDALIAS","USERALIAS",
 
552
"RUNASALIAS","ERROR",
523
553
};
524
554
#if defined(__cplusplus) || defined(__STDC__)
525
555
const char * const yyrule[] =
565
595
"host : ALIAS",
566
596
"cmndspeclist : cmndspec",
567
597
"cmndspeclist : cmndspeclist ',' cmndspec",
568
 
"cmndspec : runasspec nopasswd opcmnd",
 
598
"cmndspec : runasspec cmndtag opcmnd",
569
599
"opcmnd : cmnd",
570
600
"$$5 :",
571
601
"opcmnd : '!' $$5 cmnd",
581
611
"runasuser : NETGROUP",
582
612
"runasuser : ALIAS",
583
613
"runasuser : ALL",
584
 
"nopasswd :",
585
 
"nopasswd : NOPASSWD",
586
 
"nopasswd : PASSWD",
 
614
"cmndtag :",
 
615
"cmndtag : cmndtag NOPASSWD",
 
616
"cmndtag : cmndtag PASSWD",
 
617
"cmndtag : cmndtag NOEXEC",
 
618
"cmndtag : cmndtag EXEC",
587
619
"cmnd : ALL",
588
620
"cmnd : ALIAS",
589
621
"cmnd : COMMAND",
642
674
short *yysslim;
643
675
YYSTYPE *yyvs;
644
676
int yystacksize;
645
 
#line 865 "parse.yacc"
 
677
#line 890 "parse.yacc"
646
678
 
647
679
#define MOREALIASES (32)
648
680
aliasinfo *aliases = NULL;
802
834
void
803
835
list_matches()
804
836
{
805
 
    size_t count; 
 
837
    size_t count;
806
838
    char *p;
807
839
    struct generic_alias *ga, key;
808
840
 
829
861
            } while ((p = strtok(NULL, ", ")));
830
862
            (void) fputs(") ", stdout);
831
863
        } else {
832
 
            (void) printf("(%s) ", def_str(I_RUNAS_DEFAULT));
 
864
            (void) printf("(%s) ", def_runas_default);
833
865
        }
834
866
 
 
867
        /* Is execve(2) disabled? */
 
868
        if (cm_list[count].noexecve == TRUE && !def_noexec)
 
869
            (void) fputs("NOEXEC: ", stdout);
 
870
        else if (cm_list[count].noexecve == FALSE && def_noexec)
 
871
            (void) fputs("EXEC: ", stdout);
 
872
 
835
873
        /* Is a password required? */
836
 
        if (cm_list[count].nopasswd == TRUE && def_flag(I_AUTHENTICATE))
 
874
        if (cm_list[count].nopasswd == TRUE && def_authenticate)
837
875
            (void) fputs("NOPASSWD: ", stdout);
838
 
        else if (cm_list[count].nopasswd == FALSE && !def_flag(I_AUTHENTICATE))
 
876
        else if (cm_list[count].nopasswd == FALSE && !def_authenticate)
839
877
            (void) fputs("PASSWD: ", stdout);
840
878
 
841
879
        /* Print the actual command or expanded Cmnd_Alias. */
964
1002
 
965
1003
    cm_list[cm_list_len].runas = cm_list[cm_list_len].cmnd = NULL;
966
1004
    cm_list[cm_list_len].nopasswd = FALSE;
 
1005
    cm_list[cm_list_len].noexecve = FALSE;
967
1006
}
968
1007
 
969
1008
/*
980
1019
        match = NULL;
981
1020
        top = 0;
982
1021
        parse_error = FALSE;
983
 
        errorlineno = -1;   
984
 
        sudolineno = 1;     
 
1022
        used_runas = FALSE;
 
1023
        errorlineno = -1;
 
1024
        sudolineno = 1;
985
1025
    }
986
1026
 
987
1027
    /* Allocate space for the matching stack. */
992
1032
    if (printmatches == TRUE)
993
1033
        expand_match_list();
994
1034
}
995
 
#line 944 "sudo.tab.c"
 
1035
#line 984 "sudo.tab.c"
996
1036
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
997
1037
#if defined(__cplusplus) || defined(__STDC__)
998
1038
static int yygrowstack(void)
1186
1226
    switch (yyn)
1187
1227
    {
1188
1228
case 3:
1189
 
#line 265 "parse.yacc"
 
1229
#line 275 "parse.yacc"
1190
1230
{ ; }
1191
1231
break;
1192
1232
case 4:
1193
 
#line 267 "parse.yacc"
 
1233
#line 277 "parse.yacc"
1194
1234
{ yyerrok; }
1195
1235
break;
1196
1236
case 5:
1197
 
#line 268 "parse.yacc"
 
1237
#line 278 "parse.yacc"
1198
1238
{ push; }
1199
1239
break;
1200
1240
case 6:
1201
 
#line 268 "parse.yacc"
 
1241
#line 278 "parse.yacc"
1202
1242
{
1203
1243
                            while (top && user_matches != TRUE)
1204
1244
                                pop;
1205
1245
                        }
1206
1246
break;
1207
1247
case 7:
1208
 
#line 273 "parse.yacc"
 
1248
#line 283 "parse.yacc"
1209
1249
{ ; }
1210
1250
break;
1211
1251
case 8:
1212
 
#line 275 "parse.yacc"
 
1252
#line 285 "parse.yacc"
1213
1253
{ ; }
1214
1254
break;
1215
1255
case 9:
1216
 
#line 277 "parse.yacc"
 
1256
#line 287 "parse.yacc"
1217
1257
{ ; }
1218
1258
break;
1219
1259
case 10:
1220
 
#line 279 "parse.yacc"
 
1260
#line 289 "parse.yacc"
1221
1261
{ ; }
1222
1262
break;
1223
1263
case 11:
1224
 
#line 281 "parse.yacc"
 
1264
#line 291 "parse.yacc"
1225
1265
{ ; }
1226
1266
break;
1227
1267
case 13:
1228
 
#line 287 "parse.yacc"
 
1268
#line 297 "parse.yacc"
1229
1269
{
1230
1270
                            defaults_matches = TRUE;
1231
1271
                        }
1232
1272
break;
1233
1273
case 14:
1234
 
#line 290 "parse.yacc"
 
1274
#line 300 "parse.yacc"
1235
1275
{ push; }
1236
1276
break;
1237
1277
case 15:
1238
 
#line 290 "parse.yacc"
 
1278
#line 300 "parse.yacc"
1239
1279
{
1240
1280
                            defaults_matches = user_matches;
1241
1281
                            pop;
1242
1282
                        }
1243
1283
break;
1244
1284
case 16:
1245
 
#line 294 "parse.yacc"
 
1285
#line 304 "parse.yacc"
1246
1286
{ push; }
1247
1287
break;
1248
1288
case 17:
1249
 
#line 294 "parse.yacc"
 
1289
#line 304 "parse.yacc"
1250
1290
{
1251
1291
                            defaults_matches = yyvsp[0].BOOLEAN == TRUE;
1252
1292
                            pop;
1253
1293
                        }
1254
1294
break;
1255
1295
case 18:
1256
 
#line 298 "parse.yacc"
 
1296
#line 308 "parse.yacc"
1257
1297
{ push; }
1258
1298
break;
1259
1299
case 19:
1260
 
#line 298 "parse.yacc"
 
1300
#line 308 "parse.yacc"
1261
1301
{
1262
1302
                            defaults_matches = host_matches;
1263
1303
                            pop;
1264
1304
                        }
1265
1305
break;
1266
1306
case 22:
1267
 
#line 308 "parse.yacc"
 
1307
#line 318 "parse.yacc"
1268
1308
{
1269
1309
                            if (defaults_matches == TRUE &&
1270
1310
                                !set_default(yyvsp[0].string, NULL, TRUE)) {
1275
1315
                        }
1276
1316
break;
1277
1317
case 23:
1278
 
#line 316 "parse.yacc"
 
1318
#line 326 "parse.yacc"
1279
1319
{
1280
1320
                            if (defaults_matches == TRUE &&
1281
1321
                                !set_default(yyvsp[0].string, NULL, FALSE)) {
1286
1326
                        }
1287
1327
break;
1288
1328
case 24:
1289
 
#line 324 "parse.yacc"
 
1329
#line 334 "parse.yacc"
1290
1330
{
1291
1331
                            if (defaults_matches == TRUE &&
1292
1332
                                !set_default(yyvsp[-2].string, yyvsp[0].string, TRUE)) {
1298
1338
                        }
1299
1339
break;
1300
1340
case 25:
1301
 
#line 333 "parse.yacc"
 
1341
#line 343 "parse.yacc"
1302
1342
{
1303
1343
                            if (defaults_matches == TRUE &&
1304
1344
                                !set_default(yyvsp[-2].string, yyvsp[0].string, '+')) {
1310
1350
                        }
1311
1351
break;
1312
1352
case 26:
1313
 
#line 342 "parse.yacc"
 
1353
#line 352 "parse.yacc"
1314
1354
{
1315
1355
                            if (defaults_matches == TRUE &&
1316
1356
                                !set_default(yyvsp[-2].string, yyvsp[0].string, '-')) {
1322
1362
                        }
1323
1363
break;
1324
1364
case 29:
1325
 
#line 357 "parse.yacc"
 
1365
#line 367 "parse.yacc"
1326
1366
{
1327
1367
                            /*
1328
1368
                             * We already did a push if necessary in
1329
1369
                             * cmndspec so just reset some values so
1330
1370
                             * the next 'privilege' gets a clean slate.
1331
1371
                             */
1332
 
                            host_matches = -1;
1333
 
                            runas_matches = -1;
1334
 
                            if (def_flag(I_AUTHENTICATE))
1335
 
                                no_passwd = -1;
1336
 
                            else
1337
 
                                no_passwd = TRUE;
 
1372
                            host_matches = UNSPEC;
 
1373
                            runas_matches = UNSPEC;
 
1374
                            no_passwd = def_authenticate ? UNSPEC : TRUE;
 
1375
                            no_execve = def_noexec ? TRUE : UNSPEC;
1338
1376
                        }
1339
1377
break;
1340
1378
case 30:
1341
 
#line 372 "parse.yacc"
 
1379
#line 380 "parse.yacc"
1342
1380
{
1343
 
                            if (yyvsp[0].BOOLEAN != -1)
1344
 
                                host_matches = yyvsp[0].BOOLEAN;
 
1381
                            SETMATCH(host_matches, yyvsp[0].BOOLEAN);
1345
1382
                        }
1346
1383
break;
1347
1384
case 31:
1348
 
#line 376 "parse.yacc"
 
1385
#line 383 "parse.yacc"
1349
1386
{
1350
 
                            if (yyvsp[0].BOOLEAN != -1)
1351
 
                                host_matches = ! yyvsp[0].BOOLEAN;
 
1387
                            SETNMATCH(host_matches, yyvsp[0].BOOLEAN);
1352
1388
                        }
1353
1389
break;
1354
1390
case 32:
1355
 
#line 382 "parse.yacc"
 
1391
#line 388 "parse.yacc"
1356
1392
{
1357
1393
                            yyval.BOOLEAN = TRUE;
1358
1394
                        }
1359
1395
break;
1360
1396
case 33:
1361
 
#line 385 "parse.yacc"
 
1397
#line 391 "parse.yacc"
1362
1398
{
1363
1399
                            if (addr_matches(yyvsp[0].string))
1364
1400
                                yyval.BOOLEAN = TRUE;
1365
1401
                            else
1366
 
                                yyval.BOOLEAN = -1;
 
1402
                                yyval.BOOLEAN = NOMATCH;
1367
1403
                            free(yyvsp[0].string);
1368
1404
                        }
1369
1405
break;
1370
1406
case 34:
1371
 
#line 392 "parse.yacc"
 
1407
#line 398 "parse.yacc"
1372
1408
{
1373
1409
                            if (netgr_matches(yyvsp[0].string, user_host, user_shost, NULL))
1374
1410
                                yyval.BOOLEAN = TRUE;
1375
1411
                            else
1376
 
                                yyval.BOOLEAN = -1;
 
1412
                                yyval.BOOLEAN = NOMATCH;
1377
1413
                            free(yyvsp[0].string);
1378
1414
                        }
1379
1415
break;
1380
1416
case 35:
1381
 
#line 399 "parse.yacc"
 
1417
#line 405 "parse.yacc"
1382
1418
{
1383
1419
                            if (hostname_matches(user_shost, user_host, yyvsp[0].string) == 0)
1384
1420
                                yyval.BOOLEAN = TRUE;
1385
1421
                            else
1386
 
                                yyval.BOOLEAN = -1;
 
1422
                                yyval.BOOLEAN = NOMATCH;
1387
1423
                            free(yyvsp[0].string);
1388
1424
                        }
1389
1425
break;
1390
1426
case 36:
1391
 
#line 406 "parse.yacc"
 
1427
#line 412 "parse.yacc"
1392
1428
{
1393
1429
                            aliasinfo *aip = find_alias(yyvsp[0].string, HOST_ALIAS);
1394
1430
 
1407
1443
                                        YYERROR;
1408
1444
                                    }
1409
1445
                                }
1410
 
                                yyval.BOOLEAN = -1;
 
1446
                                yyval.BOOLEAN = NOMATCH;
1411
1447
                            }
1412
1448
                            free(yyvsp[0].string);
1413
1449
                        }
1414
1450
break;
1415
1451
case 39:
1416
 
#line 434 "parse.yacc"
 
1452
#line 440 "parse.yacc"
1417
1453
{
1418
1454
                            /*
1419
1455
                             * Push the entry onto the stack if it is worth
1420
 
                             * saving and clear cmnd_matches for next cmnd.
 
1456
                             * saving and reset cmnd_matches for next cmnd.
1421
1457
                             *
1422
1458
                             * We need to save at least one entry on
1423
1459
                             * the stack so sudoers_lookup() can tell that
1428
1464
                             * If keepall is set and the user matches then
1429
1465
                             * we need to keep entries around too...
1430
1466
                             */
1431
 
                            if (user_matches != -1 && host_matches != -1 &&
1432
 
                                cmnd_matches != -1 && runas_matches != -1)
 
1467
                            if (MATCHED(user_matches) &&
 
1468
                                MATCHED(host_matches) &&
 
1469
                                MATCHED(cmnd_matches) &&
 
1470
                                MATCHED(runas_matches))
1433
1471
                                pushcp;
1434
 
                            else if (user_matches != -1 && (top == 1 ||
1435
 
                                (top == 2 && host_matches != -1 &&
1436
 
                                match[0].host == -1)))
 
1472
                            else if (MATCHED(user_matches) && (top == 1 ||
 
1473
                                (top == 2 && MATCHED(host_matches) &&
 
1474
                                !MATCHED(match[0].host))))
1437
1475
                                pushcp;
1438
1476
                            else if (user_matches == TRUE && keepall)
1439
1477
                                pushcp;
1440
 
                            cmnd_matches = -1;
 
1478
                            cmnd_matches = UNSPEC;
1441
1479
                        }
1442
1480
break;
1443
1481
case 40:
1444
 
#line 461 "parse.yacc"
 
1482
#line 469 "parse.yacc"
1445
1483
{
1446
 
                            if (yyvsp[0].BOOLEAN != -1)
1447
 
                                cmnd_matches = yyvsp[0].BOOLEAN;
 
1484
                            SETMATCH(cmnd_matches, yyvsp[0].BOOLEAN);
1448
1485
                        }
1449
1486
break;
1450
1487
case 41:
1451
 
#line 465 "parse.yacc"
 
1488
#line 472 "parse.yacc"
1452
1489
{
1453
1490
                            if (printmatches == TRUE) {
1454
1491
                                if (in_alias == TRUE)
1460
1497
                        }
1461
1498
break;
1462
1499
case 42:
1463
 
#line 473 "parse.yacc"
 
1500
#line 480 "parse.yacc"
1464
1501
{
1465
 
                            if (yyvsp[0].BOOLEAN != -1)
1466
 
                                cmnd_matches = ! yyvsp[0].BOOLEAN;
 
1502
                            SETNMATCH(cmnd_matches, yyvsp[0].BOOLEAN);
1467
1503
                        }
1468
1504
break;
1469
1505
case 43:
1470
 
#line 479 "parse.yacc"
 
1506
#line 485 "parse.yacc"
1471
1507
{
1472
1508
                            if (printmatches == TRUE && host_matches == TRUE &&
1473
1509
                                user_matches == TRUE) {
1474
 
                                if (runas_matches == -1) {
 
1510
                                if (runas_matches == UNSPEC) {
1475
1511
                                    cm_list[cm_list_len].runas_len = 0;
1476
1512
                                } else {
1477
1513
                                    /* Inherit runas data. */
1487
1523
                             * If this is the first entry in a command list
1488
1524
                             * then check against default runas user.
1489
1525
                             */
1490
 
                            if (runas_matches == -1)
1491
 
                                runas_matches = (strcmp(*user_runas,
1492
 
                                    def_str(I_RUNAS_DEFAULT)) == 0);
 
1526
                            if (runas_matches == UNSPEC) {
 
1527
                                runas_matches =
 
1528
                                    userpw_matches(def_runas_default,
 
1529
                                        *user_runas, runas_pw);
 
1530
                            }
1493
1531
                        }
1494
1532
break;
1495
1533
case 44:
1496
 
#line 502 "parse.yacc"
 
1534
#line 510 "parse.yacc"
1497
1535
{
1498
 
                            runas_matches = (yyvsp[0].BOOLEAN == TRUE ? TRUE : FALSE);
 
1536
                            runas_matches = yyvsp[0].BOOLEAN;
1499
1537
                        }
1500
1538
break;
1501
1539
case 45:
1502
 
#line 507 "parse.yacc"
 
1540
#line 515 "parse.yacc"
1503
1541
{ ; }
1504
1542
break;
1505
1543
case 46:
1506
 
#line 508 "parse.yacc"
 
1544
#line 516 "parse.yacc"
1507
1545
{
1508
1546
                            /* Later entries override earlier ones. */
1509
 
                            if (yyvsp[0].BOOLEAN != -1)
 
1547
                            if (yyvsp[0].BOOLEAN != NOMATCH)
1510
1548
                                yyval.BOOLEAN = yyvsp[0].BOOLEAN;
1511
1549
                            else
1512
1550
                                yyval.BOOLEAN = yyvsp[-2].BOOLEAN;
1513
1551
                        }
1514
1552
break;
1515
1553
case 47:
1516
 
#line 517 "parse.yacc"
 
1554
#line 525 "parse.yacc"
1517
1555
{ ; }
1518
1556
break;
1519
1557
case 48:
1520
 
#line 518 "parse.yacc"
 
1558
#line 526 "parse.yacc"
1521
1559
{
1522
1560
                            if (printmatches == TRUE) {
1523
1561
                                if (in_alias == TRUE)
1529
1567
                        }
1530
1568
break;
1531
1569
case 49:
1532
 
#line 526 "parse.yacc"
 
1570
#line 534 "parse.yacc"
1533
1571
{
1534
1572
                            /* Set $$ to the negation of runasuser */
1535
 
                            yyval.BOOLEAN = (yyvsp[0].BOOLEAN == -1 ? -1 : ! yyvsp[0].BOOLEAN);
 
1573
                            yyval.BOOLEAN = (yyvsp[0].BOOLEAN == NOMATCH ? NOMATCH : ! yyvsp[0].BOOLEAN);
1536
1574
                        }
1537
1575
break;
1538
1576
case 50:
1539
 
#line 532 "parse.yacc"
 
1577
#line 540 "parse.yacc"
1540
1578
{
1541
1579
                            if (printmatches == TRUE) {
1542
1580
                                if (in_alias == TRUE)
1545
1583
                                    user_matches == TRUE)
1546
1584
                                    append_runas(yyvsp[0].string, ", ");
1547
1585
                            }
1548
 
                            if (strcmp(yyvsp[0].string, *user_runas) == 0)
 
1586
                            if (userpw_matches(yyvsp[0].string, *user_runas, runas_pw))
1549
1587
                                yyval.BOOLEAN = TRUE;
1550
1588
                            else
1551
 
                                yyval.BOOLEAN = -1;
 
1589
                                yyval.BOOLEAN = NOMATCH;
1552
1590
                            free(yyvsp[0].string);
 
1591
                            used_runas = TRUE;
1553
1592
                        }
1554
1593
break;
1555
1594
case 51:
1556
 
#line 546 "parse.yacc"
 
1595
#line 555 "parse.yacc"
1557
1596
{
1558
1597
                            if (printmatches == TRUE) {
1559
1598
                                if (in_alias == TRUE)
1562
1601
                                    user_matches == TRUE)
1563
1602
                                    append_runas(yyvsp[0].string, ", ");
1564
1603
                            }
1565
 
                            if (usergr_matches(yyvsp[0].string, *user_runas))
 
1604
                            if (usergr_matches(yyvsp[0].string, *user_runas, runas_pw))
1566
1605
                                yyval.BOOLEAN = TRUE;
1567
1606
                            else
1568
 
                                yyval.BOOLEAN = -1;
 
1607
                                yyval.BOOLEAN = NOMATCH;
1569
1608
                            free(yyvsp[0].string);
 
1609
                            used_runas = TRUE;
1570
1610
                        }
1571
1611
break;
1572
1612
case 52:
1573
 
#line 560 "parse.yacc"
 
1613
#line 570 "parse.yacc"
1574
1614
{
1575
1615
                            if (printmatches == TRUE) {
1576
1616
                                if (in_alias == TRUE)
1582
1622
                            if (netgr_matches(yyvsp[0].string, NULL, NULL, *user_runas))
1583
1623
                                yyval.BOOLEAN = TRUE;
1584
1624
                            else
1585
 
                                yyval.BOOLEAN = -1;
 
1625
                                yyval.BOOLEAN = NOMATCH;
1586
1626
                            free(yyvsp[0].string);
 
1627
                            used_runas = TRUE;
1587
1628
                        }
1588
1629
break;
1589
1630
case 53:
1590
 
#line 574 "parse.yacc"
 
1631
#line 585 "parse.yacc"
1591
1632
{
1592
1633
                            aliasinfo *aip = find_alias(yyvsp[0].string, RUNAS_ALIAS);
1593
1634
 
1613
1654
                                        YYERROR;
1614
1655
                                    }
1615
1656
                                }
1616
 
                                yyval.BOOLEAN = -1;
 
1657
                                yyval.BOOLEAN = NOMATCH;
1617
1658
                            }
1618
1659
                            free(yyvsp[0].string);
 
1660
                            used_runas = TRUE;
1619
1661
                        }
1620
1662
break;
1621
1663
case 54:
1622
 
#line 603 "parse.yacc"
 
1664
#line 615 "parse.yacc"
1623
1665
{
1624
1666
                            if (printmatches == TRUE) {
1625
1667
                                if (in_alias == TRUE)
1632
1674
                        }
1633
1675
break;
1634
1676
case 55:
1635
 
#line 615 "parse.yacc"
 
1677
#line 627 "parse.yacc"
1636
1678
{
1637
 
                            /* Inherit NOPASSWD/PASSWD status. */
 
1679
                            /* Inherit {NOPASSWD,PASSWD,NOEXEC,EXEC} status. */
1638
1680
                            if (printmatches == TRUE && host_matches == TRUE &&
1639
1681
                                user_matches == TRUE) {
1640
1682
                                if (no_passwd == TRUE)
1641
1683
                                    cm_list[cm_list_len].nopasswd = TRUE;
1642
1684
                                else
1643
1685
                                    cm_list[cm_list_len].nopasswd = FALSE;
 
1686
                                if (no_execve == TRUE)
 
1687
                                    cm_list[cm_list_len].noexecve = TRUE;
 
1688
                                else
 
1689
                                    cm_list[cm_list_len].noexecve = FALSE;
1644
1690
                            }
1645
1691
                        }
1646
1692
break;
1647
1693
case 56:
1648
 
#line 625 "parse.yacc"
 
1694
#line 641 "parse.yacc"
1649
1695
{
1650
1696
                            no_passwd = TRUE;
1651
1697
                            if (printmatches == TRUE && host_matches == TRUE &&
1654
1700
                        }
1655
1701
break;
1656
1702
case 57:
1657
 
#line 631 "parse.yacc"
 
1703
#line 647 "parse.yacc"
1658
1704
{
1659
1705
                            no_passwd = FALSE;
1660
1706
                            if (printmatches == TRUE && host_matches == TRUE &&
1663
1709
                        }
1664
1710
break;
1665
1711
case 58:
1666
 
#line 639 "parse.yacc"
 
1712
#line 653 "parse.yacc"
 
1713
{
 
1714
                            no_execve = TRUE;
 
1715
                            if (printmatches == TRUE && host_matches == TRUE &&
 
1716
                                user_matches == TRUE)
 
1717
                                cm_list[cm_list_len].noexecve = TRUE;
 
1718
                        }
 
1719
break;
 
1720
case 59:
 
1721
#line 659 "parse.yacc"
 
1722
{
 
1723
                            no_execve = FALSE;
 
1724
                            if (printmatches == TRUE && host_matches == TRUE &&
 
1725
                                user_matches == TRUE)
 
1726
                                cm_list[cm_list_len].noexecve = FALSE;
 
1727
                        }
 
1728
break;
 
1729
case 60:
 
1730
#line 667 "parse.yacc"
1667
1731
{
1668
1732
                            if (printmatches == TRUE) {
1669
1733
                                if (in_alias == TRUE)
1682
1746
                            safe_cmnd = estrdup(user_cmnd);
1683
1747
                        }
1684
1748
break;
1685
 
case 59:
1686
 
#line 656 "parse.yacc"
 
1749
case 61:
 
1750
#line 684 "parse.yacc"
1687
1751
{
1688
1752
                            aliasinfo *aip;
1689
1753
 
1709
1773
                                        YYERROR;
1710
1774
                                    }
1711
1775
                                }
1712
 
                                yyval.BOOLEAN = -1;
 
1776
                                yyval.BOOLEAN = NOMATCH;
1713
1777
                            }
1714
1778
                            free(yyvsp[0].string);
1715
1779
                        }
1716
1780
break;
1717
 
case 60:
1718
 
#line 685 "parse.yacc"
 
1781
case 62:
 
1782
#line 713 "parse.yacc"
1719
1783
{
1720
1784
                            if (printmatches == TRUE) {
1721
1785
                                if (in_alias == TRUE) {
1732
1796
                                }
1733
1797
                            }
1734
1798
 
1735
 
                            if (command_matches(user_cmnd, user_args,
1736
 
                                yyvsp[0].command.cmnd, yyvsp[0].command.args))
 
1799
                            if (command_matches(yyvsp[0].command.cmnd, yyvsp[0].command.args))
1737
1800
                                yyval.BOOLEAN = TRUE;
1738
1801
                            else
1739
 
                                yyval.BOOLEAN = -1;
 
1802
                                yyval.BOOLEAN = NOMATCH;
1740
1803
 
1741
1804
                            free(yyvsp[0].command.cmnd);
1742
1805
                            if (yyvsp[0].command.args)
1743
1806
                                free(yyvsp[0].command.args);
1744
1807
                        }
1745
1808
break;
1746
 
case 63:
1747
 
#line 717 "parse.yacc"
 
1809
case 65:
 
1810
#line 744 "parse.yacc"
1748
1811
{ push; }
1749
1812
break;
1750
 
case 64:
1751
 
#line 717 "parse.yacc"
 
1813
case 66:
 
1814
#line 744 "parse.yacc"
1752
1815
{
1753
 
                            if ((host_matches != -1 || pedantic) &&
 
1816
                            if ((MATCHED(host_matches) || pedantic) &&
1754
1817
                                !add_alias(yyvsp[-3].string, HOST_ALIAS, host_matches)) {
1755
1818
                                yyerror(NULL);
1756
1819
                                YYERROR;
1758
1821
                            pop;
1759
1822
                        }
1760
1823
break;
1761
 
case 69:
1762
 
#line 735 "parse.yacc"
 
1824
case 71:
 
1825
#line 762 "parse.yacc"
1763
1826
{
1764
1827
                            push;
1765
1828
                            if (printmatches == TRUE) {
1771
1834
                             }
1772
1835
                        }
1773
1836
break;
1774
 
case 70:
1775
 
#line 744 "parse.yacc"
 
1837
case 72:
 
1838
#line 771 "parse.yacc"
1776
1839
{
1777
 
                            if ((cmnd_matches != -1 || pedantic) &&
 
1840
                            if ((MATCHED(cmnd_matches) || pedantic) &&
1778
1841
                                !add_alias(yyvsp[-3].string, CMND_ALIAS, cmnd_matches)) {
1779
1842
                                yyerror(NULL);
1780
1843
                                YYERROR;
1786
1849
                                in_alias = FALSE;
1787
1850
                        }
1788
1851
break;
1789
 
case 71:
1790
 
#line 758 "parse.yacc"
 
1852
case 73:
 
1853
#line 785 "parse.yacc"
1791
1854
{ ; }
1792
1855
break;
1793
 
case 75:
1794
 
#line 766 "parse.yacc"
 
1856
case 77:
 
1857
#line 793 "parse.yacc"
1795
1858
{
1796
1859
                            if (printmatches == TRUE) {
1797
1860
                                in_alias = TRUE;
1802
1865
                            }
1803
1866
                        }
1804
1867
break;
1805
 
case 76:
1806
 
#line 774 "parse.yacc"
 
1868
case 78:
 
1869
#line 801 "parse.yacc"
1807
1870
{
1808
 
                            if ((yyvsp[0].BOOLEAN != -1 || pedantic) &&
 
1871
                            if ((yyvsp[0].BOOLEAN != NOMATCH || pedantic) &&
1809
1872
                                !add_alias(yyvsp[-3].string, RUNAS_ALIAS, yyvsp[0].BOOLEAN)) {
1810
1873
                                yyerror(NULL);
1811
1874
                                YYERROR;
1816
1879
                                in_alias = FALSE;
1817
1880
                        }
1818
1881
break;
1819
 
case 79:
1820
 
#line 791 "parse.yacc"
 
1882
case 81:
 
1883
#line 818 "parse.yacc"
1821
1884
{ push; }
1822
1885
break;
1823
 
case 80:
1824
 
#line 791 "parse.yacc"
 
1886
case 82:
 
1887
#line 818 "parse.yacc"
1825
1888
{
1826
 
                            if ((user_matches != -1 || pedantic) &&
 
1889
                            if ((MATCHED(user_matches) || pedantic) &&
1827
1890
                                !add_alias(yyvsp[-3].string, USER_ALIAS, user_matches)) {
1828
1891
                                yyerror(NULL);
1829
1892
                                YYERROR;
1832
1895
                            free(yyvsp[-3].string);
1833
1896
                        }
1834
1897
break;
1835
 
case 83:
1836
 
#line 806 "parse.yacc"
1837
 
{
1838
 
                            if (yyvsp[0].BOOLEAN != -1)
1839
 
                                user_matches = yyvsp[0].BOOLEAN;
1840
 
                        }
1841
 
break;
1842
 
case 84:
1843
 
#line 810 "parse.yacc"
1844
 
{
1845
 
                            if (yyvsp[0].BOOLEAN != -1)
1846
 
                                user_matches = ! yyvsp[0].BOOLEAN;
1847
 
                        }
1848
 
break;
1849
1898
case 85:
1850
 
#line 816 "parse.yacc"
 
1899
#line 833 "parse.yacc"
1851
1900
{
1852
 
                            if (strcmp(yyvsp[0].string, user_name) == 0)
1853
 
                                yyval.BOOLEAN = TRUE;
1854
 
                            else
1855
 
                                yyval.BOOLEAN = -1;
1856
 
                            free(yyvsp[0].string);
 
1901
                            SETMATCH(user_matches, yyvsp[0].BOOLEAN);
1857
1902
                        }
1858
1903
break;
1859
1904
case 86:
1860
 
#line 823 "parse.yacc"
 
1905
#line 836 "parse.yacc"
1861
1906
{
1862
 
                            if (usergr_matches(yyvsp[0].string, user_name))
1863
 
                                yyval.BOOLEAN = TRUE;
1864
 
                            else
1865
 
                                yyval.BOOLEAN = -1;
1866
 
                            free(yyvsp[0].string);
 
1907
                            SETNMATCH(user_matches, yyvsp[0].BOOLEAN);
1867
1908
                        }
1868
1909
break;
1869
1910
case 87:
1870
 
#line 830 "parse.yacc"
 
1911
#line 841 "parse.yacc"
 
1912
{
 
1913
                            if (userpw_matches(yyvsp[0].string, user_name, sudo_user.pw))
 
1914
                                yyval.BOOLEAN = TRUE;
 
1915
                            else
 
1916
                                yyval.BOOLEAN = NOMATCH;
 
1917
                            free(yyvsp[0].string);
 
1918
                        }
 
1919
break;
 
1920
case 88:
 
1921
#line 848 "parse.yacc"
 
1922
{
 
1923
                            if (usergr_matches(yyvsp[0].string, user_name, sudo_user.pw))
 
1924
                                yyval.BOOLEAN = TRUE;
 
1925
                            else
 
1926
                                yyval.BOOLEAN = NOMATCH;
 
1927
                            free(yyvsp[0].string);
 
1928
                        }
 
1929
break;
 
1930
case 89:
 
1931
#line 855 "parse.yacc"
1871
1932
{
1872
1933
                            if (netgr_matches(yyvsp[0].string, NULL, NULL, user_name))
1873
1934
                                yyval.BOOLEAN = TRUE;
1874
1935
                            else
1875
 
                                yyval.BOOLEAN = -1;
 
1936
                                yyval.BOOLEAN = NOMATCH;
1876
1937
                            free(yyvsp[0].string);
1877
1938
                        }
1878
1939
break;
1879
 
case 88:
1880
 
#line 837 "parse.yacc"
 
1940
case 90:
 
1941
#line 862 "parse.yacc"
1881
1942
{
1882
1943
                            aliasinfo *aip = find_alias(yyvsp[0].string, USER_ALIAS);
1883
1944
 
1896
1957
                                        YYERROR;
1897
1958
                                    }
1898
1959
                                }
1899
 
                                yyval.BOOLEAN = -1;
 
1960
                                yyval.BOOLEAN = NOMATCH;
1900
1961
                            }
1901
1962
                            free(yyvsp[0].string);
1902
1963
                        }
1903
1964
break;
1904
 
case 89:
1905
 
#line 859 "parse.yacc"
 
1965
case 91:
 
1966
#line 884 "parse.yacc"
1906
1967
{
1907
1968
                            yyval.BOOLEAN = TRUE;
1908
1969
                        }
1909
1970
break;
1910
 
#line 1859 "sudo.tab.c"
 
1971
#line 1920 "sudo.tab.c"
1911
1972
    }
1912
1973
    yyssp -= yym;
1913
1974
    yystate = *yyssp;
1960
2021
yyoverflow:
1961
2022
    yyerror("yacc stack overflow");
1962
2023
yyabort:
 
2024
    if (yyss)
 
2025
            free(yyss);
 
2026
    if (yyvs)
 
2027
            free(yyvs);
 
2028
    yyss = yyssp = NULL;
 
2029
    yyvs = yyvsp = NULL;
 
2030
    yystacksize = 0;
1963
2031
    return (1);
1964
2032
yyaccept:
 
2033
    if (yyss)
 
2034
            free(yyss);
 
2035
    if (yyvs)
 
2036
            free(yyvs);
 
2037
    yyss = yyssp = NULL;
 
2038
    yyvs = yyvsp = NULL;
 
2039
    yystacksize = 0;
1965
2040
    return (0);
1966
2041
}