* if necesary. It is assumed that euid is 0 at this point so we
* can read the shadow passwd file if necesary.
*/
- user_pw_ent = sudo_getpwuid(getuid());
- set_perms(PERM_ROOT, sudo_mode);
- set_perms(PERM_USER, sudo_mode);
- if (user_pw_ent == NULL) {
+ if ((user_pw_ent = sudo_getpwuid(getuid())) == NULL) {
/* need to make a fake user_pw_ent */
struct passwd pw_ent;
char pw_name[MAX_UID_T_LEN+1];
exit(1);
}
+ /* Set euid == user and ruid == root */
+ set_perms(PERM_ROOT, sudo_mode);
+ set_perms(PERM_USER, sudo_mode);
+
#ifdef HAVE_TZSET
(void) tzset(); /* set the timezone if applicable */
#endif /* HAVE_TZSET */