projects
/
debian
/
sudo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update changelog to reflex new upstream version and associated CVE number
[debian/sudo]
/
toke.c
diff --git
a/toke.c
b/toke.c
index 96eaf51cecc43e7bbc10c6caa281af9b9cf7394c..5f2b6392ccdb6be3188427e203d139d10f58fdd5 100644
(file)
--- a/
toke.c
+++ b/
toke.c
@@
-3,7
+3,7
@@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /home/cvs/
courtesan/sudo/toke.c,v 1.37 2009/07/18 13:55:37 millert
Exp $
+ * $Header: /home/cvs/
openbsd/src/usr.bin/lex/flex.skl,v 1.10 2007/01/26 14:38:19 tsi
Exp $
*/
#define FLEX_SCANNER
*/
#define FLEX_SCANNER
@@
-1416,11
+1416,8
@@
char *yytext;
#include "parse.h"
#include <gram.h>
#include "parse.h"
#include <gram.h>
-#ifndef lint
-__unused static const char rcsid[] = "$Sudo: toke.c,v 1.37 2009/07/18 13:55:37 millert Exp $";
-#endif /* lint */
-
extern YYSTYPE yylval;
extern YYSTYPE yylval;
+extern int parse_error;
int sudolineno = 1;
char *sudoers;
static int sawspace = 0;
int sudolineno = 1;
char *sudoers;
static int sawspace = 0;
@@
-1461,7
+1458,7
@@
extern void yyerror __P((const char *));
#define INSTR 5
#define INSTR 5
-#line 146
5
"lex.yy.c"
+#line 146
2
"lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@
-1615,9
+1612,9
@@
YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 1
31
"toke.l"
+#line 1
28
"toke.l"
-#line 16
21
"lex.yy.c"
+#line 16
18
"lex.yy.c"
if ( yy_init )
{
if ( yy_init )
{
@@
-1703,12
+1700,12
@@
do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
case 1:
YY_RULE_SETUP
-#line 1
32
"toke.l"
+#line 1
29
"toke.l"
BEGIN STARTDEFS;
YY_BREAK
case 2:
YY_RULE_SETUP
BEGIN STARTDEFS;
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 13
4
"toke.l"
+#line 13
1
"toke.l"
{
BEGIN INDEFS;
LEXTRACE("DEFVAR ");
{
BEGIN INDEFS;
LEXTRACE("DEFVAR ");
@@
-1720,7
+1717,7
@@
YY_RULE_SETUP
case 3:
YY_RULE_SETUP
case 3:
YY_RULE_SETUP
-#line 14
3
"toke.l"
+#line 14
0
"toke.l"
{
BEGIN STARTDEFS;
LEXTRACE(", ");
{
BEGIN STARTDEFS;
LEXTRACE(", ");
@@
-1729,7
+1726,7
@@
YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 14
9
"toke.l"
+#line 14
6
"toke.l"
{
LEXTRACE("= ");
return('=');
{
LEXTRACE("= ");
return('=');
@@
-1737,7
+1734,7
@@
YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 15
4
"toke.l"
+#line 15
1
"toke.l"
{
LEXTRACE("+= ");
return('+');
{
LEXTRACE("+= ");
return('+');
@@
-1745,7
+1742,7
@@
YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 15
9
"toke.l"
+#line 15
6
"toke.l"
{
LEXTRACE("-= ");
return('-');
{
LEXTRACE("-= ");
return('-');
@@
-1753,7
+1750,7
@@
YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 16
4
"toke.l"
+#line 16
1
"toke.l"
{
LEXTRACE("BEGINSTR ");
yylval.string = NULL;
{
LEXTRACE("BEGINSTR ");
yylval.string = NULL;
@@
-1762,7
+1759,7
@@
YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 1
70
"toke.l"
+#line 1
67
"toke.l"
{
LEXTRACE("WORD(2) ");
if (!fill(yytext, yyleng))
{
LEXTRACE("WORD(2) ");
if (!fill(yytext, yyleng))
@@
-1774,7
+1771,7
@@
YY_RULE_SETUP
case 9:
YY_RULE_SETUP
case 9:
YY_RULE_SETUP
-#line 17
9
"toke.l"
+#line 17
6
"toke.l"
{
/* Line continuation char followed by newline. */
++sudolineno;
{
/* Line continuation char followed by newline. */
++sudolineno;
@@
-1783,7
+1780,7
@@
YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 18
5
"toke.l"
+#line 18
2
"toke.l"
{
LEXTRACE("ENDSTR ");
BEGIN INDEFS;
{
LEXTRACE("ENDSTR ");
BEGIN INDEFS;
@@
-1792,7
+1789,7
@@
YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 1
91
"toke.l"
+#line 1
88
"toke.l"
{
LEXTRACE("BACKSLASH ");
if (!append(yytext, yyleng))
{
LEXTRACE("BACKSLASH ");
if (!append(yytext, yyleng))
@@
-1801,7
+1798,7
@@
YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 19
7
"toke.l"
+#line 19
4
"toke.l"
{
LEXTRACE("STRBODY ");
if (!append(yytext, yyleng))
{
LEXTRACE("STRBODY ");
if (!append(yytext, yyleng))
@@
-1812,7
+1809,7
@@
YY_RULE_SETUP
case 13:
YY_RULE_SETUP
case 13:
YY_RULE_SETUP
-#line 20
5
"toke.l"
+#line 20
2
"toke.l"
{
/* quoted fnmatch glob char, pass verbatim */
LEXTRACE("QUOTEDCHAR ");
{
/* quoted fnmatch glob char, pass verbatim */
LEXTRACE("QUOTEDCHAR ");
@@
-1823,7
+1820,7
@@
YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 21
3
"toke.l"
+#line 21
0
"toke.l"
{
/* quoted sudoers special char, strip backslash */
LEXTRACE("QUOTEDCHAR ");
{
/* quoted sudoers special char, strip backslash */
LEXTRACE("QUOTEDCHAR ");
@@
-1834,7
+1831,7
@@
YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 2
21
"toke.l"
+#line 2
18
"toke.l"
{
BEGIN INITIAL;
yyless(0);
{
BEGIN INITIAL;
yyless(0);
@@
-1843,7
+1840,7
@@
YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 22
7
"toke.l"
+#line 22
4
"toke.l"
{
LEXTRACE("ARG ");
if (!fill_args(yytext, yyleng, sawspace))
{
LEXTRACE("ARG ");
if (!fill_args(yytext, yyleng, sawspace))
@@
-1854,7
+1851,7
@@
YY_RULE_SETUP
case 17:
YY_RULE_SETUP
case 17:
YY_RULE_SETUP
-#line 23
5
"toke.l"
+#line 23
2
"toke.l"
{
char *path;
{
char *path;
@@
-1870,7
+1867,7
@@
YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 24
8
"toke.l"
+#line 24
5
"toke.l"
{
char *path;
{
char *path;
@@
-1879,8
+1876,11
@@
YY_RULE_SETUP
LEXTRACE("INCLUDEDIR\n");
LEXTRACE("INCLUDEDIR\n");
- /* Push current buffer and switch to include file */
- if (!push_includedir(path))
+ /*
+ * Push current buffer and switch to include file.
+ * We simply ignore empty directories.
+ */
+ if (!push_includedir(path) && parse_error)
yyterminate();
}
YY_BREAK
yyterminate();
}
YY_BREAK
@@
-3369,7
+3369,7
@@
switch_dir(stack, dirpath)
if (!(dir = opendir(dirpath))) {
yyerror(dirpath);
if (!(dir = opendir(dirpath))) {
yyerror(dirpath);
- return(
FALSE
);
+ return(
NULL
);
}
while ((dent = readdir(dir))) {
/* Ignore files that end in '~' or have a '.' in them. */
}
while ((dent = readdir(dir))) {
/* Ignore files that end in '~' or have a '.' in them. */
@@
-3461,7
+3461,7
@@
init_lexer()
efree(pl);
}
efree(istack[idepth].path);
efree(pl);
}
efree(istack[idepth].path);
- if (!istack[idepth].keepopen)
+ if (
idepth &&
!istack[idepth].keepopen)
fclose(istack[idepth].bs->yy_input_file);
yy_delete_buffer(istack[idepth].bs);
}
fclose(istack[idepth].bs->yy_input_file);
yy_delete_buffer(istack[idepth].bs);
}
@@
-3486,7
+3486,7
@@
_push_include(path, isdir)
}
istacksize += SUDOERS_STACK_INCREMENT;
istack = (struct include_stack *) realloc(istack,
}
istacksize += SUDOERS_STACK_INCREMENT;
istack = (struct include_stack *) realloc(istack,
- sizeof(istack) * istacksize);
+ sizeof(
*
istack) * istacksize);
if (istack == NULL) {
yyerror("unable to allocate memory");
return(FALSE);
if (istack == NULL) {
yyerror("unable to allocate memory");
return(FALSE);
@@
-3494,12
+3494,12
@@
_push_include(path, isdir)
}
if (isdir) {
if (!(path = switch_dir(&istack[idepth], path))) {
}
if (isdir) {
if (!(path = switch_dir(&istack[idepth], path))) {
- yyerror(path);
+ /* switch_dir() called yyerror() for us */
return(FALSE);
}
if ((fp = open_sudoers(path, FALSE, &keepopen)) == NULL) {
yyerror(path);
return(FALSE);
}
if ((fp = open_sudoers(path, FALSE, &keepopen)) == NULL) {
yyerror(path);
- return(FALSE); /* XXX - just to go next one
?
*/
+ return(FALSE); /* XXX - just to go next one */
}
} else {
if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) {
}
} else {
if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) {
@@
-3539,7
+3539,7
@@
pop_include()
istack[idepth - 1].more = pl->next;
if ((fp = open_sudoers(pl->path, FALSE, &keepopen)) == NULL) {
yyerror(pl->path);
istack[idepth - 1].more = pl->next;
if ((fp = open_sudoers(pl->path, FALSE, &keepopen)) == NULL) {
yyerror(pl->path);
- return(FALSE); /* XXX - just to go next one
?
*/
+ return(FALSE); /* XXX - just to go next one */
}
efree(sudoers);
sudoers = pl->path;
}
efree(sudoers);
sudoers = pl->path;