[Pkg-shadow-commits] r2814 - in upstream/trunk: . src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sun Apr 26 17:11:38 UTC 2009


Author: nekral-guest
Date: 2009-04-26 17:11:38 +0000 (Sun, 26 Apr 2009)
New Revision: 2814

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/newgrp.c
Log:
	* src/newgrp.c: Close the databases before changing the UDI and
	GID.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-04-26 17:10:49 UTC (rev 2813)
+++ upstream/trunk/ChangeLog	2009-04-26 17:11:38 UTC (rev 2814)
@@ -1,5 +1,10 @@
 2009-04-26  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/newgrp.c: Close the databases before changing the UDI and
+	GID.
+
+2009-04-26  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* libmisc/myname.c: Updated splint annotations.
 
 2009-04-26  Nicolas François  <nicolas.francois at centraliens.net>

Modified: upstream/trunk/src/newgrp.c
===================================================================
--- upstream/trunk/src/newgrp.c	2009-04-26 17:10:49 UTC (rev 2813)
+++ upstream/trunk/src/newgrp.c	2009-04-26 17:11:38 UTC (rev 2814)
@@ -672,6 +672,19 @@
 #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
 	 * new group id.
@@ -750,13 +763,6 @@
 	 */
 	cp = Basename ((char *) prog);
 
-	endspent ();
-#ifdef	SHADOWGRP
-	endsgent ();
-#endif
-	endpwent ();
-	endgrent ();
-
 	/*
 	 * Switch back to her home directory if i am doing login
 	 * initialization.




More information about the Pkg-shadow-commits mailing list