aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorChris Wright <chrisw@osdl.org>2005-05-11 05:55:10 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-05-11 05:55:10 -0400
commitc1b773d87eadc3972d697444127e89a7291769a2 (patch)
treeedfce2e842c3b6be70f3b90584507aab9fb3de8f /kernel/auditsc.c
parent197c69c6afd2deb7eec44040ff533d90d26c6161 (diff)
Add audit_log_type
Add audit_log_type to allow callers to specify type and pid when logging. Convert audit_log to wrapper around audit_log_type. Could have converted all audit_log callers directly, but common case is default of type AUDIT_KERNEL and pid 0. Update audit_log_start to take type and pid values when creating a new audit_buffer. Move sequences that did audit_log_start, audit_log_format, audit_set_type, audit_log_end, to simply call audit_log_type directly. This obsoletes audit_set_type and audit_set_pid, so remove them. Signed-off-by: Chris Wright <chrisw@osdl.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 94338abf76f5..d089263253a7 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -648,7 +648,7 @@ static void audit_log_exit(struct audit_context *context)
648 int i; 648 int i;
649 struct audit_buffer *ab; 649 struct audit_buffer *ab;
650 650
651 ab = audit_log_start(context); 651 ab = audit_log_start(context, AUDIT_KERNEL, 0);
652 if (!ab) 652 if (!ab)
653 return; /* audit_panic has been called */ 653 return; /* audit_panic has been called */
654 audit_log_format(ab, "syscall=%d", context->major); 654 audit_log_format(ab, "syscall=%d", context->major);
@@ -680,7 +680,7 @@ static void audit_log_exit(struct audit_context *context)
680 while (context->aux) { 680 while (context->aux) {
681 struct audit_aux_data *aux; 681 struct audit_aux_data *aux;
682 682
683 ab = audit_log_start(context); 683 ab = audit_log_start(context, AUDIT_KERNEL, 0);
684 if (!ab) 684 if (!ab)
685 continue; /* audit_panic has been called */ 685 continue; /* audit_panic has been called */
686 686
@@ -701,7 +701,7 @@ static void audit_log_exit(struct audit_context *context)
701 } 701 }
702 702
703 for (i = 0; i < context->name_count; i++) { 703 for (i = 0; i < context->name_count; i++) {
704 ab = audit_log_start(context); 704 ab = audit_log_start(context, AUDIT_KERNEL, 0);
705 if (!ab) 705 if (!ab)
706 continue; /* audit_panic has been called */ 706 continue; /* audit_panic has been called */
707 audit_log_format(ab, "item=%d", i); 707 audit_log_format(ab, "item=%d", i);
@@ -1005,22 +1005,13 @@ int audit_get_stamp(struct audit_context *ctx,
1005 return 0; 1005 return 0;
1006} 1006}
1007 1007
1008extern int audit_set_type(struct audit_buffer *ab, int type);
1009
1010int audit_set_loginuid(struct task_struct *task, uid_t loginuid) 1008int audit_set_loginuid(struct task_struct *task, uid_t loginuid)
1011{ 1009{
1012 if (task->audit_context) { 1010 if (task->audit_context) {
1013 struct audit_buffer *ab; 1011 audit_log_type(NULL, AUDIT_LOGIN, 0,
1014 1012 "login pid=%d uid=%u old loginuid=%u new loginuid=%u",
1015 ab = audit_log_start(NULL); 1013 task->pid, task->uid, task->audit_context->loginuid,
1016 if (ab) { 1014 loginuid);
1017 audit_log_format(ab, "login pid=%d uid=%u "
1018 "old loginuid=%u new loginuid=%u",
1019 task->pid, task->uid,
1020 task->audit_context->loginuid, loginuid);
1021 audit_set_type(ab, AUDIT_LOGIN);
1022 audit_log_end(ab);
1023 }
1024 task->audit_context->loginuid = loginuid; 1015 task->audit_context->loginuid = loginuid;
1025 } 1016 }
1026 return 0; 1017 return 0;