pwck.c: only check home dirs if set and not a system user
Closes #126 Changelog: pwck, better to look at array than to use strnlen.
This commit is contained in:
parent
5687be5f31
commit
c4e8b411d4
@ -382,6 +382,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.
|
||||||
@ -509,6 +511,10 @@ static void check_pw_file (int *errors, bool *changed)
|
|||||||
*errors += 1;
|
*errors += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If uid is system and has a home directory, then check
|
||||||
|
*/
|
||||||
|
if (!(pwd->pw_uid >= min_sys_id && pwd->pw_uid <= max_sys_id && pwd->pw_dir && pwd->pw_dir[0])) {
|
||||||
/*
|
/*
|
||||||
* Make sure the home directory exists
|
* Make sure the home directory exists
|
||||||
*/
|
*/
|
||||||
@ -520,6 +526,7 @@ static void check_pw_file (int *errors, bool *changed)
|
|||||||
pwd->pw_name, pwd->pw_dir);
|
pwd->pw_name, pwd->pw_dir);
|
||||||
*errors += 1;
|
*errors += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the login shell is executable
|
* Make sure the login shell is executable
|
||||||
|
Loading…
Reference in New Issue
Block a user