Commit 41757106 authored by Steve Grubb's avatar Steve Grubb Committed by Al Viro

[PATCH] make set_loginuid obey audit_enabled

Hi,

I was doing some testing and noticed that when the audit system was disabled,
I was still getting messages about the loginuid being set. The following patch
makes audit_set_loginuid look at in_syscall to determine if it should create
an audit event. The loginuid will continue to be set as long as there is a context.
Signed-off-by: default avatarSteve Grubb <sgrubb@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9c937dcc
...@@ -1290,7 +1290,11 @@ void auditsc_get_stamp(struct audit_context *ctx, ...@@ -1290,7 +1290,11 @@ void auditsc_get_stamp(struct audit_context *ctx,
*/ */
int audit_set_loginuid(struct task_struct *task, uid_t loginuid) int audit_set_loginuid(struct task_struct *task, uid_t loginuid)
{ {
if (task->audit_context) { struct audit_context *context = task->audit_context;
if (context) {
/* Only log if audit is enabled */
if (context->in_syscall) {
struct audit_buffer *ab; struct audit_buffer *ab;
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN); ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN);
...@@ -1298,10 +1302,11 @@ int audit_set_loginuid(struct task_struct *task, uid_t loginuid) ...@@ -1298,10 +1302,11 @@ int audit_set_loginuid(struct task_struct *task, uid_t loginuid)
audit_log_format(ab, "login pid=%d uid=%u " audit_log_format(ab, "login pid=%d uid=%u "
"old auid=%u new auid=%u", "old auid=%u new auid=%u",
task->pid, task->uid, task->pid, task->uid,
task->audit_context->loginuid, loginuid); context->loginuid, loginuid);
audit_log_end(ab); audit_log_end(ab);
} }
task->audit_context->loginuid = loginuid; }
context->loginuid = loginuid;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment