Imported Upstream version 1.6.9p9
[debian/sudo] / parse.yacc
index 7684fb89aa38718a0ebcbe028134dc1f824ceeec..4137d8197bed164a01f863d5345d1243d710a60a 100644 (file)
@@ -69,7 +69,7 @@
 #endif /* HAVE_LSEARCH */
 
 #ifndef lint
-__unused static const char rcsid[] = "$Sudo: parse.yacc,v 1.204.2.8 2007/11/02 19:09:01 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: parse.yacc,v 1.204.2.9 2007/11/21 18:15:49 millert Exp $";
 #endif /* lint */
 
 /*
@@ -104,6 +104,9 @@ int used_runas = FALSE;
            (_var) = NOMATCH; \
 } while (0)
 
+#define        SETENV_RESET \
+       if (setenv_ok == IMPLIED) setenv_ok = def_setenv ? TRUE : UNSPEC
+
 /*
  * The matching stack, initial space allocated in init_parser().
  */
@@ -440,7 +443,7 @@ cmndspeclist        :       cmndspec
                |       cmndspeclist ',' cmndspec
                ;
 
-cmndspec       :       runasspec cmndtag opcmnd {
+cmndspec       :       { SETENV_RESET; } runasspec cmndtag opcmnd {
                            /*
                             * Push the entry onto the stack if it is worth
                             * saving and reset cmnd_matches for next cmnd.
@@ -692,6 +695,9 @@ cmnd                :       ALL {
                                    expand_match_list();
                                }
                            }
+                           /* sudo "ALL" implies the SETENV tag */
+                           if (setenv_ok == UNSPEC)
+                               setenv_ok = IMPLIED;
 
                            efree(safe_cmnd);
                            safe_cmnd = NULL;