version 1.5, 2009/07/19 23:16:29 |
version 1.6, 2009/12/07 18:43:11 |
|
|
#include <gram.h> |
#include <gram.h> |
|
|
#ifndef lint |
#ifndef lint |
__unused static const char rcsid[] = "$Sudo: toke.l,v 1.38 2009/07/18 13:55:37 millert Exp $"; |
__unused static const char rcsid[] = "$Sudo: toke.l,v 1.40 2009/11/22 14:54:04 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
extern YYSTYPE yylval; |
extern YYSTYPE yylval; |
|
extern int parse_error; |
int sudolineno = 1; |
int sudolineno = 1; |
char *sudoers; |
char *sudoers; |
static int sawspace = 0; |
static int sawspace = 0; |
|
|
|
|
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(); |
yyterminate(); |
} |
} |
|
|
|
|
|
|
if (!(dir = opendir(dirpath))) { |
if (!(dir = opendir(dirpath))) { |
yyerror(dirpath); |
yyerror(dirpath); |
return(FALSE); |
return(NULL); |
} |
} |
while ((dent = readdir(dir))) { |
while ((dent = readdir(dir))) { |
/* Ignore files that end in '~' or have a '.' in them. */ |
/* Ignore files that end in '~' or have a '.' in them. */ |
|
|
} |
} |
if (isdir) { |
if (isdir) { |
if (!(path = switch_dir(&istack[idepth], path))) { |
if (!(path = switch_dir(&istack[idepth], path))) { |
yyerror(path); |
/* switch_dir() called yyerror() for us */ |
return(FALSE); |
return(FALSE); |
} |
} |
if ((fp = open_sudoers(path, FALSE, &keepopen)) == NULL) { |
if ((fp = open_sudoers(path, FALSE, &keepopen)) == NULL) { |
yyerror(path); |
yyerror(path); |
return(FALSE); /* XXX - just to go next one? */ |
return(FALSE); /* XXX - just to go next one */ |
} |
} |
} else { |
} else { |
if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) { |
if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) { |
|
|
istack[idepth - 1].more = pl->next; |
istack[idepth - 1].more = pl->next; |
if ((fp = open_sudoers(pl->path, FALSE, &keepopen)) == NULL) { |
if ((fp = open_sudoers(pl->path, FALSE, &keepopen)) == NULL) { |
yyerror(pl->path); |
yyerror(pl->path); |
return(FALSE); /* XXX - just to go next one? */ |
return(FALSE); /* XXX - just to go next one */ |
} |
} |
efree(sudoers); |
efree(sudoers); |
sudoers = pl->path; |
sudoers = pl->path; |