Audit the home directory ownership change.

This commit is contained in:
Tomas Mraz 2016-11-15 16:03:40 +01:00
parent 765993846d
commit 2b820c534d

View File

@ -1756,6 +1756,14 @@ static void move_home (void)
fail_exit (E_HOMEDIR); fail_exit (E_HOMEDIR);
} }
#ifdef WITH_AUDIT
if (uflg || gflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"changing home directory owner",
user_newname, (unsigned int) user_newid, 1);
}
#endif
if (rename (user_home, user_newhome) == 0) { if (rename (user_home, user_newhome) == 0) {
/* FIXME: rename above may have broken symlinks /* FIXME: rename above may have broken symlinks
* pointing to the user's home directory * pointing to the user's home directory
@ -2252,6 +2260,13 @@ int main (int argc, char **argv)
* ownership. * ownership.
* *
*/ */
#ifdef WITH_AUDIT
if (uflg || gflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"changing home directory owner",
user_newname, (unsigned int) user_newid, 1);
}
#endif
if (chown_tree (dflg ? user_newhome : user_home, if (chown_tree (dflg ? user_newhome : user_home,
user_id, user_id,
uflg ? user_newid : (uid_t)-1, uflg ? user_newid : (uid_t)-1,