From 4b75a03343bf3964b5d761390b8c7129504df4fc Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 28 Sep 2004 17:52:59 +0000 Subject: [PATCH] Rewind sudoers_fp in open_sudoers() instead of sudoers_lookup() so we start at the right file position when reading include files. --- parse.c | 2 -- sudo.c | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/parse.c b/parse.c index a7f214cf5..f6abd1329 100644 --- a/parse.c +++ b/parse.c @@ -109,8 +109,6 @@ sudoers_lookup(pwflag) int error, nopass; enum def_tupple pwcheck; - /* We opened _PATH_SUDOERS in check_sudoers() so just rewind it. */ - rewind(sudoers_fp); yyin = sudoers_fp; yyout = stdout; diff --git a/sudo.c b/sudo.c index 57a8b2e60..e63dc5f31 100644 --- a/sudo.c +++ b/sudo.c @@ -848,8 +848,8 @@ parse_args(argc, argv) } /* - * Sanity check sudoers mode/owner/type. - * Leaves a file pointer to the sudoers file open in ``fp''. + * Open sudoers and sanity check mode/owner/type. + * Returns a handle to the sudoers file. */ FILE * open_sudoers(sudoers) @@ -919,6 +919,7 @@ open_sudoers(sudoers) } if (fp == NULL) log_error(USE_ERRNO, "can't open %s", sudoers); + rewind(fp); (void) fcntl(fileno(fp), F_SETFD, 1); } -- 2.40.0