diff --git a/README b/README index cf54ca8e..f3b734d3 100644 --- a/README +++ b/README @@ -70,6 +70,7 @@ Guy Maor Hrvoje Dogan Jakub Hrozek Janos Farkas +Jason Franklin Jay Soffian Jesse Thilo Joey Hess diff --git a/etc/login.defs b/etc/login.defs index a0c3b0d1..2eef4f20 100644 --- a/etc/login.defs +++ b/etc/login.defs @@ -295,7 +295,7 @@ CHFN_AUTH yes # any combination of letters "frwh" (full name, room number, work # phone, home phone). If not defined, no changes are allowed. # For backward compatibility, "yes" = "rwh" and "no" = "frwh". -# +# CHFN_RESTRICT rwh # @@ -384,6 +384,14 @@ CHFN_RESTRICT rwh # DEFAULT_HOME yes +# +# The pwck(8) utility emits a warning for any system account with a home +# directory that does not exist. Some system accounts intentionally do +# not have a home directory. Such accounts may have this string as +# their home directory in /etc/passwd to avoid a spurious warning. +# +NONEXISTENT /nonexistent + # # If this file exists and is readable, login environment will be # read from it. Every line should be in the form name=value. diff --git a/lib/getdef.c b/lib/getdef.c index 00f6abfe..54c31303 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -105,6 +105,7 @@ static struct itemdef def_table[] = { {"MAIL_FILE", NULL}, {"MAX_MEMBERS_PER_GROUP", NULL}, {"MD5_CRYPT_ENAB", NULL}, + {"NONEXISTENT", NULL}, {"PASS_MAX_DAYS", NULL}, {"PASS_MIN_DAYS", NULL}, {"PASS_WARN_AGE", NULL}, diff --git a/man/Makefile.am b/man/Makefile.am index 5d7cc2a4..952a4f8b 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -153,6 +153,7 @@ login_defs_v = \ MD5_CRYPT_ENAB.xml \ MOTD_FILE.xml \ NOLOGINS_FILE.xml \ + NONEXISTENT.xml \ OBSCURE_CHECKS_ENAB.xml \ PASS_ALWAYS_WARN.xml \ PASS_CHANGE_TRIES.xml \ diff --git a/man/login.defs.5.xml b/man/login.defs.5.xml index 9e95da20..bf6c976f 100644 --- a/man/login.defs.5.xml +++ b/man/login.defs.5.xml @@ -67,6 +67,7 @@ + @@ -203,6 +204,7 @@ &MD5_CRYPT_ENAB; &MOTD_FILE; &NOLOGINS_FILE; + &NONEXISTENT; &OBSCURE_CHECKS_ENAB; &PASS_ALWAYS_WARN; &PASS_CHANGE_TRIES; diff --git a/man/login.defs.d/NONEXISTENT.xml b/man/login.defs.d/NONEXISTENT.xml new file mode 100644 index 00000000..2b1f6e47 --- /dev/null +++ b/man/login.defs.d/NONEXISTENT.xml @@ -0,0 +1,41 @@ + + + (string) + + + If a system account intentionally does not have a home directory + that exists, this string can be provided in the /etc/passwd + entry for the account to indicate this. The result is that pwck + will not emit a spurious warning for this account. + + + diff --git a/man/pwck.8.xml b/man/pwck.8.xml index bc99605f..a196a458 100644 --- a/man/pwck.8.xml +++ b/man/pwck.8.xml @@ -30,6 +30,7 @@ --> @@ -266,6 +267,7 @@ tool: + &NONEXISTENT; &PASS_MAX_DAYS; &PASS_MIN_DAYS; &PASS_WARN_AGE; diff --git a/src/pwck.c b/src/pwck.c index be404c37..3d494a69 100644 --- a/src/pwck.c +++ b/src/pwck.c @@ -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; + } } }