Rewind sudoers_fp in open_sudoers() instead of sudoers_lookup() so

we start at the right file position when reading include files.
This commit is contained in:
Todd C. Miller
2004-09-28 17:52:59 +00:00
parent fbb62c6805
commit 4b75a03343
2 changed files with 3 additions and 4 deletions

View File

@@ -109,8 +109,6 @@ sudoers_lookup(pwflag)
int error, nopass; int error, nopass;
enum def_tupple pwcheck; enum def_tupple pwcheck;
/* We opened _PATH_SUDOERS in check_sudoers() so just rewind it. */
rewind(sudoers_fp);
yyin = sudoers_fp; yyin = sudoers_fp;
yyout = stdout; yyout = stdout;

5
sudo.c
View File

@@ -848,8 +848,8 @@ parse_args(argc, argv)
} }
/* /*
* Sanity check sudoers mode/owner/type. * Open sudoers and sanity check mode/owner/type.
* Leaves a file pointer to the sudoers file open in ``fp''. * Returns a handle to the sudoers file.
*/ */
FILE * FILE *
open_sudoers(sudoers) open_sudoers(sudoers)
@@ -919,6 +919,7 @@ open_sudoers(sudoers)
} }
if (fp == NULL) if (fp == NULL)
log_error(USE_ERRNO, "can't open %s", sudoers); log_error(USE_ERRNO, "can't open %s", sudoers);
rewind(fp);
(void) fcntl(fileno(fp), F_SETFD, 1); (void) fcntl(fileno(fp), F_SETFD, 1);
} }