From: Todd C. Miller Date: Sun, 23 Nov 1997 18:28:09 +0000 (+0000) Subject: catch the case where the user is not in the passwd file X-Git-Tag: SUDO_1_5_4~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82654611c3b8073c697f8a40186f3bcc432646ed;p=sudo catch the case where the user is not in the passwd file --- diff --git a/visudo.c b/visudo.c index 110b345af..e1e0a0bff 100644 --- a/visudo.c +++ b/visudo.c @@ -156,7 +156,12 @@ int main(argc, argv) 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 /*