diff options
author | Todd C. Miller <Todd.Miller@courtesan.com> | 1996-08-09 22:07:51 +0000 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@courtesan.com> | 1996-08-09 22:07:51 +0000 |
commit | 218c9b5cc7d5e4810969b64b319a3302f0de64c0 (patch) | |
tree | 08f532a73fda9cabc2048704e08db4eb797113a8 /parse.c | |
parent | d795f5cfef7db5bb39e7a5b2de2cd5d5f39bb1e0 (diff) | |
download | sudo-218c9b5cc7d5e4810969b64b319a3302f0de64c0.tar.gz |
added support for new `sudo -l' stuff
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -90,6 +90,8 @@ static char rcsid[] = "$Id$"; */ int parse_error = FALSE; extern FILE *yyin, *yyout; +extern struct sudo_match *matches; +extern int printmatches; /* * Prototypes for static (local) functions @@ -97,7 +99,7 @@ extern FILE *yyin, *yyout; static int has_meta __P((char *)); /* - * this routine is called from the sudo.c module and tries to validate + * This routine is called from the sudo.c module and tries to validate * the user, host and command triplet. */ int validate(check_cmnd) @@ -118,13 +120,28 @@ int validate(check_cmnd) yyout = stdout; /* - * need to be root while stat'ing things in the parser. + * Allocate space for matches if printmatches is set. + */ + if (printmatches) { + if ((matches = (struct sudo_match *) + malloc(sizeof(struct sudo_match) * MATCHSTACKSIZE)) == NULL) { + perror("malloc"); + (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); + exit(1); + } + /* XXX - maybe just set sizes to 0??? */ + matches[0].runas = matches[0].cmnd = NULL; + matches[0].nopasswd = FALSE; + } + + /* + * Need to be root while stat'ing things in the parser. */ set_perms(PERM_ROOT); return_code = yyparse(); /* - * don't need to keep this open... + * Don't need to keep this open... */ (void) fclose(sudoers_fp); |