* src/newgrp.c: Close the databases before changing the UDI and

GID.
This commit is contained in:
nekral-guest 2009-04-26 17:11:38 +00:00
parent 5766499b85
commit 8f78169a52
2 changed files with 18 additions and 7 deletions

View File

@ -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.

View 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.