diff options
-rw-r--r-- | kernel/auditsc.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 851ae0217e4b..b097ccb4eb7e 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -1290,18 +1290,23 @@ void auditsc_get_stamp(struct audit_context *ctx, | |||
1290 | */ | 1290 | */ |
1291 | int audit_set_loginuid(struct task_struct *task, uid_t loginuid) | 1291 | int audit_set_loginuid(struct task_struct *task, uid_t loginuid) |
1292 | { | 1292 | { |
1293 | if (task->audit_context) { | 1293 | struct audit_context *context = task->audit_context; |
1294 | struct audit_buffer *ab; | 1294 | |
1295 | 1295 | if (context) { | |
1296 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN); | 1296 | /* Only log if audit is enabled */ |
1297 | if (ab) { | 1297 | if (context->in_syscall) { |
1298 | audit_log_format(ab, "login pid=%d uid=%u " | 1298 | struct audit_buffer *ab; |
1299 | "old auid=%u new auid=%u", | 1299 | |
1300 | task->pid, task->uid, | 1300 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN); |
1301 | task->audit_context->loginuid, loginuid); | 1301 | if (ab) { |
1302 | audit_log_end(ab); | 1302 | audit_log_format(ab, "login pid=%d uid=%u " |
1303 | "old auid=%u new auid=%u", | ||
1304 | task->pid, task->uid, | ||
1305 | context->loginuid, loginuid); | ||
1306 | audit_log_end(ab); | ||
1307 | } | ||
1303 | } | 1308 | } |
1304 | task->audit_context->loginuid = loginuid; | 1309 | context->loginuid = loginuid; |
1305 | } | 1310 | } |
1306 | return 0; | 1311 | return 0; |
1307 | } | 1312 | } |