*/
#ifndef lint
-static char rcsid[] = "$Id: sudo.c,v 1.2 1996/11/17 16:34:04 millert Exp $";
+static char rcsid[] = "$Id: sudo.c,v 1.3 1997/04/12 07:18:56 millert Exp $";
#endif /* lint */
#define MAIN
* 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 */
*/
#ifndef lint
-static char rcsid[] = "$Id: visudo.c,v 1.3 1996/11/17 16:34:08 millert Exp $";
+static char rcsid[] = "$Id: visudo.c,v 1.4 1997/04/12 07:18:57 millert Exp $";
#endif /* lint */
#include "config.h"
usage();
/* user_pw_ent needs to point to something... */
- user_pw_ent = getpwuid(getuid());
+ if ((user_pw_ent = getpwuid(getuid())) == NULL) {
+ (void) fprintf(stderr, "%s: Can't find you in the passwd database: ",
+ Argv[0]);
+ perror(stmp);
+ exit(1);
+ }
#ifdef ENV_EDITOR
/*