From 8356e4bcde688241f246f870c751b2b4cd976092 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 2 Feb 1996 03:30:50 +0000 Subject: [PATCH] COMMAND is now a struct containing the path and args --- parse.yacc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/parse.yacc b/parse.yacc index ac92d73e8..e238d1f24 100644 --- a/parse.yacc +++ b/parse.yacc @@ -96,7 +96,7 @@ int top = 0; /* * Protoypes */ -extern int path_matches __P((char *, char *)); +extern int path_matches __P((char *, char **, char *, char **)); extern int addr_matches __P((char *)); extern int netgr_matches __P((char *, char *, char *)); extern int usergr_matches __P((char *, char *)); @@ -123,6 +123,7 @@ void yyerror(s) %union { char *string; + struct sudo_command command; int tok; } @@ -132,8 +133,8 @@ void yyerror(s) %token NTWKADDR /* w.x.y.z */ %token NETGROUP /* a netgroup (+NAME) */ %token USERGROUP /* a usergroup (*NAME) */ -%token COMMAND /* an absolute pathname + args */ %token NAME /* a mixed-case name */ +%token COMMAND /* an absolute pathname */ %token COMMENT /* comment and/or carriage return */ %token ALL /* ALL keyword */ %token HOSTALIAS /* Host_Alias keyword */ @@ -264,9 +265,14 @@ cmnd : ALL { (void) free($1); } | COMMAND { - if (path_matches(cmnd, $1)) + char **t; + + if (path_matches(cmnd, &NewArgv[1], $1.cmnd, $1.args)) cmnd_matches = TRUE; - (void) free($1); + + (void) free($1.cmnd); + for (t = $1.args; t && *t; t++) + (void) free(*t); } ; -- 2.40.0