From cde06ff7cea982c206a99a34457a07d392a65552 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 8 Dec 2014 12:05:06 -0500 Subject: Generalize GSS Display Status logger code This way it can be used both in stderr debugging as well as for sending errors to syslog. Signed-off-by: Simo Sorce --- proxy/src/gp_debug.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'proxy/src/gp_debug.c') diff --git a/proxy/src/gp_debug.c b/proxy/src/gp_debug.c index dbf7c49..1312488 100644 --- a/proxy/src/gp_debug.c +++ b/proxy/src/gp_debug.c @@ -24,8 +24,8 @@ */ #include "config.h" -#include #include "gp_debug.h" +#include "gp_log.h" /* global debug switch */ int gp_debug; @@ -38,25 +38,9 @@ void gp_debug_enable(void) void gp_log_failure(gss_OID mech, uint32_t maj, uint32_t min) { - uint32_t msgctx; - uint32_t discard; - gss_buffer_desc tmp; - - fprintf(stderr, "Failed with:"); - - if (mech != GSS_C_NO_OID) { - gss_oid_to_str(&discard, mech, &tmp); - fprintf(stderr, " (OID: %s)", (char *)tmp.value); - gss_release_buffer(&discard, &tmp); - } - - msgctx = 0; - gss_display_status(&discard, maj, GSS_C_GSS_CODE, mech, &msgctx, &tmp); - fprintf(stderr, " %s,", (char *)tmp.value); - gss_release_buffer(&discard, &tmp); - - msgctx = 0; - gss_display_status(&discard, min, GSS_C_MECH_CODE, mech, &msgctx, &tmp); - fprintf(stderr, " %s\n", (char *)tmp.value); - gss_release_buffer(&discard, &tmp); + char buf[MAX_LOG_LINE]; + + gp_fmt_status(mech, maj, min, buf, MAX_LOG_LINE); + + fprintf(stderr, "Failed with: %s\n", buf); } -- cgit