Skip to content

Commit

Permalink
Moved mav_print_gss_err to a more logical file
Browse files Browse the repository at this point in the history
  • Loading branch information
JaysonHurst committed Feb 10, 2013
1 parent 007f950 commit 11df51a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 44 deletions.
41 changes: 39 additions & 2 deletions log.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef MAV_LOG_H
#ifndef MiAV_LOG_H
#define MAV_LOG_H

/*
Expand Down Expand Up @@ -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 */
41 changes: 0 additions & 41 deletions mod_auth_vas4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
}
2 changes: 1 addition & 1 deletion user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}

Expand Down

0 comments on commit 11df51a

Please sign in to comment.