]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Check for "NONEXISTENT" in "src/pwck.c"
authorJason Franklin <jason.franklin@quoininc.com>
Fri, 8 May 2020 17:20:14 +0000 (13:20 -0400)
committerJason Franklin <jason.franklin@quoininc.com>
Mon, 11 May 2020 13:26:43 +0000 (09:26 -0400)
src/pwck.c

index be404c37fe40c0bdbd368f536ad1309a608f8724..3d494a69d28b58fd876f5ccf907c3133e056bc6a 100644 (file)
@@ -527,12 +527,16 @@ static void check_pw_file (int *errors, bool *changed)
                         * Make sure the home directory exists
                         */
                        if (!quiet && (access (pwd->pw_dir, F_OK) != 0)) {
+                               const char *nonexistent = getdef_str("NONEXISTENT");
+
                                /*
-                                * Home directory doesn't exist, give a warning
+                                * Home directory does not exist, give a warning (unless intentional)
                                 */
-                               printf (_("user '%s': directory '%s' does not exist\n"),
-                                               pwd->pw_name, pwd->pw_dir);
-                               *errors += 1;
+                               if (NULL == nonexistent || strcmp (pwd->pw_dir, nonexistent) != 0) {
+                                       printf (_("user '%s': directory '%s' does not exist\n"),
+                                                       pwd->pw_name, pwd->pw_dir);
+                                       *errors += 1;
+                               }
                        }
                }