Commit c1e8f06d authored by Steve Grubb's avatar Steve Grubb Committed by Paul Moore

audit: fix formatting of AUDIT_CONFIG_CHANGE events

The AUDIT_CONFIG_CHANGE events sometimes use a op= field. The current
code logs the value of the field with quotes. This field is documented
to not be encoded, so it should not have quotes.
Signed-off-by: default avatarSteve Grubb <sgrubb@redhat.com>
Reviewed-by: default avatarRichard Guy Briggs <rgb@redhat.com>
[PM: reformatted commit description to make checkpatch.pl happy]
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 833fc48d
...@@ -130,10 +130,9 @@ static void audit_mark_log_rule_change(struct audit_fsnotify_mark *audit_mark, c ...@@ -130,10 +130,9 @@ static void audit_mark_log_rule_change(struct audit_fsnotify_mark *audit_mark, c
ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE); ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE);
if (unlikely(!ab)) if (unlikely(!ab))
return; return;
audit_log_format(ab, "auid=%u ses=%u op=", audit_log_format(ab, "auid=%u ses=%u op=%s",
from_kuid(&init_user_ns, audit_get_loginuid(current)), from_kuid(&init_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current)); audit_get_sessionid(current), op);
audit_log_string(ab, op);
audit_log_format(ab, " path="); audit_log_format(ab, " path=");
audit_log_untrustedstring(ab, audit_mark->path); audit_log_untrustedstring(ab, audit_mark->path);
audit_log_key(ab, rule->filterkey); audit_log_key(ab, rule->filterkey);
......
...@@ -458,8 +458,7 @@ static void audit_tree_log_remove_rule(struct audit_krule *rule) ...@@ -458,8 +458,7 @@ static void audit_tree_log_remove_rule(struct audit_krule *rule)
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
if (unlikely(!ab)) if (unlikely(!ab))
return; return;
audit_log_format(ab, "op="); audit_log_format(ab, "op=remove_rule");
audit_log_string(ab, "remove_rule");
audit_log_format(ab, " dir="); audit_log_format(ab, " dir=");
audit_log_untrustedstring(ab, rule->tree->pathname); audit_log_untrustedstring(ab, rule->tree->pathname);
audit_log_key(ab, rule->filterkey); audit_log_key(ab, rule->filterkey);
......
...@@ -242,10 +242,9 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc ...@@ -242,10 +242,9 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc
ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE); ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE);
if (unlikely(!ab)) if (unlikely(!ab))
return; return;
audit_log_format(ab, "auid=%u ses=%u op=", audit_log_format(ab, "auid=%u ses=%u op=%s",
from_kuid(&init_user_ns, audit_get_loginuid(current)), from_kuid(&init_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current)); audit_get_sessionid(current), op);
audit_log_string(ab, op);
audit_log_format(ab, " path="); audit_log_format(ab, " path=");
audit_log_untrustedstring(ab, w->path); audit_log_untrustedstring(ab, w->path);
audit_log_key(ab, r->filterkey); audit_log_key(ab, r->filterkey);
......
...@@ -1074,8 +1074,7 @@ static void audit_log_rule_change(char *action, struct audit_krule *rule, int re ...@@ -1074,8 +1074,7 @@ static void audit_log_rule_change(char *action, struct audit_krule *rule, int re
return; return;
audit_log_format(ab, "auid=%u ses=%u" ,loginuid, sessionid); audit_log_format(ab, "auid=%u ses=%u" ,loginuid, sessionid);
audit_log_task_context(ab); audit_log_task_context(ab);
audit_log_format(ab, " op="); audit_log_format(ab, " op=%s", action);
audit_log_string(ab, action);
audit_log_key(ab, rule->filterkey); audit_log_key(ab, rule->filterkey);
audit_log_format(ab, " list=%d res=%d", rule->listnr, res); audit_log_format(ab, " list=%d res=%d", rule->listnr, res);
audit_log_end(ab); audit_log_end(ab);
......
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