From: Todd C. Miller Date: Tue, 28 Sep 2004 17:52:59 +0000 (+0000) Subject: Rewind sudoers_fp in open_sudoers() instead of sudoers_lookup() so X-Git-Tag: SUDO_1_7_0~932 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b75a03343bf3964b5d761390b8c7129504df4fc;p=sudo Rewind sudoers_fp in open_sudoers() instead of sudoers_lookup() so we start at the right file position when reading include files. --- 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); }