From 11df51a272f84d772a1da0cd0e517b05a4163048 Mon Sep 17 00:00:00 2001 From: Jayson Hurst Date: Sat, 9 Feb 2013 21:28:00 -0700 Subject: [PATCH] Moved mav_print_gss_err to a more logical file --- log.h | 41 +++++++++++++++++++++++++++++++++++++++-- mod_auth_vas4.c | 41 ----------------------------------------- user.c | 2 +- 3 files changed, 40 insertions(+), 44 deletions(-) diff --git a/log.h b/log.h index 09d9401..f074f3f 100644 --- a/log.h +++ b/log.h @@ -1,4 +1,4 @@ -#ifndef MAV_LOG_H +#ifndef MiAV_LOG_H #define MAV_LOG_H /* @@ -157,6 +157,43 @@ /* * Prints a message with a GSS error code to traceLogFileName if TRACE_DEBUG is defined otherwise prints to stderr */ -void print_gss_err(const char *prefix, OM_uint32 major_status, OM_uint32 minor_status); +static void mav_print_gss_err(const char *prefix, OM_uint32 major_status, OM_uint32 minor_status) +{ + OM_uint32 majErr, minErr = 0; + OM_uint32 message_context = 0; + gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER; + + if ( GSS_ERROR(major_status) || GSS_SUPPLEMENTARY_INFO(major_status) ) { + /* First process the Major status code */ + do { + /* Get the status string associated + * with the Major (GSS=API) status code */ + majErr = gss_display_status( &minErr, major_status, GSS_C_GSS_CODE, GSS_C_NO_OID, &message_context, &status_string ); + /* Print the status string */ + #ifdef TRACE_DEBUG + tfprintf("%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value ); + #else + fprintf(stderr, "%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value ); + #endif + /* Free the status string buffer */ + gss_release_buffer( &minErr, &status_string ); + } while( message_context && !GSS_ERROR( majErr ) ); + + /* Then process the Minor status code */ + do { + /* Get the status string associated + * with the Minor (mechanism) status code */ + majErr = gss_display_status( &minErr, minor_status, GSS_C_MECH_CODE, GSS_C_NO_OID, &message_context, &status_string ); + /* Print the status string */ + #ifdef TRACE_DEBUG + tfprintf(": %.*s\n", (int)status_string.length, (char*)status_string.value ); + #else + fprintf(stderr, ": %.*s\n", (int)status_string.length, (char*)status_string.value ); + #endif + /* Free the status string buffer */ + gss_release_buffer( &minErr, &status_string ); + } while( message_context && !GSS_ERROR( majErr ) ); + } +} #endif /* MAV_LOG_H */ diff --git a/mod_auth_vas4.c b/mod_auth_vas4.c index 9cd433a..2981192 100644 --- a/mod_auth_vas4.c +++ b/mod_auth_vas4.c @@ -2989,44 +2989,3 @@ AP_DECLARE_MODULE(auth_vas4) = auth_vas_register_hooks /* register_hooks */ }; -/* - * Prints a message with a GSS error code to traceLogFileName if TRACE_DEBUG is defined otherwise prints to stderr - */ -void print_gss_err(const char *prefix, OM_uint32 major_status, OM_uint32 minor_status) -{ - OM_uint32 majErr, minErr = 0; - OM_uint32 message_context = 0; - gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER; - - if ( GSS_ERROR(major_status) || GSS_SUPPLEMENTARY_INFO(major_status) ) { - /* First process the Major status code */ - do { - /* Get the status string associated - with the Major (GSS=API) status code */ - majErr = gss_display_status( &minErr, major_status, GSS_C_GSS_CODE, GSS_C_NO_OID, &message_context, &status_string ); - /* Print the status string */ - #ifdef TRACE_DEBUG - tfprintf("%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value ); - #else - fprintf(stderr, "%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value ); - #endif - /* Free the status string buffer */ - gss_release_buffer( &minErr, &status_string ); - } while( message_context && !GSS_ERROR( majErr ) ); - - /* Then process the Minor status code */ - do { - /* Get the status string associated - with the Minor (mechanism) status code */ - majErr = gss_display_status( &minErr, minor_status, GSS_C_MECH_CODE, GSS_C_NO_OID, &message_context, &status_string ); - /* Print the status string */ - #ifdef TRACE_DEBUG - tfprintf(": %.*s\n", (int)status_string.length, (char*)status_string.value ); - #else - fprintf(stderr, ": %.*s\n", (int)status_string.length, (char*)status_string.value ); - #endif - /* Free the status string buffer */ - gss_release_buffer( &minErr, &status_string ); - } while( message_context && !GSS_ERROR( majErr ) ); - } -} diff --git a/user.c b/user.c index c80b00f..bd9e78d 100644 --- a/user.c +++ b/user.c @@ -218,7 +218,7 @@ vas_err_t auth_vas_user_use_gss_result( } if (vaserr) { - print_gss_err("vas_gss_auth", vaserr, minor_status); + mav_print_gss_err("vas_gss_auth", vaserr, minor_status); avuser->vas_authctx = NULL; /* ensure */ }