]> granicus.if.org Git - shadow/commitdiff
* src/newgrp.c: Close the databases before changing the UDI and
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 26 Apr 2009 17:11:38 +0000 (17:11 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 26 Apr 2009 17:11:38 +0000 (17:11 +0000)
GID.

ChangeLog
src/newgrp.c

index 8915493a2c5037aa15a117d4a143ca32615acde6..c6ce60a4e6dd8e2a21e388d5563593e303c87ead 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-26  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/newgrp.c: Close the databases before changing the UDI and
+       GID.
+
 2009-04-26  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/myname.c: Updated splint annotations.
index 51c2045dafc601c9fc8685c35694b5c894a8f061..e8169b4e56d4538688f2e6b289b43f64c223bb8b 100644 (file)
@@ -671,6 +671,19 @@ int main (int argc, char **argv)
        }
 #endif
 
+       /*
+        * Close all files before changing the user/group IDs.
+        *
+        * The needed structure should have been copied before, or
+        * permission to read the database will be required.
+        */
+       endspent ();
+#ifdef SHADOWGRP
+       endsgent ();
+#endif
+       endpwent ();
+       endgrent ();
+
        /*
         * Set the effective GID to the new group id and the effective UID
         * to the real UID. For root, this also sets the real GID to the
@@ -750,13 +763,6 @@ int main (int argc, char **argv)
         */
        cp = Basename ((char *) prog);
 
-       endspent ();
-#ifdef SHADOWGRP
-       endsgent ();
-#endif
-       endpwent ();
-       endgrent ();
-
        /*
         * Switch back to her home directory if i am doing login
         * initialization.