kdc: Fix audit_addkv() typos and reason handling

Now we'll put the "reason=..." last in the log lines and we won't escape
spaces -- just newlines and other control characters.  This makes
reading log lines much easier without complicating parsing of log lines
because interior key=value pairs do get whitespace escaped or removed.
This commit is contained in:
Nicolas Williams
2019-12-10 21:17:23 -06:00
parent 9063d92dbb
commit 608c2876d4
7 changed files with 139 additions and 97 deletions

View File

@@ -442,8 +442,7 @@ bad_reqv(struct bx509_request_desc *r,
msg = formatted;
formatted = NULL;
}
_kdc_audit_addkv((kdc_request_t)r, KDC_AUDIT_VIS, "reason", "%s",
formatted);
_kdc_audit_addreason((kdc_request_t)r, "%s", formatted);
_kdc_audit_trail((kdc_request_t)r, code);
krb5_free_error_message(context, k5msg);
@@ -794,6 +793,7 @@ set_req_desc(struct MHD_Connection *connection,
r->target = r->redir = NULL;
r->pkix_store = NULL;
r->freeme1 = NULL;
r->reason = NULL;
r->ccname = NULL;
r->reply = NULL;
r->sname = NULL;
@@ -839,6 +839,7 @@ clean_req_desc(struct bx509_request_desc *r)
if (r->pkix_store)
(void) unlink(strchr(r->pkix_store, ':') + 1);
hx509_request_free(&r->req);
heim_release(r->reason);
heim_release(r->kv);
free(r->pkix_store);
free(r->freeme1);