]> granicus.if.org Git - sudo/commitdiff
Move endpwent() to be after set_perms(PERM_RUNAS, ...) and also call
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 12 Mar 2002 03:19:04 +0000 (03:19 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 12 Mar 2002 03:19:04 +0000 (03:19 +0000)
endgrent() at the same time.

sudo.c

diff --git a/sudo.c b/sudo.c
index 39ef205be46842eefedb5ef4f1088caedd74c29d..b216d8a1898c962696821202c4cb6d027365b058 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -370,9 +370,6 @@ main(argc, argv, envp)
        (void) sigaction(SIGQUIT, &sa, NULL);
        (void) sigaction(SIGTSTP, &sa, NULL);
 
-       /* Close the password file */
-       endpwent();
-
        /* Override user's umask if configured to do so. */
        if (def_ival(I_UMASK) != 0777)
            (void) umask(def_mode(I_UMASK));
@@ -385,6 +382,10 @@ main(argc, argv, envp)
        /* Become specified user or root. */
        set_perms(PERM_RUNAS, sudo_mode);
 
+       /* Close the password and group files */
+       endpwent();
+       endgrent();
+
        /* Install the new environment. */
        environ = new_environ;