Merge branch 'stable-4.7' of git://git.infradead.org/users/pcmoore/audit
Pull audit updates from Paul Moore: "Four small audit patches for 4.7. Two are simple cleanups around the audit thread management code, one adds a tty field to AUDIT_LOGIN events, and the final patch makes tty_name() usable regardless of CONFIG_TTY. Nothing controversial, and it all passes our regression test" * 'stable-4.7' of git://git.infradead.org/users/pcmoore/audit: tty: provide tty_name() even without CONFIG_TTY audit: add tty field to LOGIN event audit: we don't need to __set_current_state(TASK_RUNNING) audit: cleanup prune_tree_thread
This commit is contained in:
@ -1980,6 +1980,7 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid,
|
||||
{
|
||||
struct audit_buffer *ab;
|
||||
uid_t uid, oldloginuid, loginuid;
|
||||
struct tty_struct *tty;
|
||||
|
||||
if (!audit_enabled)
|
||||
return;
|
||||
@ -1987,14 +1988,17 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid,
|
||||
uid = from_kuid(&init_user_ns, task_uid(current));
|
||||
oldloginuid = from_kuid(&init_user_ns, koldloginuid);
|
||||
loginuid = from_kuid(&init_user_ns, kloginuid),
|
||||
tty = audit_get_tty(current);
|
||||
|
||||
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN);
|
||||
if (!ab)
|
||||
return;
|
||||
audit_log_format(ab, "pid=%d uid=%u", task_pid_nr(current), uid);
|
||||
audit_log_task_context(ab);
|
||||
audit_log_format(ab, " old-auid=%u auid=%u old-ses=%u ses=%u res=%d",
|
||||
oldloginuid, loginuid, oldsessionid, sessionid, !rc);
|
||||
audit_log_format(ab, " old-auid=%u auid=%u tty=%s old-ses=%u ses=%u res=%d",
|
||||
oldloginuid, loginuid, tty ? tty_name(tty) : "(none)",
|
||||
oldsessionid, sessionid, !rc);
|
||||
audit_put_tty(tty);
|
||||
audit_log_end(ab);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user