]> granicus.if.org Git - sudo/commitdiff
Rewind sudoers_fp in open_sudoers() instead of sudoers_lookup() so
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Sep 2004 17:52:59 +0000 (17:52 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Sep 2004 17:52:59 +0000 (17:52 +0000)
we start at the right file position when reading include files.

parse.c
sudo.c

diff --git a/parse.c b/parse.c
index a7f214cf5014f1bc320fac5f806ca7fdb899a22d..f6abd1329c6dc419e775daab50faacdd0c0dfc8f 100644 (file)
--- 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 57a8b2e60f6cc2ad10272d445a450d1fa3e8cee1..e63dc5f3139dac10480860ecb34a1f3057e98507 100644 (file)
--- 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);
     }