aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorEric Paris <eparis@localhost.localdomain>2013-04-30 09:53:34 -0400
committerEric Paris <eparis@redhat.com>2013-04-30 15:31:28 -0400
commit4d3fb709b285ac885c40950a837edbfc90029c5f (patch)
tree97d57baf099cbcb48e756213cf83f06602497a01 /kernel/audit.c
parentb122c3767c1d89763b4babca062c3171a71ed97c (diff)
helper for some session id stuff
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index a3c77b979b5b..44803f25b236 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -269,14 +269,12 @@ static int audit_log_config_change(char *function_name, int new, int old,
269{ 269{
270 struct audit_buffer *ab; 270 struct audit_buffer *ab;
271 int rc = 0; 271 int rc = 0;
272 u32 sessionid = audit_get_sessionid(current);
273 uid_t auid = from_kuid(&init_user_ns, audit_get_loginuid(current));
274 272
275 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); 273 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
276 if (unlikely(!ab)) 274 if (unlikely(!ab))
277 return rc; 275 return rc;
278 audit_log_format(ab, "%s=%d old=%d auid=%u ses=%u", function_name, new, 276 audit_log_format(ab, "%s=%d old=%d", function_name, new, old);
279 old, auid, sessionid); 277 audit_log_session_info(ab);
280 rc = audit_log_task_context(ab); 278 rc = audit_log_task_context(ab);
281 if (rc) 279 if (rc)
282 allow_changes = 0; /* Something weird, deny request */ 280 allow_changes = 0; /* Something weird, deny request */
@@ -611,9 +609,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
611static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) 609static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)
612{ 610{
613 int rc = 0; 611 int rc = 0;
614 u32 sessionid = audit_get_sessionid(current);
615 uid_t uid = from_kuid(&init_user_ns, current_uid()); 612 uid_t uid = from_kuid(&init_user_ns, current_uid());
616 uid_t auid = from_kuid(&init_user_ns, audit_get_loginuid(current));
617 613
618 if (!audit_enabled) { 614 if (!audit_enabled) {
619 *ab = NULL; 615 *ab = NULL;
@@ -623,8 +619,8 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)
623 *ab = audit_log_start(NULL, GFP_KERNEL, msg_type); 619 *ab = audit_log_start(NULL, GFP_KERNEL, msg_type);
624 if (unlikely(!*ab)) 620 if (unlikely(!*ab))
625 return rc; 621 return rc;
626 audit_log_format(*ab, "pid=%d uid=%u auid=%u ses=%u", 622 audit_log_format(*ab, "pid=%d uid=%u", task_tgid_vnr(current), uid);
627 task_tgid_vnr(current), uid, auid, sessionid); 623 audit_log_session_info(*ab);
628 audit_log_task_context(*ab); 624 audit_log_task_context(*ab);
629 625
630 return rc; 626 return rc;
@@ -1376,6 +1372,14 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
1376 kfree(pathname); 1372 kfree(pathname);
1377} 1373}
1378 1374
1375void audit_log_session_info(struct audit_buffer *ab)
1376{
1377 u32 sessionid = audit_get_sessionid(current);
1378 uid_t auid = from_kuid(&init_user_ns, audit_get_loginuid(current));
1379
1380 audit_log_format(ab, "auid=%u ses=%u\n", auid, sessionid);
1381}
1382
1379void audit_log_key(struct audit_buffer *ab, char *key) 1383void audit_log_key(struct audit_buffer *ab, char *key)
1380{ 1384{
1381 audit_log_format(ab, " key="); 1385 audit_log_format(ab, " key=");