]> granicus.if.org Git - sudo/commitdiff
catch the case where the user is not in the passwd file
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 23 Nov 1997 18:28:09 +0000 (18:28 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 23 Nov 1997 18:28:09 +0000 (18:28 +0000)
visudo.c

index 110b345aff59f81072624455807a54b06e8bef7c..e1e0a0bffda24bf2279ef5011c7bedb6671a0a4a 100644 (file)
--- 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
     /*