From f74e9223b69023c49a560de3b5b4134145a12531 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Fri, 24 Dec 2021 10:41:43 +1100 Subject: [PATCH] tests: add some logging to windc test plugin Log some parameters from the astgs_request_t. --- tests/plugin/windc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/plugin/windc.c b/tests/plugin/windc.c index e1473ea4f..b1e27d9cc 100644 --- a/tests/plugin/windc.c +++ b/tests/plugin/windc.c @@ -94,17 +94,36 @@ pac_verify(void *ctx, krb5_context context, return krb5_pac_verify(context, *pac, 0, NULL, NULL, &key->key); } +static void logit(const char *what, astgs_request_t r) +{ + char *client_princ_name = NULL; + char *server_princ_name = NULL; + + if (r->client_princ) + krb5_unparse_name(r->context, r->client_princ, &client_princ_name); + if (r->server_princ) + krb5_unparse_name(r->context, r->server_princ, &server_princ_name); + + krb5_warnx(r->context, "%s: client %s server %s", + what, + client_princ_name ? client_princ_name : "", + server_princ_name ? server_princ_name : ""); + + krb5_xfree(server_princ_name); + krb5_xfree(client_princ_name); +} + static krb5_error_code KRB5_CALLCONV client_access(void *ctx, astgs_request_t r) { - krb5_warnx(r->context, "client_access"); + logit("client_access", r); return 0; } static krb5_error_code KRB5_CALLCONV finalize_reply(void *ctx, astgs_request_t r) { - krb5_warnx(r->context, "finalize_reply"); + logit("finalize_reply", r); return 0; }