Merge pull request #177 from edneville/conflicts_between_system_users_useradd_and_pwck
pwck.c: only check home dirs if set and not a system user
This commit is contained in:
commit
e78d22469f
19
src/pwck.c
19
src/pwck.c
@ -389,6 +389,8 @@ static void check_pw_file (int *errors, bool *changed)
|
|||||||
struct commonio_entry *pfe, *tpfe;
|
struct commonio_entry *pfe, *tpfe;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
struct spwd *spw;
|
struct spwd *spw;
|
||||||
|
uid_t min_sys_id = (uid_t) getdef_ulong ("SYS_UID_MIN", 101UL);
|
||||||
|
uid_t max_sys_id = (uid_t) getdef_ulong ("SYS_UID_MAX", 999UL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop through the entire password file.
|
* Loop through the entire password file.
|
||||||
@ -518,15 +520,20 @@ static void check_pw_file (int *errors, bool *changed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the home directory exists
|
* If uid is system and has a home directory, then check
|
||||||
*/
|
*/
|
||||||
if (!quiet && (access (pwd->pw_dir, F_OK) != 0)) {
|
if (!(pwd->pw_uid >= min_sys_id && pwd->pw_uid <= max_sys_id && pwd->pw_dir && pwd->pw_dir[0])) {
|
||||||
/*
|
/*
|
||||||
* Home directory doesn't exist, give a warning
|
* Make sure the home directory exists
|
||||||
*/
|
*/
|
||||||
printf (_("user '%s': directory '%s' does not exist\n"),
|
if (!quiet && (access (pwd->pw_dir, F_OK) != 0)) {
|
||||||
pwd->pw_name, pwd->pw_dir);
|
/*
|
||||||
*errors += 1;
|
* Home directory doesn't exist, give a warning
|
||||||
|
*/
|
||||||
|
printf (_("user '%s': directory '%s' does not exist\n"),
|
||||||
|
pwd->pw_name, pwd->pw_dir);
|
||||||
|
*errors += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user