From 5e3c0a7ce022bc53dcc689b9be77e1f17a621302 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Thu, 23 Dec 2021 23:04:54 -0600 Subject: [PATCH] base: Add ret to common svc req elements We're logging SUCCESS even when the KDC sends error replies. That's because we're returning success to process_request() even when we send errors to clients. The error we want to send to the client, and that we succeed or fail to send it, are different statuses. To fix this we'll add a `ret` field to the common service request state structure, HEIM_SVC_REQUEST_DESC_COMMON_ELEMENTS / heim_svc_req_desc_common_s. --- lib/base/heimbase-svc.h | 3 ++- lib/base/log.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/base/heimbase-svc.h b/lib/base/heimbase-svc.h index 6e7eb5fb9..1f0abd622 100644 --- a/lib/base/heimbase-svc.h +++ b/lib/base/heimbase-svc.h @@ -68,6 +68,7 @@ const char *e_text; \ char *e_text_buf; \ heim_string_t reason; \ - heim_array_t kv + heim_array_t kv; \ + int32_t ret #endif /* HEIMBASE_SVC_H */ diff --git a/lib/base/log.c b/lib/base/log.c index 98c4dcddc..904d0c3ba 100644 --- a/lib/base/log.c +++ b/lib/base/log.c @@ -820,7 +820,7 @@ heim_audit_trail(heim_svc_req_desc r, heim_error_code ret, const char *retname) #define CASE(x) case x : retval = #x; break if (retname) { retval = retname; - } else switch (ret) { + } else switch (ret ? ret : r->ret) { CASE(ENOMEM); CASE(ENOENT); CASE(EACCES);