Skip to content

Commit 11df51a

Browse files
committed
Moved mav_print_gss_err to a more logical file
1 parent 007f950 commit 11df51a

File tree

3 files changed

+40
-44
lines changed

3 files changed

+40
-44
lines changed

log.h

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifndef MAV_LOG_H
1+
#ifndef MiAV_LOG_H
22
#define MAV_LOG_H
33

44
/*
@@ -157,6 +157,43 @@
157157
/*
158158
* Prints a message with a GSS error code to traceLogFileName if TRACE_DEBUG is defined otherwise prints to stderr
159159
*/
160-
void print_gss_err(const char *prefix, OM_uint32 major_status, OM_uint32 minor_status);
160+
static void mav_print_gss_err(const char *prefix, OM_uint32 major_status, OM_uint32 minor_status)
161+
{
162+
OM_uint32 majErr, minErr = 0;
163+
OM_uint32 message_context = 0;
164+
gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
165+
166+
if ( GSS_ERROR(major_status) || GSS_SUPPLEMENTARY_INFO(major_status) ) {
167+
/* First process the Major status code */
168+
do {
169+
/* Get the status string associated
170+
* with the Major (GSS=API) status code */
171+
majErr = gss_display_status( &minErr, major_status, GSS_C_GSS_CODE, GSS_C_NO_OID, &message_context, &status_string );
172+
/* Print the status string */
173+
#ifdef TRACE_DEBUG
174+
tfprintf("%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value );
175+
#else
176+
fprintf(stderr, "%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value );
177+
#endif
178+
/* Free the status string buffer */
179+
gss_release_buffer( &minErr, &status_string );
180+
} while( message_context && !GSS_ERROR( majErr ) );
181+
182+
/* Then process the Minor status code */
183+
do {
184+
/* Get the status string associated
185+
* with the Minor (mechanism) status code */
186+
majErr = gss_display_status( &minErr, minor_status, GSS_C_MECH_CODE, GSS_C_NO_OID, &message_context, &status_string );
187+
/* Print the status string */
188+
#ifdef TRACE_DEBUG
189+
tfprintf(": %.*s\n", (int)status_string.length, (char*)status_string.value );
190+
#else
191+
fprintf(stderr, ": %.*s\n", (int)status_string.length, (char*)status_string.value );
192+
#endif
193+
/* Free the status string buffer */
194+
gss_release_buffer( &minErr, &status_string );
195+
} while( message_context && !GSS_ERROR( majErr ) );
196+
}
197+
}
161198

162199
#endif /* MAV_LOG_H */

mod_auth_vas4.c

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,44 +2989,3 @@ AP_DECLARE_MODULE(auth_vas4) =
29892989
auth_vas_register_hooks /* register_hooks */
29902990
};
29912991

2992-
/*
2993-
* Prints a message with a GSS error code to traceLogFileName if TRACE_DEBUG is defined otherwise prints to stderr
2994-
*/
2995-
void print_gss_err(const char *prefix, OM_uint32 major_status, OM_uint32 minor_status)
2996-
{
2997-
OM_uint32 majErr, minErr = 0;
2998-
OM_uint32 message_context = 0;
2999-
gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
3000-
3001-
if ( GSS_ERROR(major_status) || GSS_SUPPLEMENTARY_INFO(major_status) ) {
3002-
/* First process the Major status code */
3003-
do {
3004-
/* Get the status string associated
3005-
with the Major (GSS=API) status code */
3006-
majErr = gss_display_status( &minErr, major_status, GSS_C_GSS_CODE, GSS_C_NO_OID, &message_context, &status_string );
3007-
/* Print the status string */
3008-
#ifdef TRACE_DEBUG
3009-
tfprintf("%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value );
3010-
#else
3011-
fprintf(stderr, "%s: %.*s\n", prefix, (int)status_string.length, (char*)status_string.value );
3012-
#endif
3013-
/* Free the status string buffer */
3014-
gss_release_buffer( &minErr, &status_string );
3015-
} while( message_context && !GSS_ERROR( majErr ) );
3016-
3017-
/* Then process the Minor status code */
3018-
do {
3019-
/* Get the status string associated
3020-
with the Minor (mechanism) status code */
3021-
majErr = gss_display_status( &minErr, minor_status, GSS_C_MECH_CODE, GSS_C_NO_OID, &message_context, &status_string );
3022-
/* Print the status string */
3023-
#ifdef TRACE_DEBUG
3024-
tfprintf(": %.*s\n", (int)status_string.length, (char*)status_string.value );
3025-
#else
3026-
fprintf(stderr, ": %.*s\n", (int)status_string.length, (char*)status_string.value );
3027-
#endif
3028-
/* Free the status string buffer */
3029-
gss_release_buffer( &minErr, &status_string );
3030-
} while( message_context && !GSS_ERROR( majErr ) );
3031-
}
3032-
}

user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ vas_err_t auth_vas_user_use_gss_result(
218218
}
219219

220220
if (vaserr) {
221-
print_gss_err("vas_gss_auth", vaserr, minor_status);
221+
mav_print_gss_err("vas_gss_auth", vaserr, minor_status);
222222
avuser->vas_authctx = NULL; /* ensure */
223223
}
224224

0 commit comments

Comments
 (0)