audit: don't generate loginuid log when audit disabled
authorGao feng <gaofeng@cn.fujitsu.com>
Fri, 1 Nov 2013 11:34:45 +0000 (19:34 +0800)
committerEric Paris <eparis@redhat.com>
Tue, 14 Jan 2014 03:30:25 +0000 (22:30 -0500)
If audit is disabled, we shouldn't generate loginuid audit
log.

Acked-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
kernel/auditsc.c

index df1e685809e1363218c09ccf5b87191d6f1ef976..9ab02fa2334ce5b7975f03c772804b4c4eb5da1a 100644 (file)
@@ -1971,6 +1971,9 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid,
        struct audit_buffer *ab;
        uid_t uid, ologinuid, nloginuid;
 
+       if (!audit_enabled)
+               return;
+
        uid = from_kuid(&init_user_ns, task_uid(current));
        ologinuid = from_kuid(&init_user_ns, koldloginuid);
        nloginuid = from_kuid(&init_user_ns, kloginuid),